Subject: bin/28954: ntpq does not fall back to IPv4
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Kimmo Suominen <kim@tac.nyc.ny.us>
List: netbsd-bugs
Date: 01/13/2005 16:39:07
>Number:         28954
>Category:       bin
>Synopsis:       ntpq does not fall back to IPv4
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 13 16:39:06 +0000 2005
>Originator:     Kimmo Suominen
>Release:        NetBSD 2.99.11 2004-12-15
>Organization:
Kimmo Suominen
>Environment:
System: NetBSD beowulf.gw.com 2.99.11 NetBSD 2.99.11 (GW-GENERIC) #85: Sat Jan 1 11:30:14 EST 2005 kim@hrothgar.gw.com:/usr/src/sys/arch/i386/compile/GW-GENERIC i386
Architecture: i386
Machine: i386
>Description:
When connecting to a host with both IPv6 and IPv4 addresses, ntpq
will not try IPv4 if the IPv6 connection fails.
>How-To-Repeat:
I'm running xnptd v3 on some machines.  It only listens on IPv4.

Connections to localhost fail with "Connection refused".

    beowulf:~> ntpq -p
    ntpq: read: Connection refused
    beowulf:~> ntpq -p 127.0.0.1
	 remote           refid  [... truncated ...]
    beowulf:~> grep localhost /etc/hosts
    ::1                                     localhost
    127.0.0.1                               localhost

Connections to grendel.gw.com fail with "No route to host" (as
beowulf does not have a global IPv6 address or IPv6 routes).

    beowulf:~> ntpq -p grendel.gw.com
    ntpq: connect: No route to host
    Exit 1
    beowulf:~> host grendel.gw.com
    grendel.gw.com has address 204.80.150.1
    grendel.gw.com has IPv6 address 2001:240:584:1::1
    grendel.gw.com mail is handled by 0 grendel.gw.com.
    grendel.gw.com mail is handled by 50 relay.gw.com.
    beowulf:~> ntpq -p 204.80.150.1
	 remote           refid  [... truncated ...]

Normally applications should try IPv4 if IPv6 fails:

    beowulf:~> telnet grendel.gw.com
    Trying 2001:240:584:1::1...
    telnet: connect to address 2001:240:584:1::1: No route to host
    Trying 204.80.150.1...
    Connected to grendel.gw.com.
>Fix: