NetBSD Problem Report #49112

From www@NetBSD.org  Thu Aug 14 11:09:47 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(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 2C00AAD323
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 14 Aug 2014 11:09:47 +0000 (UTC)
Message-Id: <20140814110945.E99BEAD329@mollari.NetBSD.org>
Date: Thu, 14 Aug 2014 11:09:45 +0000 (UTC)
From: ozaki-r@netbsd.org
Reply-To: ozaki-r@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: ifconfig -vlanif leads unxpected ifconfig behavior
X-Send-Pr-Version: www-1.0

>Number:         49112
>Category:       kern
>Synopsis:       ifconfig -vlanif leads unxpected ifconfig behavior
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 14 11:10:00 +0000 2014
>Closed-Date:    Tue Nov 04 09:41:55 +0000 2014
>Last-Modified:  Tue Nov 04 09:41:55 +0000 2014
>Originator:     Ryota Ozaki
>Release:        current
>Organization:
>Environment:
NetBSD rangeley 6.99.49 NetBSD 6.99.49 (GENERIC) #4: Fri Aug  1 12:28:52 JST 2014  ozaki-r@rangeley:/usr/src/work.amd64/sys/arch/amd64/compile/GENERIC amd64

>Description:
ifconfig -vlanif leads unxpected ifconfig behavior:

rangeley# ifconfig vlan0 create
ifconfig vlan0 create
rangeley# ifconfig vlan0 vlan 1 vlanif wm1
rangeley# ifconfig vlan0 -vlanif wm1
rangeley# ifconfig vlan0  [*]
ifconfig: SIOCGIFFLAGS vlan0: Device not configured
rangeley# ifconfig vlan0 create
ifconfig: clone_command: File exists
ifconfig: exec_matches: File exists

[*] should be success.
>How-To-Repeat:
See the description.
>Fix:
ifconfig -vlanif calls vlan_unconfig which calls ether_ifdetach.
ether_ifdetach sets  enxio to if_ioctl unexpectedly.
We have to restore the original ioctl function (vlan_ioctl).

diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 18a0292..7026775 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -434,6 +434,8 @@ vlan_unconfig(struct ifnet *ifp)
                }

                ether_ifdetach(ifp);
+               /* ether_ifdetach sets enxio to if_ioctl, so we need to restore */
+               ifp->if_ioctl = vlan_ioctl;
                vlan_reset_linkname(ifp);
                break;
            }

>Release-Note:

>Audit-Trail:
From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49112 CVS commit: src/sys/net
Date: Fri, 12 Sep 2014 03:44:28 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Fri Sep 12 03:44:27 UTC 2014

 Modified Files:
 	src/sys/net: if_vlan.c

 Log Message:
 Restore vlan_ioctl overwritten by ether_ifdetach in vlan_unconfig

 This fixes PR 49112.


 To generate a diff of this commit:
 cvs rdiff -u -r1.70 -r1.71 src/sys/net/if_vlan.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->pending-pullups
State-Changed-By: ozaki-r@NetBSD.org
State-Changed-When: Tue, 16 Sep 2014 03:01:56 +0000
State-Changed-Why:
pullup-6 and pullup-7


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49112 CVS commit: [netbsd-7] src
Date: Mon, 22 Sep 2014 10:44:37 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Sep 22 10:44:37 UTC 2014

 Modified Files:
 	src/sbin/ifconfig [netbsd-7]: ifconfig.8 vlan.c
 	src/sys/net [netbsd-7]: if_vlan.c

 Log Message:
 Pull up following revision(s) (requested by ozaki-r in ticket #108):
 	sbin/ifconfig/vlan.c: revision 1.14
 	sbin/ifconfig/ifconfig.8: revision 1.108
 	sys/net/if_vlan.c: revision 1.71-1.74

 Document -vlanif in ifconfig.8 and in usage measseg (PR 49114).
 Leave promiscuous mode when detaching a parent (PR 49196) and
 delete link local addresses (49197).
 Restore vlan_ioctl overwritten by ether_ifdetach in vlan_unconfig
 (PR 49112).
 Call if_input of vlan interface itself, not parent one.
 This allows bridging vlan interfaces again.


 To generate a diff of this commit:
 cvs rdiff -u -r1.106 -r1.106.4.1 src/sbin/ifconfig/ifconfig.8
 cvs rdiff -u -r1.13 -r1.13.24.1 src/sbin/ifconfig/vlan.c
 cvs rdiff -u -r1.70 -r1.70.2.1 src/sys/net/if_vlan.c

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

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49112 CVS commit: [netbsd-6] src
Date: Mon, 3 Nov 2014 20:38:09 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Mon Nov  3 20:38:09 UTC 2014

 Modified Files:
 	src/sbin/ifconfig [netbsd-6]: ifconfig.8 vlan.c
 	src/sys/net [netbsd-6]: if_vlan.c

 Log Message:
 Pull up following revision(s) (requested by ozaki-r in ticket #1156):
 	sbin/ifconfig/vlan.c: revision 1.14
 	sbin/ifconfig/ifconfig.8: revision 1.108
 	sys/net/if_vlan.c: revision 1.71
 	sys/net/if_vlan.c: revision 1.73
 	sys/net/if_vlan.c: revision 1.74
 - PR#49114: Write about -vlanif in ifconfig.8.
   Add -vlanif to the help message of ifconfig.
 - PR#49196: Leave promiscuous mode when detaching a parent (ifconfig -vlanif)
   We have to call ifpromisc(ifp, 0) for both a VLAN interface
   and its parent when they are in promiscuous mode.
 - PR#49197: Delete link local addresses of a vlan interface when detaching its
   parent.
 - PR#49112: Restore vlan_ioctl overwritten by ether_ifdetach in vlan_unconfig


 To generate a diff of this commit:
 cvs rdiff -u -r1.104 -r1.104.2.1 src/sbin/ifconfig/ifconfig.8
 cvs rdiff -u -r1.13 -r1.13.8.1 src/sbin/ifconfig/vlan.c
 cvs rdiff -u -r1.69.8.1 -r1.69.8.2 src/sys/net/if_vlan.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: msaitoh@NetBSD.org
State-Changed-When: Tue, 04 Nov 2014 09:41:55 +0000
State-Changed-Why:
Pulled up. Thanks.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.