1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 4NUM_NETIFS=4 5source lib.sh 6 7h1_create() 8{ 9 simple_if_init $h1 192.0.2.1/24 2001:db8:1::1/64 10} 11 12h1_destroy() 13{ 14 simple_if_fini $h1 192.0.2.1/24 2001:db8:1::1/64 15} 16 17h2_create() 18{ 19 simple_if_init $h2 192.0.2.2/24 2001:db8:1::2/64 20} 21 22h2_destroy() 23{ 24 simple_if_fini $h2 192.0.2.2/24 2001:db8:1::2/64 25} 26 27switch_create() 28{ 29 # 10 Seconds ageing time. 30 ip link add dev br0 type bridge ageing_time 1000 mcast_snooping 0 31 32 ip link set dev $swp1 master br0 33 ip link set dev $swp2 master br0 34 35 ip link set dev br0 up 36 ip link set dev $swp1 up 37 ip link set dev $swp2 up 38} 39 40switch_destroy() 41{ 42 ip link set dev $swp2 down 43 ip link set dev $swp1 down 44 45 ip link del dev br0 46} 47 48setup_prepare() 49{ 50 h1=${NETIFS[p1]} 51 swp1=${NETIFS[p2]} 52 53 swp2=${NETIFS[p3]} 54 h2=${NETIFS[p4]} 55 56 vrf_prepare 57 58 h1_create 59 h2_create 60 61 switch_create 62} 63 64cleanup() 65{ 66 pre_cleanup 67 68 switch_destroy 69 70 h2_destroy 71 h1_destroy 72 73 vrf_cleanup 74} 75 76trap cleanup EXIT 77 78setup_prepare 79setup_wait 80 81ping_test $h1 192.0.2.2 82ping6_test $h1 2001:db8:1::2 83learning_test "br0" $swp1 $h1 $h2 84flood_test $swp2 $h1 $h2 85 86exit $EXIT_STATUS 87