~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/bonding/bond-lladdr-target.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php