cares2011.mlist.ps2 | 18 Feb 19:38

adig: the -U and -T options don't work as expected

C-ares version: c-ares-1.7.5, c-ares-1.7.6-(daily-snapshot)
Test system: debian GNU/Linux (lenny x86)
Build options: ./configure --disable-shared && make check

Problem1:
=========    the -U option argument is used in inverse byte order
How to reproduce:
$ strace -f ./adig -U 14666 -s 192.168.1.113 www.cnn.com 2>&1 | grep connect
connect(3, {sa_family=AF_INET, sin_port=htons(19001), sin_addr=inet_addr("192.168.1.113")},
16) = 0
connect(3, {sa_family=AF_INET, sin_port=htons(19001), sin_addr=inet_addr("192.168.1.113")},
16) = 0
connect(3, {sa_family=AF_INET, sin_port=htons(19001), sin_addr=inet_addr("192.168.1.113")},
16) = 0
connect(3, {sa_family=AF_INET, sin_port=htons(19001), sin_addr=inet_addr("192.168.1.113")},
16) = 0

adig attempts to connect to port 19001 (0x4A39) instead of port 14666 (0x394A).

Problem2:
=========    the -T option does not force using TCP for queries
How to reproduce:
$ strace -f ./adig -T 14666 -s 192.168.1.113 www.cnn.com 2>&1|grep connect
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.1.113")}, 16) = 0

adig attempts a UDP query instead of a TCP query (and the specified port is
ignored).

Daniel Stenberg | 25 Feb 22:50
Picon
Favicon
Gravatar

Re: adig: the -U and -T options don't work as expected

On Sat, 18 Feb 2012, cares2011.mlist.ps2@... wrote:

> -U option argument is used in inverse byte order

Indeed. See attached file for my suggested patch. Does it fix the problem for 
you?

> Problem2:
> =========    the -T option does not force using TCP for queries

But should it really? I don't see that in the adig man page.

You can tell it to do so with "-f usevc".

--

-- 

  / daniel.haxx.se

Gmane