Source-Changes-HG archive

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

[src/netbsd-8]: src Pull up following revision(s) (requested by ozaki-r in ti...



details:   https://anonhg.NetBSD.org/src/rev/970bf66cbeb1
branches:  netbsd-8
changeset: 851794:970bf66cbeb1
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Jun 12 16:34:04 2018 +0000

description:
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.

diffstat:

 sys/net/if_vlan.c           |  10 ++++-
 tests/net/if_vlan/t_vlan.sh |  78 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 3 deletions(-)

diffs (134 lines):

diff -r d6d0df163a90 -r 970bf66cbeb1 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Mon Jun 11 08:51:20 2018 +0000
+++ b/sys/net/if_vlan.c Tue Jun 12 16:34:04 2018 +0000
@@ -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 @@
                        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);
diff -r d6d0df163a90 -r 970bf66cbeb1 tests/net/if_vlan/t_vlan.sh
--- a/tests/net/if_vlan/t_vlan.sh       Mon Jun 11 08:51:20 2018 +0000
+++ b/tests/net/if_vlan/t_vlan.sh       Tue Jun 12 16:34:04 2018 +0000
@@ -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 @@
        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_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
 }



Home | Main Index | Thread Index | Old Index