"host -U" documented in manpage, but disabled in code
Summary
The host
command has an option to force UDP usage called -U
. It is documented in the host(1) manpage:
-T, -U
TCP/UDP: By default, host uses UDP when making queries. The -T option makes it use a TCP
connection when querying the name server. TCP will be automatically selected for queries that
require it, such as zone transfer (AXFR) requests. Type ANY queries default to TCP but can be
forced to UDP initially using -U.
It's not available in the actual host(1) command, though:
$ host -U isc.org
Usage: host [-aCdilrTvVw] [-c class] [-N ndots] [-t type] [-W time]
[-R number] [-m flag] hostname [server]
-a is equivalent to -v -t ANY
-c specifies query class for non-IN data
-C compares SOA records on authoritative nameservers
-d is equivalent to -v
-i IP6.INT reverse lookups
-l lists all hosts in a domain, using AXFR
-m set memory debugging flag (trace|record|usage)
-N changes the number of dots allowed before root lookup is done
-r disables recursive processing
-R specifies number of retries for UDP packets
-s a SERVFAIL response should stop query
-t specifies the query type
-T enables TCP/IP mode
-v enables verbose output
-V print version number and exit
-w specifies to wait forever for a reply
-W specifies how long to wait for a reply
-4 use IPv4 query transport only
-6 use IPv6 query transport only
BIND version used
Tried with 9.11.5, and code inspection shows that current master has the same issue.
Steps to reproduce
- Verify that the
host(1)
manpage mentions-U
as a valid command line option. - Try to resolve a hostname using -U:
host -U isc.org
What is the current bug behavior?
Instead of host using UDP to resolve the name, it shows the usage output, hinting that an invalid option was used.
What is the expected correct behavior?
It should use UDP to resolve the name, even if UDP is already the default, and not fail.
Possible fixes
For 9.11.5:
diff --git a/bin/dig/host.c b/bin/dig/host.c
index d342b1e14..20f92cbf5 100644
--- a/bin/dig/host.c
+++ b/bin/dig/host.c
@@ -158,6 +158,7 @@ show_usage(void) {
" -s a SERVFAIL response should stop query\n"
" -t specifies the query type\n"
" -T enables TCP/IP mode\n"
+" -U enables UDP mode\n"
" -v enables verbose output\n"
" -V print version number and exit\n"
" -w specifies to wait forever for a reply\n"
@@ -657,6 +658,7 @@ pre_parse_args(int argc, char **argv) {
case 'N': break;
case 'R': break;
case 'T': break;
+ case 'U': break;
case 'W': break;
default:
show_usage();
Or, if this option is deemed unnecessary or broken, then it should be removed from the manpage.