NetBSD Problem Report #51435
From mm_lists@pulsar-zone.net Mon Aug 22 08:09:08 2016
Return-Path: <mm_lists@pulsar-zone.net>
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" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 1E5B57A218
for <gnats-bugs@gnats.NetBSD.org>; Mon, 22 Aug 2016 08:09:08 +0000 (UTC)
Message-Id: <201608220808.u7M88tuJ012280@ginseng.pulsar-zone.net>
Date: Mon, 22 Aug 2016 04:09:06 -0400
From: Matthew Mondor <mm_lists@pulsar-zone.net>
To: gnats-bugs@NetBSD.org
Subject: NetBSD-7 IPv6 addresses cannot be bound when "detached"
>Number: 51435
>Category: kern
>Synopsis: NetBSD-7 IPv6 addresses cannot be bound when "detached"
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 22 08:10:00 +0000 2016
>Closed-Date: Thu May 25 05:21:54 +0000 2017
>Last-Modified: Thu May 25 05:21:54 +0000 2017
>Originator: Matthew Mondor
>Release: NetBSD 7.0_STABLE
>Organization:
>Environment:
System: NetBSD ninja.xisop 7.0_STABLE NetBSD 7.0_STABLE (GENERIC_MM) #0: Thu Jul 28 22:49:47 EDT 2016 root@ninja.xisop:/usr/obj/sys/arch/amd64/compile/GENERIC_MM amd64
Architecture: x86_64
Machine: amd64
>Description:
I noticed an issue on NetBSD-7 where IPv6 daemons would not be able to
bind to addresses. This turned out to be because when the ethernet
port is disconnected, its associated address(es) get "detached", and
daemons get an error about the address being unavailable.
Apparently this would also be an issue with IPv4 on -current. Please
see the thread "PATCH to mark IPv6 addresses DETACHED when down or link
down" on the tech-net mailing list for more information.
>How-To-Repeat:
ifconfig <if> inet6 <address> up
mkdir /tmp/www
<disconnect ethernet link temporarily>
httpd -b -i <address> -t /tmp/www -U _httpd -S 'httpd' -X /
>Fix:
It may be useful to allow binding to "detached" addresses. Needing a
special socket option to allow it would still leave most daemons
broken, except those explicitely made to support this bug-mitigating
"feature".
>Release-Note:
>Audit-Trail:
From: "Roy Marples" <roy@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51435 CVS commit: src/sys/netinet6
Date: Fri, 26 Aug 2016 19:45:55 +0000
Module Name: src
Committed By: roy
Date: Fri Aug 26 19:45:55 UTC 2016
Modified Files:
src/sys/netinet6: in6_src.c
Log Message:
Allow explicit binding to detached addresss.
Fixes PR kern/51435.
To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 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: "Roy Marples" <roy@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51435 CVS commit: src/sys/netinet6
Date: Fri, 26 Aug 2016 19:53:07 +0000
Module Name: src
Committed By: roy
Date: Fri Aug 26 19:53:07 UTC 2016
Modified Files:
src/sys/netinet6: in6_pcb.c raw_ip6.c
Log Message:
Allow explicit binding to detached addresss.
Fixes PR kern/51435.
To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.149 -r1.150 src/sys/netinet6/raw_ip6.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Matthew Mondor <mm_lists@pulsar-zone.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/51435: NetBSD-7 IPv6 addresses cannot be bound when
"detached"
Date: Sat, 27 Aug 2016 08:05:43 -0400
--MP_/Pc0CK6xQcSGa=lRfa/4Tp6V
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Thank you for working on this patch.
For an eventual pullup to NetBSD-7, I think that the fix translates to
the attached diff (untested yet, I'll try to test it during the
weekend).
I noticed that in one change for -current you also left out a
deprecated address fix. Was this voluntary? I have not currently
included that change in this diff.
You also said on tech-net@ that IPv4 is also affected on -current? On
NetBSD-7 IPv4 addresses do not seem to be detached when the link is
disconnected.
Thanks,
Matt
--MP_/Pc0CK6xQcSGa=lRfa/4Tp6V
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bind-detached-netbsd7.diff
Index: sys/netinet6/in6_pcb.c
===================================================================
RCS file: /data/rsync/netbsd-cvs/src/sys/netinet6/in6_pcb.c,v
retrieving revision 1.128.2.2
diff -u -p -r1.128.2.2 in6_pcb.c
--- sys/netinet6/in6_pcb.c 17 Jan 2015 12:10:54 -0000 1.128.2.2
+++ sys/netinet6/in6_pcb.c 27 Aug 2016 11:55:13 -0000
@@ -253,7 +253,7 @@ in6_pcbbind_addr(struct in6pcb *in6p, st
*/
if (ia &&
((struct in6_ifaddr *)ia)->ia6_flags &
- (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|IN6_IFF_DETACHED))
+ (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))
return (EADDRNOTAVAIL);
}
Index: sys/netinet6/in6_src.c
===================================================================
RCS file: /data/rsync/netbsd-cvs/src/sys/netinet6/in6_src.c,v
retrieving revision 1.54.2.1
diff -u -p -r1.54.2.1 in6_src.c
--- sys/netinet6/in6_src.c 23 Jan 2015 09:27:15 -0000 1.54.2.1
+++ sys/netinet6/in6_src.c 27 Aug 2016 11:52:10 -0000
@@ -311,7 +311,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso
/* avoid unusable addresses */
if ((ia->ia6_flags &
- (IN6_IFF_NOTREADY | IN6_IFF_ANYCAST | IN6_IFF_DETACHED))) {
+ (IN6_IFF_NOTREADY | IN6_IFF_ANYCAST))) {
continue;
}
if (!ip6_use_deprecated && IFA6_IS_DEPRECATED(ia))
Index: sys/netinet6/raw_ip6.c
===================================================================
RCS file: /data/rsync/netbsd-cvs/src/sys/netinet6/raw_ip6.c,v
retrieving revision 1.136
diff -u -p -r1.136 raw_ip6.c
--- sys/netinet6/raw_ip6.c 9 Aug 2014 05:33:01 -0000 1.136
+++ sys/netinet6/raw_ip6.c 27 Aug 2016 11:54:22 -0000
@@ -683,8 +683,7 @@ rip6_bind(struct socket *so, struct mbuf
(ia = ifa_ifwithaddr((struct sockaddr *)addr)) == 0)
return EADDRNOTAVAIL;
if (ia && ((struct in6_ifaddr *)ia)->ia6_flags &
- (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
- IN6_IFF_DETACHED|IN6_IFF_DEPRECATED))
+ (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|IN6_IFF_DEPRECATED))
return EADDRNOTAVAIL;
in6p->in6p_laddr = addr->sin6_addr;
return 0;
--MP_/Pc0CK6xQcSGa=lRfa/4Tp6V--
From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51435 CVS commit: [netbsd-7] src/sys/netinet6
Date: Wed, 28 Sep 2016 20:24:06 +0000
Module Name: src
Committed By: bouyer
Date: Wed Sep 28 20:24:06 UTC 2016
Modified Files:
src/sys/netinet6 [netbsd-7]: in6_pcb.c raw_ip6.c
Log Message:
Pull up following revision(s) (requested by roy in ticket #1243):
sys/netinet6/raw_ip6.c: revision 1.150 via patch
sys/netinet6/in6_pcb.c: revision 1.149 via patch
Allow explicit binding to detached addresss.
Fixes PR kern/51435.
To generate a diff of this commit:
cvs rdiff -u -r1.128.2.2 -r1.128.2.3 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.136 -r1.136.2.1 src/sys/netinet6/raw_ip6.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: dholland@NetBSD.org
State-Changed-When: Fri, 30 Sep 2016 07:26:52 +0000
State-Changed-Why:
Is this done now?
State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 25 May 2017 05:21:54 +0000
State-Changed-Why:
Guess it's done...
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.