misc/151815: 'w' erroneously resolves truncated IPv6

Peter J. Philipp pjp at centroid.eu
Fri Oct 29 16:20:05 UTC 2010


>Number:         151815
>Category:       misc
>Synopsis:       'w' erroneously resolves truncated IPv6
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 29 16:20:04 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Peter J. Philipp
>Release:        8.1-RELEASE
>Organization:
>Environment:
atlas$ uname -a
FreeBSD atlas.centroid.eu 8.1-RELEASE FreeBSD 8.1-RELEASE #2: Sat Sep 11 14:24:00 CEST 2010     pjp at atlas.centroid.eu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
dione.centroid.eu has IPv6 2001:a60:f074::30  (openbsd)
atlas.centroid.eu has IPv6 2001:a60:f074::25  (freebsd)
caliban.centroid.eu has IPv6 2001:a60:f074::3 (off, but openbsd)

when I log in from dione to atlas I see the following in netstat:
atlas$ netstat -na|grep 22
tcp6       0     48 2001:a60:f074::2.22    2001:a60:f074::3.4980  ESTABLISHED

netstat truncates the last nibble of the IPv6 address which is fine I can live with that (well I can't but it's out of scope of this bug report).

When I do a 'who' I see:

atlas$ who
pjp              pts/0    Oct 29 17:20 (2001:a60:f074::3)

again the IPv6 is truncated and this time it's coming from utmp.

When I do a 'w' I see:

atlas$ w
 5:56PM  up  9:48, 1 user, load averages: 0.04, 0.01, 0.00
USER             TTY      FROM              LOGIN@  IDLE WHAT
pjp              pts/0    caliban           5:20PM     - w


which shows me being logged in from caliban, but the utmp entry is truncated and it resolves that and gives a misleading output.
>How-To-Repeat:
use any IPv6 that gets truncated and have reverse dns for the truncated string, which will give a wrong hostname.
>Fix:
increase the size of UT_HOSTSIZE to fit an entire INET6_ADDRSTRLEN in it.  OpenBSD has its at 256, FreeBSD's is at 16...there is room to grow and stay
within acceptable values.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list