1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# 4# cause kernel oops in bond_rr_gen_slave_id 5DEBUG=${DEBUG:-0} 6 7set -e 8test ${DEBUG} -ne 0 && set -x 9 10finish() 11{ 12 ip netns delete server || true 13 ip netns delete client || true 14 ip link del link1_1 || true 15} 16 17trap finish EXIT 18 19client_ip4=192.168.1.198 20server_ip4=192.168.1.254 21 22# setup kernel so it reboots after causing the panic 23echo 180 >/proc/sys/kernel/panic 24 25# build namespaces 26ip link add dev link1_1 type veth peer name link1_2 27 28ip netns add "server" 29ip link set dev link1_2 netns server up name eth0 30ip netns exec server ip addr add ${server_ip4}/24 dev eth0 31 32ip netns add "client" 33ip link set dev link1_1 netns client down name eth0 34ip netns exec client ip link add dev bond0 down type bond mode 1 \ 35 miimon 100 all_slaves_active 1 36ip netns exec client ip link set dev eth0 down master bond0 37ip netns exec client ip link set dev bond0 up 38ip netns exec client ip addr add ${client_ip4}/24 dev bond0 39ip netns exec client ping -c 5 $server_ip4 >/dev/null 40 41ip netns exec client ip link set dev eth0 down nomaster 42ip netns exec client ip link set dev bond0 down 43ip netns exec client ip link set dev bond0 type bond mode 0 \ 44 arp_interval 1000 arp_ip_target "+${server_ip4}" 45ip netns exec client ip link set dev eth0 down master bond0 46ip netns exec client ip link set dev bond0 up 47ip netns exec client ping -c 5 $server_ip4 >/dev/null 48 49exit 0 50