From 4a549837daac76ca555226679358057204094e36 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Wed, 15 Jul 2015 14:20:03 +0200 Subject: [PATCH] sdig: Implement IPv6 support --- pdns/sdig.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pdns/sdig.cc b/pdns/sdig.cc index ea2791986..f0ed8de47 100644 --- a/pdns/sdig.cc +++ b/pdns/sdig.cc @@ -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); -- 2.40.0