NetBSD Problem Report #52382

From www@NetBSD.org  Sun Jul  9 13:36:14 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6B8737A264
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  9 Jul 2017 13:36:14 +0000 (UTC)
Message-Id: <20170709133613.45B3F7A2A6@mollari.NetBSD.org>
Date: Sun,  9 Jul 2017 13:36:13 +0000 (UTC)
From: joel.bertrand@systella.fr
Reply-To: joel.bertrand@systella.fr
To: gnats-bugs@NetBSD.org
Subject: Sockets that only listen on inet6 domain
X-Send-Pr-Version: www-1.0

>Number:         52382
>Category:       lib
>Synopsis:       Sockets that only listen on inet6 domain
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 09 13:40:00 +0000 2017
>Closed-Date:    Tue Jan 31 23:58:14 +0000 2023
>Last-Modified:  Wed Feb 01 00:15:04 +0000 2023
>Originator:     BERTRAND Joël
>Release:        8.0 BETA
>Organization:
>Environment:
NetBSD legendre.systella.fr 8.0_BETA NetBSD 8.0_BETA (CUSTOM) #4: Fri Jul  7 22:39:32 CEST 2017  root@legendre.systella.fr:/usr/src/netbsd-8/obj/sys/arch/amd64/compile/CUSTOM amd64
>Description:
Hello,

I'm upgrading a test server from NetBSD 7.0.2 to 8.0_BETA. I have built 8.0 from sources for amd64 last friday.

Two daemons (built from pkgsrc) refuse to work as expected:
- squid always returns "document contains no data". I have deleted and recreated an empty cache volume without any result. My server doesn't send any http packets on its WAN interface;
- mysql that runs fine when I connect to this database server from localhost.

Netstat returns for mysql :
legendre# netstat -a -f inet | grep mysql
legendre# netstat -a -f inet6 | grep mysql
tcp6       0      0  *.mysql                *.*                    LISTEN
legendre#

If I force http_port 192.168.10.128:3128 (instead of http_port 3128) in squid.conf, squid works as expected in ipv4 (but only in IPv4). Same constatation with mysqld.

legendre# fstat | grep squid | grep intern
squid    pinger      1459    0* internet6 dgram udp localhost:63206 <-> localhost:63207
squid    pinger      1459    1* internet6 dgram udp localhost:63206 <-> localhost:63207
squid    pinger      1459    3* internet raw icmp fffffe841b1dd2e8
squid    pinger      1459    4* internet6 raw icmp6 fffffe8411ba4480
squid    squid      19452    9* internet6 dgram udp *:63208
squid    squid      19452   10* internet dgram udp *:54131
squid    squid      19452   19* internet stream tcp 192.168.10.128:ndl-aas
squid    squid      19452   21* internet6 dgram udp localhost:63207 <-> localhost:63206

    Best regards,

    JB
>How-To-Repeat:

>Fix:
Force IP address in configuration.

>Release-Note:

>Audit-Trail:
From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Sun, 9 Jul 2017 16:09:38 +0200

 On Sun, Jul 09, 2017 at 01:40:00PM +0000, joel.bertrand@systella.fr wrote:
 > >Synopsis:       Sockets that only listen on inet6 domain

 I'm not sure what you want to tell us. NetBSD defaults to v6only, i.e. a
 INET6 socket by default will not use mapped IPv4.

 Joerg

