]> granicus.if.org Git - pdns/commitdiff
dnswasher: Only zero the IP header checksum for IPv4
authorRobert Edmonds <edmonds@fsi.io>
Sat, 16 Apr 2016 00:43:34 +0000 (20:43 -0400)
committerRobert Edmonds <edmonds@fsi.io>
Sat, 16 Apr 2016 00:43:34 +0000 (20:43 -0400)
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.

pdns/dnswasher.cc

index 7032394c4dc5aa54ee838eee0d17e5216fa4aba8..d9f0466fa79f8bca7a093002a14bd86134be940f 100644 (file)
@@ -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();
     }
   }