1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0 3 4 # Regression Test: 5 # Verify bond interface could up when set IPv6 link local address target. 6 # 7 # +----------------+ 8 # | br0 | 9 # | | | sw 10 # | veth0 veth1 | 11 # +---+-------+----+ 12 # | | 13 # +---+-------+----+ 14 # | veth0 veth1 | 15 # | | | host 16 # | bond0 | 17 # +----------------+ 18 # 19 # We use veths instead of physical interfaces 20 REQUIRE_MZ=no 21 NUM_NETIFS=0 22 lib_dir=$(dirname "$0") 23 source "$lib_dir"/../../../net/forwarding/lib.sh 24 25 sw="sw-$(mktemp -u XXXXXX)" 26 host="ns-$(mktemp -u XXXXXX)" 27 28 cleanup() 29 { 30 ip netns del $sw 31 ip netns del $host 32 } 33 34 wait_lladdr_dad() 35 { 36 $@ | grep fe80 | grep -qv tentative 37 } 38 39 wait_bond_up() 40 { 41 $@ | grep -q 'state UP' 42 } 43 44 trap cleanup 0 1 2 45 46 ip netns add $sw 47 ip netns add $host 48 49 ip -n $host link add veth0 type veth peer name veth0 netns $sw 50 ip -n $host link add veth1 type veth peer name veth1 netns $sw 51 52 ip -n $sw link add br0 type bridge 53 ip -n $sw link set br0 up 54 sw_lladdr=$(ip -n $sw addr show br0 | awk '/fe80/{print $2}' | cut -d'/' -f1) 55 # wait some time to make sure bridge lladdr pass DAD 56 slowwait 2 wait_lladdr_dad ip -n $sw addr show br0 57 58 ip -n $host link add bond0 type bond mode 1 ns_ip6_target ${sw_lladdr} \ 59 arp_validate 3 arp_interval 1000 60 # add a lladdr for bond to make sure there is a route to target 61 ip -n $host addr add fe80::beef/64 dev bond0 62 ip -n $host link set bond0 up 63 ip -n $host link set veth0 master bond0 64 ip -n $host link set veth1 master bond0 65 66 ip -n $sw link set veth0 master br0 67 ip -n $sw link set veth1 master br0 68 ip -n $sw link set veth0 up 69 ip -n $sw link set veth1 up 70 71 slowwait 5 wait_bond_up ip -n $host link show bond0 72 73 rc=0 74 if ip -n $host link show bond0 | grep -q LOWER_UP; then 75 echo "PASS" 76 else 77 echo "FAIL" 78 rc=1 79 fi 80 exit $rc
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.