Source-Changes-HG archive

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

[src/trunk]: src/tests/net/if_vlan Added tests for adding vlan(4) to a bridge...



details:   https://anonhg.NetBSD.org/src/rev/c069d599c7f0
branches:  trunk
changeset: 984628:c069d599c7f0
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Wed Jul 14 08:50:24 2021 +0000

description:
Added tests for adding vlan(4) to a bridge and deleting from it

- add vlan(4) that has no parent interface to a bridge member
   - the vlan(4) cannot be added to a bridge member
- detach the parent interface of vlan(4) that is in a bridge member
   - vlan(4) is deleted from a bridge member at the detaching

diffstat:

 tests/net/if_vlan/t_vlan.sh |  28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r ec259e41972e -r c069d599c7f0 tests/net/if_vlan/t_vlan.sh
--- a/tests/net/if_vlan/t_vlan.sh       Wed Jul 14 08:33:47 2021 +0000
+++ b/tests/net/if_vlan/t_vlan.sh       Wed Jul 14 08:50:24 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_vlan.sh,v 1.21 2021/07/14 06:35:59 yamaguchi Exp $
+#      $NetBSD: t_vlan.sh,v 1.22 2021/07/14 08:50:24 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -681,8 +681,6 @@
        $atf_ifconfig shmif0 up
 
        $atf_ifconfig vlan0 create
-       $atf_ifconfig vlan0 vlan 10 vlanif shmif0
-       $atf_ifconfig vlan0 up
        $DEBUG && rump.ifconfig vlan0
 
        $atf_ifconfig bridge0 create
@@ -692,16 +690,36 @@
        # Add vlan to bridge member
        #
        $atf_ifconfig bridge0 mtu 1496
+
+       # vlan0 can not add to bridge member
+       # because it is not an ethernet device
+       atf_check -s not-exit:0 -e match:'Invalid argument' \
+           $HIJACKING /sbin/brconfig bridge0 add vlan0
+
+       $atf_ifconfig vlan0 vlan 10 vlanif shmif0
+       $atf_ifconfig vlan0 up
        atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 
+       # vlan0 becomes an ethernet device
+       # after attaching the parent interface
+       $atf_brconfig bridge0 add vlan0
+       $DEBUG && $HIJACKING /sbin/brconfig bridge0
+
+       $atf_brconfig bridge0 delete vlan0
+
        $atf_brconfig bridge0 add vlan0
-       $DEBUG && brconfig bridge0
-       $atf_brconfig bridge0 delete vlan0
+       $atf_ifconfig vlan0 -vlanif
+       atf_check -s exit:0 -o not-match:'vlan0' \
+           $HIJACKING /sbin/brconfig bridge0
+       atf_check -s not-exit:0 -e match:'No such' \
+           $HIJACKING /sbin/brconfig bridge0 delete vlan0
 
        #
        # decrease MTU on adding to bridge member
        #
        $atf_ifconfig bridge0 mtu 1495
+       $atf_ifconfig vlan0 vlan 10 vlanif shmif0
+       $atf_ifconfig vlan0 up
        atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 
        $atf_brconfig bridge0 add vlan0



Home | Main Index | Thread Index | Old Index