|
21 | 21 | #include "output-packet.h" |
22 | 22 | #include "output-flow.h" |
23 | 23 | #include "output-tx.h" |
| 24 | +#include "flow-bindgen.h" |
24 | 25 | #include "util-print.h" |
25 | 26 | #include "output.h" |
26 | 27 |
|
@@ -53,26 +54,26 @@ static int CustomFlowLogger(ThreadVars *tv, void *thread_data, Flow *f) |
53 | 54 | char src_ip[46] = { 0 }, dst_ip[46] = { 0 }; |
54 | 55 | Port sp, dp; |
55 | 56 |
|
56 | | - if ((f->flags & FLOW_DIR_REVERSED) == 0) { |
57 | | - if (FLOW_IS_IPV4(f)) { |
58 | | - PrintInet(AF_INET, (const void *)&(f->src.addr_data32[0]), src_ip, sizeof(src_ip)); |
59 | | - PrintInet(AF_INET, (const void *)&(f->dst.addr_data32[0]), dst_ip, sizeof(dst_ip)); |
60 | | - } else if (FLOW_IS_IPV6(f)) { |
61 | | - PrintInet(AF_INET6, (const void *)&(f->src.address), src_ip, sizeof(src_ip)); |
62 | | - PrintInet(AF_INET6, (const void *)&(f->dst.address), dst_ip, sizeof(dst_ip)); |
| 57 | + if ((SCFlowGetFlags(f) & FLOW_DIR_REVERSED) == 0) { |
| 58 | + if (SCFlowIsIPv4(f)) { |
| 59 | + PrintInet(AF_INET, SCFlowGetSourceAddress(f, AF_INET), src_ip, sizeof(src_ip)); |
| 60 | + PrintInet(AF_INET, SCFlowGetDestinationAddress(f, AF_INET), dst_ip, sizeof(dst_ip)); |
| 61 | + } else if (SCFlowIsIPv6(f)) { |
| 62 | + PrintInet(AF_INET6, SCFlowGetSourceAddress(f, AF_INET6), src_ip, sizeof(src_ip)); |
| 63 | + PrintInet(AF_INET6, SCFlowGetDestinationAddress(f, AF_INET6), dst_ip, sizeof(dst_ip)); |
63 | 64 | } |
64 | | - sp = f->sp; |
65 | | - dp = f->dp; |
| 65 | + sp = SCFlowGetSourcePort(f); |
| 66 | + dp = SCFlowGetDestinationPort(f); |
66 | 67 | } else { |
67 | | - if (FLOW_IS_IPV4(f)) { |
68 | | - PrintInet(AF_INET, (const void *)&(f->dst.addr_data32[0]), src_ip, sizeof(src_ip)); |
69 | | - PrintInet(AF_INET, (const void *)&(f->src.addr_data32[0]), dst_ip, sizeof(dst_ip)); |
70 | | - } else if (FLOW_IS_IPV6(f)) { |
71 | | - PrintInet(AF_INET6, (const void *)&(f->dst.address), src_ip, sizeof(src_ip)); |
72 | | - PrintInet(AF_INET6, (const void *)&(f->src.address), dst_ip, sizeof(dst_ip)); |
| 68 | + if (SCFlowIsIPv4(f)) { |
| 69 | + PrintInet(AF_INET, SCFlowGetDestinationAddress(f, AF_INET), src_ip, sizeof(src_ip)); |
| 70 | + PrintInet(AF_INET, SCFlowGetSourceAddress(f, AF_INET), dst_ip, sizeof(dst_ip)); |
| 71 | + } else if (SCFlowIsIPv6(f)) { |
| 72 | + PrintInet(AF_INET6, SCFlowGetDestinationAddress(f, AF_INET6), src_ip, sizeof(src_ip)); |
| 73 | + PrintInet(AF_INET6, SCFlowGetSourceAddress(f, AF_INET6), dst_ip, sizeof(dst_ip)); |
73 | 74 | } |
74 | | - sp = f->dp; |
75 | | - dp = f->sp; |
| 75 | + sp = SCFlowGetDestinationPort(f); |
| 76 | + dp = SCFlowGetSourcePort(f); |
76 | 77 | } |
77 | 78 |
|
78 | 79 | SCLogNotice("Flow: %s:%u -> %s:%u", src_ip, sp, dst_ip, dp); |
|
0 commit comments