Skip to content

Commit c24bd29

Browse files
committed
parser - fix order of tcp options flags according to ipfix standard
https://www.iana.org/assignments/ipfix/ipfix.xhtml, entity 209 - tcpOptions
1 parent 3717722 commit c24bd29

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

input/parser.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,9 @@ inline uint16_t parse_tcp_hdr(const u_char *data_ptr, uint16_t data_len, Packet
503503
uint8_t opt_len = (opt_kind <= 1 ? 1 : *(opt_ptr + 1));
504504
DEBUG_MSG("\t\t%u: len=%u\n", opt_kind, opt_len);
505505

506-
pkt->tcp_options |= ((uint64_t) 1 << opt_kind);
506+
// according to ipfix standard, tcp option flags are reversed from the bit indices in each byte
507+
// see https://www.iana.org/assignments/ipfix/ipfix.xhtml, entity no. 209 - tcpOptions
508+
pkt->tcp_options |= uint64_t(1) << ((opt_kind & 0xF8) + (0x07 - (opt_kind&0x07)));
507509
if (opt_kind == 0x00) {
508510
break;
509511
} else if (opt_kind == 0x02) {

0 commit comments

Comments
 (0)