From: =?UTF-8?Q?BERTRAND_Jo=c3=abl?= <joel.bertrand@systella.fr>
To: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org
Cc: 
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Sun, 9 Jul 2017 16:54:41 +0200

 Joerg Sonnenberger a écrit :
 > The following reply was made to PR lib/52382; it has been noted by GNATS.
 >
 > From: Joerg Sonnenberger <joerg@bec.de>
 > To: gnats-bugs@NetBSD.org
 > Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
 > 	netbsd-bugs@netbsd.org
 > Subject: Re: lib/52382: Sockets that only listen on inet6 domain
 > Date: Sun, 9 Jul 2017 16:09:38 +0200
 >
 >  On Sun, Jul 09, 2017 at 01:40:00PM +0000, joel.bertrand@systella.fr wrote:
 >  > >Synopsis:       Sockets that only listen on inet6 domain
 >
 >  I'm not sure what you want to tell us. NetBSD defaults to v6only, i.e. a
 >  INET6 socket by default will not use mapped IPv4.
 >
 >  Joerg
 >
 >

 With NetBSD 7.x, these sockets listen on IPv4 _and_ IPv6. With the same 
 configuration, they only listen on IPv6.

 For example, if you start mysqld without bind_address statement in 
 my.cnf, mysqld should listen all interfaces in IPv4 and IPv6. With 8.0 
 BETA, daemon only listen on IPv6.

 Regards,

 JKB

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, joel.bertrand@systella.fr
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Sun, 9 Jul 2017 19:10:35 +0200

 On Sun, Jul 09, 2017 at 02:55:00PM +0000, BERTRAND Joël wrote:
 >  For example, if you start mysqld without bind_address statement in 
 >  my.cnf, mysqld should listen all interfaces in IPv4 and IPv6. With 8.0 
 >  BETA, daemon only listen on IPv6.

 I have no idea what MySQL is doing. I'm just telling you that a default
 inet6 wildcard socket on any BSD does *not* use mapped IPv4 and
 therefore will *not* listen to IPv4. That is intentional and *not* a
 bug. A program that really wants to use the same socket for both *must*
 set ipv6only to 0 via the appropiate setsockopt call.

 Joerg

From: Robert Elz <kre@munnari.OZ.AU>
To: Joerg Sonnenberger <joerg@bec.de>
Cc: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org, joel.bertrand@systella.fr
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Mon, 10 Jul 2017 00:36:40 +0700

     Date:        Sun, 9 Jul 2017 19:10:35 +0200
     From:        Joerg Sonnenberger <joerg=40bec.de>
     Message-ID:  <20170709171035.GA1214=40britannica.bec.de>

   =7C A program that really wants to use the same socket for both *must*
   =7C set ipv6only to 0 via the appropiate setsockopt call.

 Either that or:
 	sysctl -w net.inet6.ip6.v6only=3D0

 which it is possible that Joel has in NetBSD 7 but not in NetBSD 6

 But Joerg is correct, this has never been the NetBSD default.

 kre

