diff options
author | Luca Deri <deri@ntop.org> | 2020-10-15 21:52:31 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2020-10-15 21:57:59 +0200 |
commit | e9721eb4ceecac2379d3c6f5c6abdd4d4a27628c (patch) | |
tree | 555b6d6e3a9f97938ad90cbb217114d8b6ccf081 /src | |
parent | 88f3519ab3979fa632df99d7a62e7ffcd2c73c88 (diff) |
Improved processing of IPv6 header
Improved QUIC serialization
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ndpi_main.c | 10 | ||||
-rw-r--r-- | src/lib/ndpi_utils.c | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 67636a1fc..4cbe722c2 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -3446,21 +3446,25 @@ int ndpi_handle_ipv6_extension_headers(struct ndpi_detection_module_struct *ndpi if(*nxt_hdr == 59) { return(1); } + // fragment extension header has fixed size of 8 bytes and the first byte is the next header type if(*nxt_hdr == 44) { if(*l4len < 8) { return(1); } + *nxt_hdr = (*l4ptr)[0]; *l4len -= 8; (*l4ptr) += 8; continue; } + // the other extension headers have one byte for the next header type // and one byte for the extension header length in 8 byte steps minus the first 8 bytes if(*l4len < 2) { return(1); } + ehdr_len = (*l4ptr)[1]; ehdr_len *= 8; ehdr_len += 8; @@ -3468,10 +3472,16 @@ int ndpi_handle_ipv6_extension_headers(struct ndpi_detection_module_struct *ndpi if(*l4len < ehdr_len) { return(1); } + *nxt_hdr = (*l4ptr)[0]; + + if(*l4len < ehdr_len) + return(1); + *l4len -= ehdr_len; (*l4ptr) += ehdr_len; } + return(0); } #endif /* NDPI_DETECTION_SUPPORT_IPV6 */ diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 634b02d59..edf7ebd07 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1211,6 +1211,13 @@ int ndpi_dpi2json(struct ndpi_detection_module_struct *ndpi_struct, ndpi_serialize_end_of_block(serializer); break; + case NDPI_PROTOCOL_QUIC: + ndpi_serialize_start_of_block(serializer, "quic"); + if(flow->host_server_name[0] != '\0') + ndpi_serialize_string_string(serializer, "hostname", (const char*)flow->host_server_name); + ndpi_serialize_end_of_block(serializer); + break; + case NDPI_PROTOCOL_MAIL_IMAP: ndpi_serialize_start_of_block(serializer, "imap"); ndpi_serialize_string_string(serializer, "user", flow->protos.ftp_imap_pop_smtp.username); |