NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/49112: ifconfig -vlanif leads unxpected ifconfig behavior



>Number:         49112
>Category:       kern
>Synopsis:       ifconfig -vlanif leads unxpected ifconfig behavior
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 14 11:10:00 +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;
            }



Home | Main Index | Thread Index | Old Index