From: =?UTF-8?Q?BERTRAND_Jo=c3=abl?= <joel.bertrand@systella.fr>
To: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org
Cc: 
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Mon, 10 Jul 2017 00:12:09 +0200

 Robert Elz a écrit :
 > The following reply was made to PR lib/52382; it has been noted by GNATS.
 >
 > From: Robert Elz <kre@munnari.OZ.AU>
 > To: Joerg Sonnenberger <joerg@bec.de>
 > Cc: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
 >         netbsd-bugs@netbsd.org, joel.bertrand@systella.fr
 > Subject: Re: lib/52382: Sockets that only listen on inet6 domain
 > Date: Mon, 10 Jul 2017 00:36:40 +0700
 >
 >      Date:        Sun, 9 Jul 2017 19:10:35 +0200
 >      From:        Joerg Sonnenberger <joerg=40bec.de>
 >      Message-ID:  <20170709171035.GA1214=40britannica.bec.de>
 >
 >    =7C A program that really wants to use the same socket for both *must*
 >    =7C set ipv6only to 0 via the appropiate setsockopt call.
 >
 >  Either that or:
 >  	sysctl -w net.inet6.ip6.v6only=3D0
 >
 >  which it is possible that Joel has in NetBSD 7 but not in NetBSD 6
 >
 >  But Joerg is correct, this has never been the NetBSD default.
 >
 >  kre
 >

 I have net.inet6.ip6.v6only = 1 in my system. But I'm sure that I have 
 not manually set this parameter.

 That being said, both squid ans mysql worked fine with -6, -7 and don't 
 with -8 with default configuration.

 I don't know if with -6 and -7 these daemons listen on both IPv4 and 
 IPv6, but they listen at least on IPv4.

 Regards,

 JB

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org, joel.bertrand@systella.fr
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Sun, 9 Jul 2017 18:55:07 -0400

 you need separate socket file descriptors to listen to v4 and v6 and the app=
 lication is responsible for setting those up. if you ktrace or turn on debug=
 ging perhaps you'll see what's wrong.

 christos

 > On Jul 9, 2017, at 6:15 PM, BERTRAND Jo=C3=ABl <joel.bertrand@systella.fr>=
  wrote:
 >=20
 > The following reply was made to PR lib/52382; it has been noted by GNATS.
 >=20
 > From: =3D?UTF-8?Q?BERTRAND_Jo=3Dc3=3Dabl?=3D <joel.bertrand@systella.fr>
 > To: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org, gnats-admin@netbsd.o=
 rg,
 >        netbsd-bugs@netbsd.org
 > Cc:=20
 > Subject: Re: lib/52382: Sockets that only listen on inet6 domain
 > Date: Mon, 10 Jul 2017 00:12:09 +0200
 >=20
 > Robert Elz a =C3=A9crit :
 >> The following reply was made to PR lib/52382; it has been noted by GNATS.=

 >>=20
 >> From: Robert Elz <kre@munnari.OZ.AU>
 >> To: Joerg Sonnenberger <joerg@bec.de>
 >> Cc: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org, gnats-admin@netbsd.=
 org,
 >>        netbsd-bugs@netbsd.org, joel.bertrand@systella.fr
 >> Subject: Re: lib/52382: Sockets that only listen on inet6 domain
 >> Date: Mon, 10 Jul 2017 00:36:40 +0700
 >>=20
 >>     Date:        Sun, 9 Jul 2017 19:10:35 +0200
 >>     From:        Joerg Sonnenberger <joerg=3D40bec.de>
 >>     Message-ID:  <20170709171035.GA1214=3D40britannica.bec.de>
 >>=20
 >>   =3D7C A program that really wants to use the same socket for both *must=
 *
 >>   =3D7C set ipv6only to 0 via the appropiate setsockopt call.
 >>=20
 >> Either that or:
 >>    sysctl -w net.inet6.ip6.v6only=3D3D0
 >>=20
 >> which it is possible that Joel has in NetBSD 7 but not in NetBSD 6
 >>=20
 >> But Joerg is correct, this has never been the NetBSD default.
 >>=20
 >> kre
 >>=20
 >=20
 > I have net.inet6.ip6.v6only =3D 1 in my system. But I'm sure that I have=20=

 > not manually set this parameter.
 >=20
 > That being said, both squid ans mysql worked fine with -6, -7 and don't=20=

 > with -8 with default configuration.
 >=20
 > I don't know if with -6 and -7 these daemons listen on both IPv4 and=20
 > IPv6, but they listen at least on IPv4.
 >=20
 > Regards,
 >=20
 > JB
 >=20

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Wed, 2 Aug 2017 00:20:24 -0500 (CDT)

 I have just noticed the same issue with 'qmail'.  The system previously
 ran NetBSD-7.1_STABLE-amd64.  'qmail' smtpd and pop3d worked properly,
 listening on IPv4 sockets.  I don't know if they listened on IPv6 as
 it was irrelevant.

 After updating to 8.0_BETA and rebuilding packages (pkgsrc-2017Q1), but
 with no 'qmail' configuration changes at all, 'qmail' smtpd and pop3d
 are listening only on IPv6 and not on IPv4 at all.

 The system default of "net.inet6.ip6.v6only=1" has been in effect the
 whole time.  Changing it to 0 had no effect.

 Perhaps this was addressed in changes to 'qmail' and friends in
 pkgsrc-2017Q2.  I'm updating now.

 If that doesn't help, I'll need to figure out how to tell 'qmail' to
 listen on a specific interface/address instead of the wildcard.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Wed, 2 Aug 2017 01:17:37 -0500 (CDT)

 On Wed, 2 Aug 2017, John D. Baker wrote:

 > Perhaps this was addressed in changes to 'qmail' and friends in
 > pkgsrc-2017Q2.  I'm updating now.

 No help there.

 > If that doesn't help, I'll need to figure out how to tell 'qmail' to
 > listen on a specific interface/address instead of the wildcard.

 On the system in question, startup of 'qmail' components is routed to

   /etc/qmail-service/qmail-XXXX/run

 which is a shell script launching 'tcpserver' with various options.

 The workaround is to put an IPv4 address in place of 'tcpserver's "0"
 wildcard address.  Contrary to the 'tcpserver' documentation, using
 a hostname is insuffcient.

 Since I'm using 'pf' with 'synproxy state' directives on pass rules for
 local services, I also create an auxiliary loopback interface "lo1" and
 redirect connections to it.  (PR kern/48377)

 For qmail-pop3d and qmail-smtpd, I just put the address of the auxiliary
 loopback interface into the 'tcpserver' command line in their respective
 'run' scripts.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: joel.bertrand@systella.fr
