]> granicus.if.org Git - pdns/commitdiff
dnswasher: Write obfuscated IPv6 prefixes in network byte order
authorRobert Edmonds <edmonds@fsi.io>
Sat, 16 Apr 2016 00:54:22 +0000 (20:54 -0400)
committerRobert Edmonds <edmonds@fsi.io>
Sat, 16 Apr 2016 00:54:22 +0000 (20:54 -0400)
Make the IPv6 code path follow the IPv4 code path by writing out the
IPObfuscator counter in network byte order.

This makes the obfuscated IPv6 addresses easier to read and avoids
making the output of the tool vary based on the host byte order.

pdns/dnswasher.cc

index 2ebff8e2bb4c994091cf334400ef34b3403aba52..d627e12681a502deef70b8ff256326dd003eac88 100644 (file)
@@ -17,6 +17,7 @@ otherwise, obfuscate the response IP address
 #endif
 #include "statbag.hh"
 #include "dnspcap.hh"
+#include "iputils.hh"
 
 #include "namespaces.hh"
 #include "namespaces.hh"
@@ -89,9 +90,9 @@ try
         uint64_t *dst=(uint64_t*)&pr.d_ip6->ip6_dst;
 
         if(dh->qr)
-          *dst=ipo.obf6(*dst);
+          *dst=htobe64(ipo.obf6(*dst));
         else
-          *src=ipo.obf6(*src);
+          *src=htobe64(ipo.obf6(*src));
       }
       pw.write();
     }