]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
teach our pcap reader IPv6. Already.
authorbert hubert <bert.hubert@netherlabs.nl>
Thu, 11 Jul 2013 15:03:34 +0000 (17:03 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Thu, 11 Jul 2013 15:03:34 +0000 (17:03 +0200)
pdns/dnspcap.cc
pdns/dnspcap.hh

index f4ed879bd3c9fce3a43bf6db74cea8167519a456..dde33327a418dabafb5e3bbb6fff13e56d55d8e2 100644 (file)
@@ -71,7 +71,7 @@ try
     d_lcc=reinterpret_cast<struct pdns_lcc_header*>(d_buffer);
 
     d_ip=reinterpret_cast<struct ip*>(d_buffer + d_skipMediaHeader);
-
+    d_ip6=reinterpret_cast<struct ip6_hdr*>(d_buffer + d_skipMediaHeader);
     uint16_t contentCode=0;
     if(d_pfh.linktype==1) 
       contentCode=ntohs(d_ether->ether_type);
@@ -85,6 +85,14 @@ try
       d_correctpackets++;
       return true;
     }
+    if(contentCode==0x86dd && d_ip6->ip6_ctlun.ip6_un1.ip6_un1_nxt==17) { // udpv6, we ignore anything with extension hdr
+      d_udp=reinterpret_cast<const struct udphdr*>(d_buffer + d_skipMediaHeader + sizeof(struct ip6_hdr));
+      d_payload = (unsigned char*)d_udp + sizeof(struct udphdr);
+      d_len = ntohs(d_udp->uh_ulen) - sizeof(struct udphdr);
+      d_correctpackets++;
+      return true;
+    }
+
     else {
       d_nonetheripudp++;
     }
index 1e6a1143cf14c86e856938708c8c298c0f3f4f53..b1813276196430bf441ff2762f0f35b81bef57c4 100644 (file)
@@ -9,6 +9,7 @@
 #define __FAVOR_BSD
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
+#include <netinet/ip6.h>
 #include <netinet/udp.h>
 #if defined(__NetBSD__)
 #include <net/if.h>
@@ -84,6 +85,7 @@ public:
   struct pdns_lcc_header* d_lcc;
   struct ether_header* d_ether;
   struct ip *d_ip;
+  struct ip6_hdr *d_ip6;
   const struct tcphdr *d_tcp;
   const struct udphdr *d_udp;
   const uint8_t* d_payload;