Subject: Re: lib/52382: Sockets that only listen on inet6 domain
Date: Wed, 2 Aug 2017 09:43:22 +0200

 On Wed, Aug 02, 2017 at 05:25:01AM +0000, John D. Baker wrote:
 >  
 >  After updating to 8.0_BETA and rebuilding packages (pkgsrc-2017Q1), but
 >  with no 'qmail' configuration changes at all, 'qmail' smtpd and pop3d
 >  are listening only on IPv6 and not on IPv4 at all.

 It would be very helpfull to have a small C program that show the effect.
 I tried, but failed (trying to follow the mess in qemu).

 Note that this might depend on your /etc/resolv.conf, the name server,
 and whatever other local aspects, so while we do not have a proper reproducer,
 it is hard to debug.

 Martin

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52382 CVS commit: src/sys/netinet6
Date: Sun, 27 Aug 2017 08:34:21 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sun Aug 27 12:34:21 UTC 2017

 Modified Files:
 	src/sys/netinet6: in6_src.c

 Log Message:
 PR/52382: BERTRAND Joel: Fix mapped IPv4 source selection; this got broken
 in the last code refactoring. in6_selectif failing is not fatal.
 XXX: pullup-8


 To generate a diff of this commit:
 cvs rdiff -u -r1.79 -r1.80 src/sys/netinet6/in6_src.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52382 CVS commit: [netbsd-8] src/sys/netinet6
Date: Thu, 31 Aug 2017 11:24:03 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Aug 31 11:24:03 UTC 2017

 Modified Files:
 	src/sys/netinet6 [netbsd-8]: in6_src.c

 Log Message:
 Pull up following revision(s) (requested by christos in ticket #243):
 	sys/netinet6/in6_src.c: revision 1.80
 PR/52382: BERTRAND Joel: Fix mapped IPv4 source selection; this got broken
 in the last code refactoring. in6_selectif failing is not fatal.
 XXX: pullup-8


 To generate a diff of this commit:
 cvs rdiff -u -r1.79 -r1.79.6.1 src/sys/netinet6/in6_src.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 04 Jun 2018 10:52:14 +0000
State-Changed-Why:
Was this fixed by christos's commit?


From: =?UTF-8?Q?BERTRAND_Jo=c3=abl?= <joel.bertrand@systella.fr>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/52382 (Sockets that only listen on inet6 domain)
Date: Tue, 5 Jun 2018 19:50:17 +0200

 maya@NetBSD.org a écrit :
 > Synopsis: Sockets that only listen on inet6 domain
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: maya@NetBSD.org
 > State-Changed-When: Mon, 04 Jun 2018 10:52:14 +0000
 > State-Changed-Why:
 > Was this fixed by christos's commit?

 	Sorry, I cannot test as I don't have test workstation for the moment... :-(

 	Regards,

 	JB

State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 31 Jan 2023 23:58:14 +0000
State-Changed-Why:
No feedback since 2018, assume fixed


From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/52382 (Sockets that only listen on inet6 domain)
Date: Wed, 1 Feb 2023 00:13:56 +0000

 On Tue, Jan 31, 2023 at 11:58:14PM +0000, dholland@NetBSD.org wrote:
  > Synopsis: Sockets that only listen on inet6 domain
  > 
  > State-Changed-From-To: feedback->closed
  > State-Changed-By: dholland@NetBSD.org
  > State-Changed-When: Tue, 31 Jan 2023 23:58:14 +0000
  > State-Changed-Why:
  > No feedback since 2018, assume fixed

 Er. "submitter cannot test". Same net result though :-|

 -- 
 David A. Holland
 dholland@netbsd.org

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.