aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2020-12-11 21:01:51 +0100
committerGitHub <noreply@github.com>2020-12-11 21:01:51 +0100
commit74a77e7b3d4af1a3bebb2628ba551089cefc4e74 (patch)
treeee2dae8badbdba806b1bf7f18a9cf755418162ef /example/reader_util.c
parentedf3a57a6a197ea197d6c07d50dc94bc7bd97f8d (diff)
Added --ignore-vlanid / -I to exclude VLAN ids for flow hash calculation. #1073 (#1085)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index 9708e49b1..8546c427e 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -779,7 +779,10 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
flow.protocol = iph->protocol, flow.vlan_id = vlan_id;
flow.src_ip = iph->saddr, flow.dst_ip = iph->daddr;
flow.src_port = htons(*sport), flow.dst_port = htons(*dport);
- flow.hashval = hashval = flow.protocol + flow.vlan_id + flow.src_ip + flow.dst_ip + flow.src_port + flow.dst_port;
+ flow.hashval = hashval = flow.protocol + flow.src_ip + flow.dst_ip + flow.src_port + flow.dst_port;
+ if (workflow->prefs.ignore_vlanid == 0) {
+ flow.hashval += flow.vlan_id;
+ }
#if 0
printf("hashval=%u [%u][%u][%u:%u][%u:%u]\n", hashval, flow.protocol, flow.vlan_id,