From nobody@FreeBSD.org  Fri Oct 29 16:11:32 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E570106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 29 Oct 2010 16:11:32 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 5C9318FC19
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 29 Oct 2010 16:11:32 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TGBVrC005087
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 29 Oct 2010 16:11:31 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o9TGBVKf005086;
	Fri, 29 Oct 2010 16:11:31 GMT
	(envelope-from nobody)
Message-Id: <201010291611.o9TGBVKf005086@www.freebsd.org>
Date: Fri, 29 Oct 2010 16:11:31 GMT
From: "Peter J. Philipp" <pjp@centroid.eu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: 'w' erroneously resolves truncated IPv6
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         151815
>Category:       misc
>Synopsis:       'w' erroneously resolves truncated IPv6
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 29 16:20:04 UTC 2010
>Closed-Date:    Thu Nov 04 16:28:40 UTC 2010
>Last-Modified:  Thu Nov 04 16:28:40 UTC 2010
>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@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:

From: "Peter J. Philipp" <pjp@centroid.eu>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/151815: 'w' erroneously resolves truncated IPv6
Date: Fri, 29 Oct 2010 19:08:35 +0200

 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
State-Changed-From-To: open->closed 
State-Changed-By: jh 
State-Changed-When: Thu Nov 4 16:28:39 UTC 2010 
State-Changed-Why:  
Closed at submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=151815 
>Unformatted:
