aboutsummaryrefslogtreecommitdiff
path: root/example/ndpiReader.c
diff options
context:
space:
mode:
authorCampus <campus@ntop.org>2015-10-23 17:14:03 +0200
committerCampus <campus@ntop.org>2015-10-23 17:14:03 +0200
commit59d0af33b89acd55f0ffb69aaabc2c2160c436bf (patch)
tree351c6f895f220740b2f4ee7ae49e4cc846549058 /example/ndpiReader.c
parent25631a25f7f2642364e0376ca4e082a05c895dd2 (diff)
added support for 6in4 tunneling in ndpiReader.c
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r--example/ndpiReader.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 46eddaa45..d8c67278c 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -1586,7 +1586,7 @@ static void pcap_packet_callback(u_char *args,
u_int32_t fcs;
u_int64_t time;
- u_int16_t type, ip_offset, ip_len;
+ u_int16_t type, ip_offset, ip_len, ip6_offset;
u_int16_t frag_off = 0, vlan_id = 0;
u_int8_t proto = 0;
u_int32_t label;
@@ -1766,11 +1766,25 @@ static void pcap_packet_callback(u_char *args,
}
}
+ /* Check for tunnel 6in4 */
+ if(iph->version == 4 && iph->protocol == 41) {
+
+ ip_len = ((u_short)iph->ihl * 4);
+ ip6_offset = ip_len + ip_offset;
+ iph6 = (struct ndpi_ip6_hdr *)&packet[ip6_offset];
+ proto = iph6->ip6_ctlun.ip6_un1.ip6_un1_nxt;
+ ip_len = sizeof(struct ndpi_ip6_hdr);
+ ip_offset = ip_len + ip6_offset;
+ iph = NULL;
+ }
/* Check IP version */
- if(iph->version == 4) {
+ else if(iph->version == 4) {
ip_len = ((u_short)iph->ihl * 4);
iph6 = NULL;
+ /* if(iph->protocol == 41) */
+ /* goto ipv6in4; */
+
if((frag_off & 0x3FFF) != 0) {
static u_int8_t ipv4_frags_warning_used = 0;
@@ -1796,6 +1810,16 @@ static void pcap_packet_callback(u_char *args,
ip_len += 8 * (options[1] + 1);
}
iph = NULL;
+
+ /* tunnel 6in4 */
+ /* ipv6in4: */
+ /* ip6_offset = ip_len + ip_offset; */
+ /* iph6 = (struct ndpi_ip6_hdr *)&packet[ip6_offset]; */
+ /* proto = iph6->ip6_ctlun.ip6_un1.ip6_un1_nxt; */
+ /* ip_len = sizeof(struct ndpi_ip6_hdr); */
+ /* ip_offset = ip_len + ip6_offset; */
+ /* iph = NULL; */
+
} else {
static u_int8_t ipv4_warning_used = 0;