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

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

From: <cares2011.mlist.ps2_at_xoxy.net>
Date: Sat, 18 Feb 2012 18:38:03 +0000

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).
Received on 2012-02-18