Skip to content

Commit 96ebd8f

Browse files
committed
honor the ipVersion flag, if both - IPv4 and IPv6 addreeses are present
1 parent e693d54 commit 96ebd8f

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/inline/nffile_inline.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@ static inline int MapRecordHandle(recordHandle_t *handle, recordHeaderV3_t *reco
9494
if (natCommon) genericFlow->msecFirst = natCommon->msecEvent;
9595
}
9696
}
97+
EXlayer2_t *EXlayer2 = (EXlayer2_t *)handle->extensionList[EXlayer2ID];
98+
if (EXlayer2) {
99+
// Honor the IPversion flag and mask out the unneeded extension
100+
switch (EXlayer2->ipVersion) {
101+
case 4:
102+
if (handle->extensionList[EXipv6FlowID]) {
103+
handle->extensionList[EXipv6FlowID] = NULL;
104+
recordHeaderV3->numElements--;
105+
}
106+
break;
107+
case 6:
108+
if (handle->extensionList[EXipv4FlowID]) {
109+
handle->extensionList[EXipv4FlowID] = NULL;
110+
recordHeaderV3->numElements--;
111+
}
112+
break;
113+
default:
114+
LogError("Mapping record: %" PRIu64 " - Error - unknown IP version: %d", flowCount, EXlayer2->ipVersion);
115+
}
116+
}
97117
return 1;
98118
}
99119

0 commit comments

Comments
 (0)