diff options
author | Philippe Antoine <contact@catenacyber.fr> | 2020-04-15 16:19:57 +0200 |
---|---|---|
committer | Philippe Antoine <contact@catenacyber.fr> | 2020-04-15 16:19:57 +0200 |
commit | cf47ba234a59db325a382db4bbdf10187f93eb9a (patch) | |
tree | 4e076a2b00f58f0ad95048175fff16c6381ee0a0 /example/reader_util.c | |
parent | 98f2d3a73c0d4b09b1204e4cfc868ec258a3e478 (diff) |
Use ndpi_handle_ipv6_extension_headers in reader_util
Diffstat (limited to 'example/reader_util.c')
-rw-r--r-- | example/reader_util.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/example/reader_util.c b/example/reader_util.c index e5aa7478b..8b7bc1c75 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1691,12 +1691,11 @@ ether_type_check: return(nproto); /* Too short for IPv6 header*/ iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset]; proto = iph6->ip6_hdr.ip6_un1_nxt; - ip_len = sizeof(struct ndpi_ipv6hdr); + ip_len = ntohs(iph6->ip6_hdr.ip6_un1_plen); - if(proto == IPPROTO_DSTOPTS /* IPv6 destination option */) { - u_int8_t *options = (u_int8_t*)&packet[ip_offset+ip_len]; - proto = options[0]; - ip_len += 8 * (options[1] + 1); + const u_int8_t *l4ptr = (((const u_int8_t *) iph6) + sizeof(struct ndpi_ipv6hdr)); + if(ndpi_handle_ipv6_extension_headers(NULL, &l4ptr, &ip_len, &proto) != 0) { + return(nproto); } iph = NULL; |