Module Name: src Committed By: snj Date: Tue Jun 12 16:34:04 UTC 2018
Modified Files: src/sys/net [netbsd-8]: if_vlan.c src/tests/net/if_vlan [netbsd-8]: t_vlan.sh Log Message: Pull up following revision(s) (requested by ozaki-r in ticket #876): sys/net/if_vlan.c: 1.126 tests/net/if_vlan/t_vlan.sh: 1.9 vlan: call ether_ifdetach without IFNET_LOCK Fix PR kern/53357 -- Add tests of vlan with bridge The tests trigger a panic reported in PR kern/53357. To generate a diff of this commit: cvs rdiff -u -r1.97.2.13 -r1.97.2.14 src/sys/net/if_vlan.c cvs rdiff -u -r1.1.8.2 -r1.1.8.3 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_vlan.c diff -u src/sys/net/if_vlan.c:1.97.2.13 src/sys/net/if_vlan.c:1.97.2.14 --- src/sys/net/if_vlan.c:1.97.2.13 Sun May 6 13:09:05 2018 +++ src/sys/net/if_vlan.c Tue Jun 12 16:34:04 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vlan.c,v 1.97.2.13 2018/05/06 13:09:05 martin Exp $ */ +/* $NetBSD: if_vlan.c,v 1.97.2.14 2018/06/12 16:34:04 snj Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.13 2018/05/06 13:09:05 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.14 2018/06/12 16:34:04 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -618,7 +618,13 @@ vlan_unconfig_locked(struct ifvlan *ifv, IFNET_UNLOCK(p); } + /* XXX ether_ifdetach must not be called with IFNET_LOCK */ + mutex_exit(&ifv->ifv_lock); + IFNET_UNLOCK(ifp); ether_ifdetach(ifp); + IFNET_LOCK(ifp); + mutex_enter(&ifv->ifv_lock); + /* Restore vlan_ioctl overwritten by ether_ifdetach */ ifp->if_ioctl = vlan_ioctl; vlan_reset_linkname(ifp); Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.1.8.2 src/tests/net/if_vlan/t_vlan.sh:1.1.8.3 --- src/tests/net/if_vlan/t_vlan.sh:1.1.8.2 Mon Feb 26 00:41:14 2018 +++ src/tests/net/if_vlan/t_vlan.sh Tue Jun 12 16:34:04 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.1.8.2 2018/02/26 00:41:14 snj Exp $ +# $NetBSD: t_vlan.sh,v 1.1.8.3 2018/06/12 16:34:04 snj Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -511,6 +511,80 @@ vlan_configs6_cleanup() cleanup } +vlan_bridge_body_common() +{ + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 rump.ifconfig shmif0 up + + atf_check -s exit:0 rump.ifconfig vlan0 create + atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 + atf_check -s exit:0 rump.ifconfig vlan0 up + $DEBUG && rump.ifconfig vlan0 + + atf_check -s exit:0 rump.ifconfig bridge0 create + # Adjust to the MTU of a vlan on a shmif + atf_check -s exit:0 rump.ifconfig bridge0 mtu 1496 + atf_check -s exit:0 rump.ifconfig bridge0 up + # Test brconfig add + atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 + $DEBUG && brconfig bridge0 + # Test brconfig delete + atf_check -s exit:0 $HIJACKING brconfig bridge0 delete vlan0 + + atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 + # Test vlan destruction with bridge + atf_check -s exit:0 rump.ifconfig vlan0 destroy + + rump_server_destroy_ifaces +} + +atf_test_case vlan_bridge cleanup +vlan_bridge_head() +{ + + atf_set "descr" "tests of vlan interfaces with bridges (IPv4)" + atf_set "require.progs" "rump_server" +} + +vlan_bridge_body() +{ + + rump_server_start $SOCK_LOCAL vlan bridge + vlan_bridge_body_common +} + +vlan_bridge_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case vlan_bridge6 cleanup +vlan_bridge6_head() +{ + + atf_set "descr" "tests of vlan interfaces with bridges (IPv6)" + atf_set "require.progs" "rump_server" +} + +vlan_bridge6_body() +{ + + rump_server_start $SOCK_LOCAL vlan netinet6 bridge + vlan_bridge_body_common +} + +vlan_bridge6_cleanup() +{ + + $DEBUG && dump + cleanup +} + atf_init_test_cases() { @@ -518,9 +592,11 @@ atf_init_test_cases() atf_add_test_case vlan_basic atf_add_test_case vlan_vlanid atf_add_test_case vlan_configs + atf_add_test_case vlan_bridge atf_add_test_case vlan_create_destroy6 atf_add_test_case vlan_basic6 atf_add_test_case vlan_vlanid6 atf_add_test_case vlan_configs6 + atf_add_test_case vlan_bridge6 }