Add basic support for some ip-in-ip tunnels
Add support for 4in4, 6in6 and 4in6 encapsulations Add support for ipv6 traffic in gtp tunnels, too To allow gtp unit test, gtp detunneling flag has been globally enabled in the test suite
This commit is contained in:
+16
-6
@@ -1675,7 +1675,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
||||
ip_len = ((u_int16_t)iph->ihl * 4);
|
||||
iph6 = NULL;
|
||||
|
||||
if(iph->protocol == IPPROTO_IPV6) {
|
||||
if(iph->protocol == IPPROTO_IPV6 || iph->protocol == IPPROTO_IPIP) {
|
||||
ip_offset += ip_len;
|
||||
if(ip_len > 0)
|
||||
goto iph_check;
|
||||
@@ -1707,6 +1707,12 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
||||
if(ndpi_handle_ipv6_extension_headers(NULL, &l4ptr, &ip_len, &proto) != 0) {
|
||||
return(nproto);
|
||||
}
|
||||
if(proto == IPPROTO_IPV6 || proto == IPPROTO_IPIP) {
|
||||
if(l4ptr > packet) { /* Better safe than sorry */
|
||||
ip_offset = (l4ptr - packet);
|
||||
goto iph_check;
|
||||
}
|
||||
}
|
||||
|
||||
iph = NULL;
|
||||
} else {
|
||||
@@ -1746,11 +1752,15 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
||||
if(flags & 0x02) ip_offset += 4; /* sequence_number is present (it also includes next_ext_header and pdu_number) */
|
||||
if(flags & 0x01) ip_offset += 1; /* pdu_number is present */
|
||||
|
||||
iph = (struct ndpi_iphdr *) &packet[ip_offset];
|
||||
|
||||
if(iph->version != IPVERSION) {
|
||||
// printf("WARNING: not good (packet_id=%u)!\n", (unsigned int)workflow->stats.raw_packet_count);
|
||||
goto v4_warning;
|
||||
if(ip_offset < header->caplen) {
|
||||
iph = (struct ndpi_iphdr *)&packet[ip_offset];
|
||||
if(iph->version == 6) {
|
||||
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
||||
iph = NULL;
|
||||
} else if(iph->version != IPVERSION) {
|
||||
// printf("WARNING: not good (packet_id=%u)!\n", (unsigned int)workflow->stats.raw_packet_count);
|
||||
goto v4_warning;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if((sport == TZSP_PORT) || (dport == TZSP_PORT)) {
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ build_results() {
|
||||
#echo $f
|
||||
# create result files if not present
|
||||
if [ ! -f result/$f.out ]; then
|
||||
CMD="$READER -q -i pcap/$f -w result/$f.out -v 2"
|
||||
CMD="$READER -q -t -i pcap/$f -w result/$f.out -v 2"
|
||||
$CMD
|
||||
fi
|
||||
# test fuzz target built with sanitizer on input from corpus
|
||||
@@ -23,7 +23,7 @@ build_results() {
|
||||
check_results() {
|
||||
for f in $PCAPS; do
|
||||
if [ -f result/$f.out ]; then
|
||||
CMD="$READER -q -i pcap/$f -w /tmp/reader.out -v 2"
|
||||
CMD="$READER -q -t -i pcap/$f -w /tmp/reader.out -v 2"
|
||||
$CMD
|
||||
NUM_DIFF=`diff result/$f.out /tmp/reader.out | wc -l`
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
Unknown 5 850 1
|
||||
|
||||
|
||||
|
||||
Undetected flows:
|
||||
1 UDP 10.10.100.25:62367 -> 10.10.101.2:17000 [VLAN: 505][proto: 0/Unknown][5 pkts/850 bytes -> 0 pkts/0 bytes][Goodput ratio: 59/0][121572.07 sec]
|
||||
@@ -0,0 +1,8 @@
|
||||
Microsoft 4 2188 1
|
||||
|
||||
JA3 Host Stats:
|
||||
IP Address # JA3C
|
||||
1 192.168.0.1 1
|
||||
|
||||
|
||||
1 TCP 192.168.0.1:64455 <-> 10.10.10.1:443 [proto: 91.212/TLS.Microsoft][cat: Web/5][2 pkts/520 bytes <-> 2 pkts/1668 bytes][Goodput ratio: 43/82][< 1 sec][ALPN: h2;http/1.1][TLSv1.2][Client: www.bing.com][JA3C: 9e10692f1b7f78228b2d4e424db3a98c]
|
||||
@@ -0,0 +1,6 @@
|
||||
Unknown 2 212 1
|
||||
|
||||
|
||||
|
||||
Undetected flows:
|
||||
1 UDP [dead::beef]:30000 -> [cafe::babe]:13000 [proto: 0/Unknown][2 pkts/212 bytes -> 0 pkts/0 bytes][Goodput ratio: 4/0][0.00 sec]
|
||||
@@ -1,8 +1,8 @@
|
||||
DNS 2 166 1
|
||||
CAPWAP 395 98343 4
|
||||
CAPWAP 393 98074 4
|
||||
|
||||
1 UDP 192.168.10.9:5246 <-> 192.168.10.10:12380 [proto: 247/CAPWAP][cat: Network/14][106 pkts/26144 bytes <-> 111 pkts/37530 bytes][Goodput ratio: 83/88][169.10 sec][bytes ratio: -0.179 (Mixed)][IAT c2s/s2c min/avg/max/stddev: 0/0 1421/1619 21349/21721 3881/4475][Pkt Len c2s/s2c min/avg/max/stddev: 106/115 247/338 1499/1499 292/381][PLAIN TEXT (Cisco Systems)]
|
||||
2 UDP 192.168.10.10:12380 <-> 192.168.10.9:5247 [proto: 247/CAPWAP][cat: Network/14][170 pkts/33465 bytes <-> 3 pkts/437 bytes][Goodput ratio: 79/71][157.99 sec][bytes ratio: 0.974 (Upload)][IAT c2s/s2c min/avg/max/stddev: 0/0 964/0 3999/0 858/0][Pkt Len c2s/s2c min/avg/max/stddev: 93/125 197/146 470/168 78/18]
|
||||
2 UDP 192.168.10.10:12380 <-> 192.168.10.9:5247 [proto: 247/CAPWAP][cat: Network/14][170 pkts/33465 bytes <-> 1 pkts/168 bytes][Goodput ratio: 79/75][157.99 sec][bytes ratio: 0.990 (Upload)][IAT c2s/s2c min/avg/max/stddev: 0/0 961/0 3999/0 859/0][Pkt Len c2s/s2c min/avg/max/stddev: 93/168 197/168 470/168 78/0]
|
||||
3 UDP 192.168.10.10:12380 -> 255.255.255.255:5246 [proto: 247/CAPWAP][cat: Network/14][4 pkts/660 bytes -> 0 pkts/0 bytes][Goodput ratio: 74/0][130.41 sec][PLAIN TEXT (838.61f)]
|
||||
4 UDP 192.168.10.10:49259 -> 255.255.255.255:53 [proto: 5/DNS][cat: Network/14][2 pkts/166 bytes -> 0 pkts/0 bytes][Goodput ratio: 49/0][3.00 sec][Host: cisco-capwap-controller][::][PLAIN TEXT (CAPWAP)]
|
||||
5 UDP 192.168.10.9:5246 -> 192.168.10.10:12379 [proto: 247/CAPWAP][cat: Network/14][1 pkts/107 bytes -> 0 pkts/0 bytes][Goodput ratio: 60/0][< 1 sec]
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Unknown 1 150 1
|
||||
IPsec 1 166 1
|
||||
|
||||
1 50 [2a01:4c8:c014:144e:1:2:945b:6761]:0 -> [2a01:4c8:f000:f49::4]:0 [VLAN: 2][proto: GTP:79/IPsec][cat: VPN/2][1 pkts/166 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec]
|
||||
|
||||
|
||||
Undetected flows:
|
||||
1 UDP [2607:fc20:4052:39e:490a:ea4d:17fe:e09c]:49120 -> [fd00:976a:bc67:193e::7]:25658 [VLAN: 5][proto: GTP:0/Unknown][1 pkts/150 bytes -> 0 pkts/0 bytes][Goodput ratio: 29/0][< 1 sec]
|
||||
Reference in New Issue
Block a user