summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryamaguchi <yamaguchi@NetBSD.org>2021-07-14 08:50:24 +0000
committeryamaguchi <yamaguchi@NetBSD.org>2021-07-14 08:50:24 +0000
commit0a2abb49fd77ad90bff691b8c19f7dddcb476641 (patch)
tree68da2abe0f5ee63002bf16df8d530e895d647489
parente405ce4c1302e67a5f49015c662f66a4bc084cf4 (diff)
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
-rw-r--r--tests/net/if_vlan/t_vlan.sh26
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/net/if_vlan/t_vlan.sh b/tests/net/if_vlan/t_vlan.sh
index fc7c7687f64..e9334b53e0f 100644
--- a/tests/net/if_vlan/t_vlan.sh
+++ b/tests/net/if_vlan/t_vlan.sh
@@ -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 @@ vlan_bridge_body_common()
$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 @@ vlan_bridge_body_common()
# 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 && brconfig bridge0
+ $DEBUG && $HIJACKING /sbin/brconfig bridge0
+
$atf_brconfig bridge0 delete vlan0
+ $atf_brconfig bridge0 add 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