Bug 151815

Summary: 'w' erroneously resolves truncated IPv6
Product: Base System Reporter: Peter J. Philipp <pjp>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 8.1-RELEASE   
Hardware: Any   
OS: Any   

Description Peter J. Philipp 2010-10-29 17:20:04 UTC
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.

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.
How-To-Repeat: use any IPv6 that gets truncated and have reverse dns for the truncated string, which will give a wrong hostname.
Comment 1 Peter J. Philipp 2010-10-29 18:08:35 UTC
This is for misc/151815, 

Ooops sorry.  I just realized it was fixed in HEAD by changing to the utmpx 
system.  You can disregard my bug and close the PR. 

-peter
Comment 2 Jaakko Heinonen freebsd_committer freebsd_triage 2010-11-04 16:28:39 UTC
State Changed
From-To: open->closed

Closed at submitter's request.