Wed Jul 14 08:50:24 2021 UTC ()
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


(yamaguchi)
diff -r1.21 -r1.22 src/tests/net/if_vlan/t_vlan.sh

cvs diff -r1.21 -r1.22 src/tests/net/if_vlan/t_vlan.sh (expand / switch to unified diff)

--- src/tests/net/if_vlan/t_vlan.sh 2021/07/14 06:35:59 1.21
+++ src/tests/net/if_vlan/t_vlan.sh 2021/07/14 08:50:24 1.22
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: t_vlan.sh,v 1.21 2021/07/14 06:35:59 yamaguchi Exp $ 1# $NetBSD: t_vlan.sh,v 1.22 2021/07/14 08:50:24 yamaguchi Exp $
2# 2#
3# Copyright (c) 2016 Internet Initiative Japan Inc. 3# Copyright (c) 2016 Internet Initiative Japan Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# Redistribution and use in source and binary forms, with or without 6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions 7# modification, are permitted provided that the following conditions
8# are met: 8# are met:
9# 1. Redistributions of source code must retain the above copyright 9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer. 10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright 11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the 12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution. 13# documentation and/or other materials provided with the distribution.
14# 14#
@@ -671,47 +671,65 @@ vlan_configs6_cleanup() @@ -671,47 +671,65 @@ vlan_configs6_cleanup()
671} 671}
672 672
673vlan_bridge_body_common() 673vlan_bridge_body_common()
674{ 674{
675 local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" 675 local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
676 local atf_brconfig="atf_check -s exit:0 $HIJACKING /sbin/brconfig" 676 local atf_brconfig="atf_check -s exit:0 $HIJACKING /sbin/brconfig"
677 677
678 rump_server_add_iface $SOCK_LOCAL shmif0 $BUS 678 rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
679 679
680 export RUMP_SERVER=$SOCK_LOCAL 680 export RUMP_SERVER=$SOCK_LOCAL
681 $atf_ifconfig shmif0 up 681 $atf_ifconfig shmif0 up
682 682
683 $atf_ifconfig vlan0 create 683 $atf_ifconfig vlan0 create
684 $atf_ifconfig vlan0 vlan 10 vlanif shmif0 
685 $atf_ifconfig vlan0 up 
686 $DEBUG && rump.ifconfig vlan0 684 $DEBUG && rump.ifconfig vlan0
687 685
688 $atf_ifconfig bridge0 create 686 $atf_ifconfig bridge0 create
689 $atf_ifconfig bridge0 up 687 $atf_ifconfig bridge0 up
690 688
691 # 689 #
692 # Add vlan to bridge member 690 # Add vlan to bridge member
693 # 691 #
694 $atf_ifconfig bridge0 mtu 1496 692 $atf_ifconfig bridge0 mtu 1496
 693
 694 # vlan0 can not add to bridge member
 695 # because it is not an ethernet device
 696 atf_check -s not-exit:0 -e match:'Invalid argument' \
 697 $HIJACKING /sbin/brconfig bridge0 add vlan0
 698
 699 $atf_ifconfig vlan0 vlan 10 vlanif shmif0
 700 $atf_ifconfig vlan0 up
695 atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 701 atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
696 702
 703 # vlan0 becomes an ethernet device
 704 # after attaching the parent interface
697 $atf_brconfig bridge0 add vlan0 705 $atf_brconfig bridge0 add vlan0
698 $DEBUG && brconfig bridge0 706 $DEBUG && $HIJACKING /sbin/brconfig bridge0
 707
699 $atf_brconfig bridge0 delete vlan0 708 $atf_brconfig bridge0 delete vlan0
700 709
 710 $atf_brconfig bridge0 add vlan0
 711 $atf_ifconfig vlan0 -vlanif
 712 atf_check -s exit:0 -o not-match:'vlan0' \
 713 $HIJACKING /sbin/brconfig bridge0
 714 atf_check -s not-exit:0 -e match:'No such' \
 715 $HIJACKING /sbin/brconfig bridge0 delete vlan0
 716
701 # 717 #
702 # decrease MTU on adding to bridge member 718 # decrease MTU on adding to bridge member
703 # 719 #
704 $atf_ifconfig bridge0 mtu 1495 720 $atf_ifconfig bridge0 mtu 1495
 721 $atf_ifconfig vlan0 vlan 10 vlanif shmif0
 722 $atf_ifconfig vlan0 up
705 atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 723 atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
706 724
707 $atf_brconfig bridge0 add vlan0 725 $atf_brconfig bridge0 add vlan0
708 $DEBUG && brconfig bridge0 726 $DEBUG && brconfig bridge0
709 atf_check -s exit:0 -o match:'mtu 1495' rump.ifconfig vlan0 727 atf_check -s exit:0 -o match:'mtu 1495' rump.ifconfig vlan0
710 $atf_brconfig bridge0 delete vlan0 728 $atf_brconfig bridge0 delete vlan0
711 729
712 # 730 #
713 # increase MTU on adding to bridge member 731 # increase MTU on adding to bridge member
714 # 732 #
715 $atf_ifconfig bridge0 mtu 1496 733 $atf_ifconfig bridge0 mtu 1496
716 $atf_ifconfig vlan0 mtu 1495 734 $atf_ifconfig vlan0 mtu 1495
717 $atf_brconfig bridge0 add vlan0 735 $atf_brconfig bridge0 add vlan0