From nobody@FreeBSD.org  Mon Jul  8 20:49:28 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 547F237B400
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  8 Jul 2002 20:49:28 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E0EBB43E31
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  8 Jul 2002 20:49:10 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g693lxOT046121
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 8 Jul 2002 20:47:59 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g693lxkm046120;
	Mon, 8 Jul 2002 20:47:59 -0700 (PDT)
Message-Id: <200207090347.g693lxkm046120@www.freebsd.org>
Date: Mon, 8 Jul 2002 20:47:59 -0700 (PDT)
From: NAKAMURA Takayuki <tak@st.rim.or.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sockstat -4 does not show some listening IPv4 sockets 
X-Send-Pr-Version: www-1.0

>Number:         40365
>Category:       bin
>Synopsis:       sockstat -4 does not show some listening IPv4 sockets
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ume
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 08 20:50:01 PDT 2002
>Closed-Date:    Wed Jul 10 10:07:29 PDT 2002
>Last-Modified:  Wed Jul 10 10:07:29 PDT 2002
>Originator:     NAKAMURA Takayuki
>Release:        4.6-stable
>Organization:
>Environment:
FreeBSD reverse 4.6-STABLE-20020628-JPSNAP FreeBSD 4.6-STABLE-20020628-JPSNAP #0
: Sun Jun 30 14:48:56 JST 2002     root@air:/usr/src/sys/compile/TAKA  i386
>Description:
When ipv6_ipv4mapping="YES" in rc.conf (i.e. default setting), some IPv4 listening sockets are created as TCP46.
So such sockets are not shown by sockstat -4.
This may not be a bug, but causes users' inconvenience and confusion.
sockstat(1) should be modified, or the default value of the variable should be "NO".
>How-To-Repeat:
on FreeBSD 4.6.*-RELEASE box:
pkg_add apache2-*.tgz, and invoke apache2.
# sockstat -4 | grep 80
(nothing is shown here.)
# sockstat | grep 80

>Fix:

>Release-Note:
>Audit-Trail:

From: tak@st.rim.or.jp (NAKAMURA Takayuki)
To: freebsd-gnats-submit@FreeBSD.org
Cc: tak@st.rim.or.jp
Subject: Re: bin/40365: sockstat -4 does not show some listening IPv4 sockets
Date: Tue, 9 Jul 2002 14:40:45 +0900 (JST)

 Some TCP4 connections are also not shown by sockstat -4.
 This can cause overlooking of some important connections.
 
 In PR bin/40365:
 >When ipv6_ipv4mapping="YES" in rc.conf (i.e. default setting),
 >some IPv4 listening sockets are created as TCP46.
 >So such sockets are not shown by sockstat -4.
 >
 >How-To-Repeat
 >
 >on FreeBSD 4.6.*-RELEASE box:
 >pkg_add apache2-*.tgz, and invoke apache2.
 ># sockstat -4 | grep 80
 >(nothing is shown here.)
 ># sockstat | grep 80
 
 
 On another host (hostb):
 hostb% telnet webhost 80
 
 webhost% sockstat -4 | grep 80
 (nothing is shown here.)
 webhost% sockstat -6 | grep 80
 (A TCP4 connection is shown.)
 
 This looks very strange behavior for me.
 
 -- 
 NAKAMURA Takayuki <tak@st.rim.or.jp>

From: Peter Pentchev <roam@ringlet.net>
To: NAKAMURA Takayuki <tak@st.rim.or.jp>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/40365: sockstat -4 does not show some listening IPv4 sockets
Date: Tue, 9 Jul 2002 09:28:14 +0300

 On Mon, Jul 08, 2002 at 08:47:59PM -0700, NAKAMURA Takayuki wrote:
 > 
 > >Number:         40365
 > >Category:       bin
 > >Synopsis:       sockstat -4 does not show some listening IPv4 sockets
 > >Originator:     NAKAMURA Takayuki
 > >Release:        4.6-stable
 > >Organization:
 > >Environment:
 > FreeBSD reverse 4.6-STABLE-20020628-JPSNAP FreeBSD 4.6-STABLE-20020628-JPSNAP #0
 > : Sun Jun 30 14:48:56 JST 2002     root@air:/usr/src/sys/compile/TAKA  i386
 > >Description:
 > When ipv6_ipv4mapping="YES" in rc.conf (i.e. default setting), some IPv4 listening sockets are created as TCP46.
 > So such sockets are not shown by sockstat -4.
 > This may not be a bug, but causes users' inconvenience and confusion.
 > sockstat(1) should be modified, or the default value of the variable should be "NO".
 > >How-To-Repeat:
 > on FreeBSD 4.6.*-RELEASE box:
 > pkg_add apache2-*.tgz, and invoke apache2.
 > # sockstat -4 | grep 80
 > (nothing is shown here.)
 > # sockstat | grep 80
 
 That's, basically, why I'm in the habit of using 'sockstat -46' :)
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 Hey, out there - is it *you* reading me, or is it someone else?
State-Changed-From-To: open->closed 
State-Changed-By: ume 
State-Changed-When: Wed Jul 10 09:52:48 PDT 2002 
State-Changed-Why:  
Because listening an IPv4 connection via an IPv4-mapped IPv6 address 
is NOT an IPv4 socket, it shouldn't be shown if you specify to show 
only an IPv4 socket. 
There are some disscussion about security weakness of an IPv4-mapped 
IPv6 address.  Your confusion is an typical case.  So, I think it is 
better to change to don't enable an IPv4-mapped IPv6 address by 
default.  I'll change it for 5-CURRENT before 5.0-RELEASE is out. 
But, I have no plan for 4-STABLE to avoild POLA violation. 


Responsible-Changed-From-To: freebsd-bugs->ume 
Responsible-Changed-By: ume 
Responsible-Changed-When: Wed Jul 10 09:52:48 PDT 2002 
Responsible-Changed-Why:  
I'll handle this. 

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