From: bert hubert Date: Thu, 11 Jul 2013 15:03:34 +0000 (+0200) Subject: teach our pcap reader IPv6. Already. X-Git-Tag: rec-3.6.0-rc1~577 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf32bff828ca078d17ed44e442abf0695f4aec01;p=thirdparty%2Fpdns.git teach our pcap reader IPv6. Already. --- diff --git a/pdns/dnspcap.cc b/pdns/dnspcap.cc index f4ed879bd3..dde33327a4 100644 --- a/pdns/dnspcap.cc +++ b/pdns/dnspcap.cc @@ -71,7 +71,7 @@ try d_lcc=reinterpret_cast(d_buffer); d_ip=reinterpret_cast(d_buffer + d_skipMediaHeader); - + d_ip6=reinterpret_cast(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(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++; } diff --git a/pdns/dnspcap.hh b/pdns/dnspcap.hh index 1e6a1143cf..b181327619 100644 --- a/pdns/dnspcap.hh +++ b/pdns/dnspcap.hh @@ -9,6 +9,7 @@ #define __FAVOR_BSD #include #include +#include #include #if defined(__NetBSD__) #include @@ -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;