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 20sw="sw-$(mktemp -u XXXXXX)" 21host="ns-$(mktemp -u XXXXXX)" 22 23cleanup() 24{ 25 ip netns del $sw 26 ip netns del $host 27} 28 29trap cleanup 0 1 2 30 31ip netns add $sw 32ip netns add $host 33 34ip -n $host link add veth0 type veth peer name veth0 netns $sw 35ip -n $host link add veth1 type veth peer name veth1 netns $sw 36 37ip -n $sw link add br0 type bridge 38ip -n $sw link set br0 up 39sw_lladdr=$(ip -n $sw addr show br0 | awk '/fe80/{print $2}' | cut -d'/' -f1) 40# sleep some time to make sure bridge lladdr pass DAD 41sleep 2 42 43ip -n $host link add bond0 type bond mode 1 ns_ip6_target ${sw_lladdr} \ 44 arp_validate 3 arp_interval 1000 45# add a lladdr for bond to make sure there is a route to target 46ip -n $host addr add fe80::beef/64 dev bond0 47ip -n $host link set bond0 up 48ip -n $host link set veth0 master bond0 49ip -n $host link set veth1 master bond0 50 51ip -n $sw link set veth0 master br0 52ip -n $sw link set veth1 master br0 53ip -n $sw link set veth0 up 54ip -n $sw link set veth1 up 55 56sleep 5 57 58rc=0 59if ip -n $host link show bond0 | grep -q LOWER_UP; then 60 echo "PASS" 61else 62 echo "FAIL" 63 rc=1 64fi 65exit $rc 66