]> granicus.if.org Git - pdns/commitdiff
sdig: Implement IPv6 support
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 15 Jul 2015 12:20:03 +0000 (14:20 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 15 Jul 2015 19:58:46 +0000 (21:58 +0200)
pdns/sdig.cc

index ea27919862a32532a46fab99aa41b0c40b9eb034..f0ed8de4782c0d7c5a6a43b68d08418ab08827e7 100644 (file)
@@ -85,10 +85,10 @@ try
   // pw.commit();
   
   string reply;
+  ComboAddress dest(argv[1] + (*argv[1]=='@'), atoi(argv[2]));
 
   if(tcp) {
-    Socket sock(AF_INET, SOCK_STREAM);
-    ComboAddress dest(argv[1] + (*argv[1]=='@'), atoi(argv[2]));
+    Socket sock(dest.sin4.sin_family, SOCK_STREAM);
     sock.connect(dest);
     uint16_t len;
     len = htons(packet.size());
@@ -116,8 +116,7 @@ try
   }
   else //udp
   {
-    Socket sock(AF_INET, SOCK_DGRAM);
-    ComboAddress dest(argv[1] + (*argv[1]=='@'), atoi(argv[2]));
+    Socket sock(dest.sin4.sin_family, SOCK_DGRAM);
     sock.sendTo(string((char*)&*packet.begin(), (char*)&*packet.end()), dest);
     
     sock.recvFrom(reply, dest);