The nslookup command does not obey the port option when record type ANY is used.
Summary
The nslookup command does not obey the port option when record type ANY is used. With record type A the port option is used but with ANY it is not.
BIND version used
Ubuntu 20.04 with bind 9.16.1+patches and Ubuntu 22.04 with bind 9.18.1+patches
Steps to reproduce
Configure a name server with udp/tcp port 54. run nslookup -port 54 or nslookup interactive and use 'set port=54'
query type A record for sex.com.
query type ANY record for sex.com.
What is the current bug behavior?
On Ubuntu 20.04 with bind 9.16.1+patches and Ubuntu 22.04 with bind 9.18.1+patches the bug has different behaviour. 9.16.1 nslookup simply always use port 53 no matter if the -port option of 'set port=' is used.
Note that the used nameserver with port 54 is bind 9.16.1 with a plugin that sends rcode REFUSED for sex.com. This should not matter since the bug is in the nslookup client.
nslookup -timeout=2 -retry=0 -port=54 sex.com 127.0.0.1
Server: 127.0.0.1
Address: 127.0.0.1#**54**
** server can't find sex.com: REFUSED
root@srv024:/local/src/ufdbguard-bind-1.0.0# nslookup -timeout=2 -retry=0 -port=54 -type=**A** sex.com 127.0.0.1
Server: 127.0.0.1
Address: 127.0.0.1#**54**
** server can't find sex.com: REFUSED
root@srv024:/local/src/ufdbguard-bind-1.0.0# nslookup -timeout=2 -retry=0 -port=54 -type=**ANY** sex.com 127.0.0.1
Server: 127.0.0.1
Address: 127.0.0.1#**53**
Non-authoritative answer:
sex.com hinfo = "RFC8482" ""
sex.com nameserver = ligia.ns.cloudflare.com.
sex.com nameserver = aaron.ns.cloudflare.com.
9.18.1 nslookup displays a mix of ports (53 and 54). Apparently uses the alternate port and nslookup dumps core when the nameserver replies with rcode REFUSED.
# nslookup
> server 10.1.1.24
Default server: 10.1.1.24
Address: 10.1.1.24#53
> set port=54
> sex.com
Server: 10.1.1.24
Address: 10.1.1.24#**54**
** server can't find sex.com: REFUSED
> set type=ANY
> sex.com
;; Connection to 10.1.1.24#**53**(10.1.1.24) for sex.com failed: connection refused.
;; Connection to 10.1.1.24#**53**(10.1.1.24) for sex.com failed: connection refused.
;; Connection to 10.1.1.24#**53**(10.1.1.24) for sex.com failed: connection refused.
task.c:811: INSIST((task->events).head != (event)) failed, back trace
/lib/x86_64-linux-gnu/libisc-9.18.1-1ubuntu1.2-Ubuntu.so(+0x32073)[0x7f5b335a6073]
/lib/x86_64-linux-gnu/libisc-9.18.1-1ubuntu1.2-Ubuntu.so(isc_assertion_failed+0x10)[0x7f5b335a5560]
/lib/x86_64-linux-gnu/libisc-9.18.1-1ubuntu1.2-Ubuntu.so(isc_task_run+0x422)[0x7f5b335cdcd2]
/lib/x86_64-linux-gnu/libisc-9.18.1-1ubuntu1.2-Ubuntu.so(+0x2572d)[0x7f5b3359972d]
/lib/x86_64-linux-gnu/libisc-9.18.1-1ubuntu1.2-Ubuntu.so(+0x25e05)[0x7f5b33599e05]
/lib/x86_64-linux-gnu/libisc-9.18.1-1ubuntu1.2-Ubuntu.so(+0x265b7)[0x7f5b3359a5b7]
/lib/x86_64-linux-gnu/libuv.so.1(+0x91ed)[0x7f5b330681ed]
/lib/x86_64-linux-gnu/libuv.so.1(+0x2511e)[0x7f5b3308411e]
/lib/x86_64-linux-gnu/libuv.so.1(uv_run+0x678)[0x7f5b3306dc88]
/lib/x86_64-linux-gnu/libisc-9.18.1-1ubuntu1.2-Ubuntu.so(+0x25e9e)[0x7f5b33599e9e]
/lib/x86_64-linux-gnu/libisc-9.18.1-1ubuntu1.2-Ubuntu.so(isc__trampoline_run+0x1a)[0x7f5b335c986a]
/lib/x86_64-linux-gnu/libc.so.6(+0x94b43)[0x7f5b33125b43]
/lib/x86_64-linux-gnu/libc.so.6(+0x126a00)[0x7f5b331b7a00]
Aborted (core dumped)
What is the expected correct behavior?
obey -port flag and 'set port=xx' with all record types, including ANY.
Relevant configuration files
none
Relevant logs and/or screenshots
none
Possible fixes
none