Use ndpi_handle_ipv6_extension_headers in reader_util
This commit is contained in:
@@ -1691,12 +1691,11 @@ ether_type_check:
|
|||||||
return(nproto); /* Too short for IPv6 header*/
|
return(nproto); /* Too short for IPv6 header*/
|
||||||
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
||||||
proto = iph6->ip6_hdr.ip6_un1_nxt;
|
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 */) {
|
const u_int8_t *l4ptr = (((const u_int8_t *) iph6) + sizeof(struct ndpi_ipv6hdr));
|
||||||
u_int8_t *options = (u_int8_t*)&packet[ip_offset+ip_len];
|
if(ndpi_handle_ipv6_extension_headers(NULL, &l4ptr, &ip_len, &proto) != 0) {
|
||||||
proto = options[0];
|
return(nproto);
|
||||||
ip_len += 8 * (options[1] + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iph = NULL;
|
iph = NULL;
|
||||||
|
|||||||
@@ -150,6 +150,10 @@ extern "C" {
|
|||||||
#define ndpi_match_strprefix(payload, payload_len, str) \
|
#define ndpi_match_strprefix(payload, payload_len, str) \
|
||||||
ndpi_match_prefix((payload), (payload_len), (str), (sizeof(str)-1))
|
ndpi_match_prefix((payload), (payload_len), (str), (sizeof(str)-1))
|
||||||
|
|
||||||
|
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||||
|
int ndpi_handle_ipv6_extension_headers(struct ndpi_detection_module_struct *ndpi_str, const u_int8_t ** l4ptr, u_int16_t * l4len, u_int8_t * nxt_hdr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -3645,7 +3645,7 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n
|
|||||||
* nxt_hdr: protocol of the actual payload
|
* nxt_hdr: protocol of the actual payload
|
||||||
* returns 0 upon success and 1 upon failure
|
* returns 0 upon success and 1 upon failure
|
||||||
*/
|
*/
|
||||||
static int ndpi_handle_ipv6_extension_headers(struct ndpi_detection_module_struct *ndpi_str, const u_int8_t ** l4ptr, u_int16_t * l4len, u_int8_t * nxt_hdr)
|
int ndpi_handle_ipv6_extension_headers(struct ndpi_detection_module_struct *ndpi_str, const u_int8_t ** l4ptr, u_int16_t * l4len, u_int8_t * nxt_hdr)
|
||||||
{
|
{
|
||||||
while((*nxt_hdr == 0 || *nxt_hdr == 43 || *nxt_hdr == 44 || *nxt_hdr == 60 || *nxt_hdr == 135 || *nxt_hdr == 59)) {
|
while((*nxt_hdr == 0 || *nxt_hdr == 43 || *nxt_hdr == 44 || *nxt_hdr == 60 || *nxt_hdr == 135 || *nxt_hdr == 59)) {
|
||||||
u_int16_t ehdr_len;
|
u_int16_t ehdr_len;
|
||||||
|
|||||||
Reference in New Issue
Block a user