On Mon, Feb 22, 2010 at 06:16:02PM +0200, Aivar Jaakson wrote:
> >Number:         6322
> >Category:       system
> >Synopsis:       dig(1) uses always default DNS port 53
> >Confidential:   yes
> >Severity:       serious
> >Priority:       medium
> >Responsible:    bugs
> >State:          open
> >Quarter:        
> >Keywords:       
> >Date-Required:
> >Class:          sw-bug
> >Submitter-Id:   unknown
> >Arrival-Date:   Mon Feb 22 16:30:01 GMT 2010
> >Closed-Date:
> >Last-Modified:
> >Originator:     
> >Release:        
> >Organization:
> >Environment:
>       System      : OpenBSD 4.7
>       Details     : OpenBSD 4.7-beta (GENERIC) #527: Tue Feb 16 00:07:23 MST 
> 2010
>                        
> [email protected]:/usr/src/sys/arch/i386/compile/GENERIC
> 
>       Architecture: OpenBSD.i386
>       Machine     : i386
> >Description:
>       dig ignore -p port# option and send request to port 53
> 
> >How-To-Repeat:
>       $ dig @192.168.23.21 -p 5300 foo
> 
> ; <<>> DiG 9.4.2-P2 <<>> @192.168.23.21 -p 5300 foo
> ; (1 server found)
> ;; global options:  printcmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 52887
> ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
> 
> ;; QUESTION SECTION:
> ;foo.                         IN      A
> 
> ;; AUTHORITY SECTION:
> .                     84924   IN      SOA     A.ROOT-SERVERS.NET. 
> NSTLD.VERISIGN-GRS.COM. 2010022200 1800 900 604800 86400
> 
> ;; Query time: 0 msec
> ;; SERVER: 192.168.23.21#53(192.168.23.21)
> ;; WHEN: Mon Feb 22 16:24:37 2010
> ;; MSG SIZE  rcvd: 96

I think this is unrelated to the resolv.conf issue below.

> When you add port to nameserver option in /etc/resolv.conf like
> 'nameserver 192.168.23.21:5300', then dig(1) and host(1) gets timeout.
> Also when port is :53

The syntax is
  nameserver [192.168.23.21]:5300

The resolv.conf(5) man page says, "A non-standard port may be specified
using [host]:port syntax.". The square brackets are required. It's normal
to use them when specifying a port for an IPv6 address.

It is potentially confusing though, given that square brackets usually
indicate something optional, see the relayd.conf(5) and ftp(1) man pages
for example.  I've included a documentation patch below that tries to
clarify it.

Would there be any interest in a patch that modifies the resolv.conf
parsing code to accept IPv4:port style address specification without
the square brackets?

Regards
Nathan

Index: share/man/man5/resolv.conf.5
===================================================================
RCS file: /cvs/src/share/man/man5/resolv.conf.5,v
retrieving revision 1.33
diff -u share/man/man5/resolv.conf.5
--- share/man/man5/resolv.conf.5        20 Nov 2009 14:43:43 -0000      1.33
+++ share/man/man5/resolv.conf.5        9 Apr 2010 09:42:09 -0000
@@ -112,6 +112,12 @@
 A non-standard port may be specified using
 .Ar [host]:port
 syntax.
+When a non-standard port is specified the host 
+address must be enclosed in square brackets, e.g.:
+.Bd -literal -offset indent
+nameserver [130.155.160.1]:5353
+nameserver [2001:db8::a00:20ff:fea7:ccea]:5353
+.Ed
 .Pp
 Up to
 .Dv MAXNS

Reply via email to