From: Robert Edmonds Date: Sat, 16 Apr 2016 00:43:34 +0000 (-0400) Subject: dnswasher: Only zero the IP header checksum for IPv4 X-Git-Tag: dnsdist-1.0.0~9^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8b9d939a7bbef961e825a0088f350ff093f8a04;p=thirdparty%2Fpdns.git dnswasher: Only zero the IP header checksum for IPv4 IPv6 doesn't have a checksum field. This code previously zeroed the space in the header where the IPv4 header checksum would be, regardless of IP header version. --- diff --git a/pdns/dnswasher.cc b/pdns/dnswasher.cc index 7032394c4d..d9f0466fa7 100644 --- a/pdns/dnswasher.cc +++ b/pdns/dnswasher.cc @@ -82,6 +82,8 @@ try *dst=htonl(ipo.obf4(*dst)); else *src=htonl(ipo.obf4(*src)); + + pr.d_ip->ip_sum=0; } else if (pr.d_ip->ip_v == 6) { uint64_t *src=1+(uint64_t*)&pr.d_ip6->ip6_src; uint64_t *dst=1+(uint64_t*)&pr.d_ip6->ip6_dst; @@ -91,7 +93,6 @@ try else *src=ipo.obf6(*src); } - pr.d_ip->ip_sum=0; pw.write(); } }