forked from mirrors/linux
		
	selftests/bonding: add a test for bonding lladdr target
This is a regression test for commit592335a416("bonding: accept unsolicited NA message") and commitb7f14132bf("bonding: use unspecified address if no available link local address"). When the bond interface up and no available link local address, unspecified address(::) is used to send the NS message. The unsolicited NA message should also be accepted for validation. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Acked-by: Jonathan Toppins <jtoppins@redhat.com> Link: https://lore.kernel.org/r/20220920033047.173244-1-liuhangbin@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									4633b39183
								
							
						
					
					
						commit
						152e8ec776
					
				
					 2 changed files with 66 additions and 0 deletions
				
			
		|  | @ -2,5 +2,6 @@ | ||||||
| # Makefile for net selftests
 | # Makefile for net selftests
 | ||||||
| 
 | 
 | ||||||
| TEST_PROGS := bond-break-lacpdu-tx.sh | TEST_PROGS := bond-break-lacpdu-tx.sh | ||||||
|  | TEST_PROGS += bond-lladdr-target.sh | ||||||
| 
 | 
 | ||||||
| include ../../../lib.mk | include ../../../lib.mk | ||||||
|  |  | ||||||
							
								
								
									
										65
									
								
								tools/testing/selftests/drivers/net/bonding/bond-lladdr-target.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										65
									
								
								tools/testing/selftests/drivers/net/bonding/bond-lladdr-target.sh
									
									
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,65 @@ | ||||||
|  | #!/bin/bash | ||||||
|  | # SPDX-License-Identifier: GPL-2.0 | ||||||
|  | 
 | ||||||
|  | # Regression Test: | ||||||
|  | #   Verify bond interface could up when set IPv6 link local address target. | ||||||
|  | # | ||||||
|  | #  +----------------+ | ||||||
|  | #  |      br0       | | ||||||
|  | #  |       |        |    sw | ||||||
|  | #  | veth0   veth1  | | ||||||
|  | #  +---+-------+----+ | ||||||
|  | #      |       | | ||||||
|  | #  +---+-------+----+ | ||||||
|  | #  | veth0   veth1  | | ||||||
|  | #  |       |        |    host | ||||||
|  | #  |     bond0      | | ||||||
|  | #  +----------------+ | ||||||
|  | # | ||||||
|  | # We use veths instead of physical interfaces | ||||||
|  | sw="sw-$(mktemp -u XXXXXX)" | ||||||
|  | host="ns-$(mktemp -u XXXXXX)" | ||||||
|  | 
 | ||||||
|  | cleanup() | ||||||
|  | { | ||||||
|  | 	ip netns del $sw | ||||||
|  | 	ip netns del $host | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | trap cleanup 0 1 2 | ||||||
|  | 
 | ||||||
|  | ip netns add $sw | ||||||
|  | ip netns add $host | ||||||
|  | 
 | ||||||
|  | ip -n $host link add veth0 type veth peer name veth0 netns $sw | ||||||
|  | ip -n $host link add veth1 type veth peer name veth1 netns $sw | ||||||
|  | 
 | ||||||
|  | ip -n $sw link add br0 type bridge | ||||||
|  | ip -n $sw link set br0 up | ||||||
|  | sw_lladdr=$(ip -n $sw addr show br0 | awk '/fe80/{print $2}' | cut -d'/' -f1) | ||||||
|  | # sleep some time to make sure bridge lladdr pass DAD | ||||||
|  | sleep 2 | ||||||
|  | 
 | ||||||
|  | ip -n $host link add bond0 type bond mode 1 ns_ip6_target ${sw_lladdr} \ | ||||||
|  | 	arp_validate 3 arp_interval 1000 | ||||||
|  | # add a lladdr for bond to make sure there is a route to target | ||||||
|  | ip -n $host addr add fe80::beef/64 dev bond0 | ||||||
|  | ip -n $host link set bond0 up | ||||||
|  | ip -n $host link set veth0 master bond0 | ||||||
|  | ip -n $host link set veth1 master bond0 | ||||||
|  | 
 | ||||||
|  | ip -n $sw link set veth0 master br0 | ||||||
|  | ip -n $sw link set veth1 master br0 | ||||||
|  | ip -n $sw link set veth0 up | ||||||
|  | ip -n $sw link set veth1 up | ||||||
|  | 
 | ||||||
|  | sleep 5 | ||||||
|  | 
 | ||||||
|  | rc=0 | ||||||
|  | if ip -n $host link show bond0 | grep -q LOWER_UP; then | ||||||
|  | 	echo "PASS" | ||||||
|  | else | ||||||
|  | 	echo "FAIL" | ||||||
|  | 	rc=1 | ||||||
|  | fi | ||||||
|  | exit $rc | ||||||
		Loading…
	
		Reference in a new issue
	
	 Hangbin Liu
						Hangbin Liu