1*236682dbSBreno Leitao#!/usr/bin/env bash 2*236682dbSBreno Leitao# SPDX-License-Identifier: GPL-2.0 3*236682dbSBreno Leitao# 4*236682dbSBreno Leitao# This selftest exercises trying to have multiple netpoll users at the same 5*236682dbSBreno Leitao# time. 6*236682dbSBreno Leitao# 7*236682dbSBreno Leitao# This selftest has multiple smalls test inside, and the goal is to 8*236682dbSBreno Leitao# get interfaces with bonding and netconsole in different orders in order 9*236682dbSBreno Leitao# to catch any possible issue. 10*236682dbSBreno Leitao# 11*236682dbSBreno Leitao# The main test composes of four interfaces being created using netdevsim; two 12*236682dbSBreno Leitao# of them are bonded to serve as the netconsole's transmit interface. The 13*236682dbSBreno Leitao# remaining two interfaces are similarly bonded and assigned to a separate 14*236682dbSBreno Leitao# network namespace, which acts as the receive interface, where socat monitors 15*236682dbSBreno Leitao# for incoming messages. 16*236682dbSBreno Leitao# 17*236682dbSBreno Leitao# A netconsole message is then sent to ensure it is properly received across 18*236682dbSBreno Leitao# this configuration. 19*236682dbSBreno Leitao# 20*236682dbSBreno Leitao# Later, run a few other tests, to make sure that bonding and netconsole 21*236682dbSBreno Leitao# cannot coexist. 22*236682dbSBreno Leitao# 23*236682dbSBreno Leitao# The test's objective is to exercise netpoll usage when managed simultaneously 24*236682dbSBreno Leitao# by multiple subsystems (netconsole and bonding). 25*236682dbSBreno Leitao# 26*236682dbSBreno Leitao# Author: Breno Leitao <leitao@debian.org> 27*236682dbSBreno Leitao 28*236682dbSBreno Leitaoset -euo pipefail 29*236682dbSBreno Leitao 30*236682dbSBreno LeitaoSCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")") 31*236682dbSBreno Leitao 32*236682dbSBreno Leitaosource "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh 33*236682dbSBreno Leitao 34*236682dbSBreno Leitaomodprobe netdevsim 2> /dev/null || true 35*236682dbSBreno Leitaomodprobe netconsole 2> /dev/null || true 36*236682dbSBreno Leitaomodprobe bonding 2> /dev/null || true 37*236682dbSBreno Leitaomodprobe veth 2> /dev/null || true 38*236682dbSBreno Leitao 39*236682dbSBreno Leitao# The content of kmsg will be save to the following file 40*236682dbSBreno LeitaoOUTPUT_FILE="/tmp/${TARGET}" 41*236682dbSBreno Leitao 42*236682dbSBreno Leitao# Check for basic system dependency and exit if not found 43*236682dbSBreno Leitaocheck_for_dependencies 44*236682dbSBreno Leitao# Set current loglevel to KERN_INFO(6), and default to KERN_NOTICE(5) 45*236682dbSBreno Leitaoecho "6 5" > /proc/sys/kernel/printk 46*236682dbSBreno Leitao# Remove the namespace, interfaces and netconsole target on exit 47*236682dbSBreno Leitaotrap cleanup_bond EXIT 48*236682dbSBreno Leitao 49*236682dbSBreno LeitaoFORMAT="extended" 50*236682dbSBreno LeitaoIP_VERSION="ipv4" 51*236682dbSBreno LeitaoVETH0="veth"$(( RANDOM % 256)) 52*236682dbSBreno LeitaoVETH1="veth"$((256 + RANDOM % 256)) 53*236682dbSBreno LeitaoTXNS="" 54*236682dbSBreno LeitaoRXNS="" 55*236682dbSBreno Leitao 56*236682dbSBreno Leitao# Create "bond_tx_XX" and "bond_rx_XX" interfaces, and set DSTIF and SRCIF with 57*236682dbSBreno Leitao# the bonding interfaces 58*236682dbSBreno Leitaofunction setup_bonding_ifaces() { 59*236682dbSBreno Leitao local RAND=$(( RANDOM % 100 )) 60*236682dbSBreno Leitao BOND_TX_MAIN_IF="bond_tx_$RAND" 61*236682dbSBreno Leitao BOND_RX_MAIN_IF="bond_rx_$RAND" 62*236682dbSBreno Leitao 63*236682dbSBreno Leitao # Setup TX 64*236682dbSBreno Leitao if ! ip -n "${TXNS}" link add "${BOND_TX_MAIN_IF}" type bond mode balance-rr 65*236682dbSBreno Leitao then 66*236682dbSBreno Leitao echo "Failed to create bond TX interface. Is CONFIG_BONDING set?" >&2 67*236682dbSBreno Leitao # only clean nsim ifaces and namespace. Nothing else has been 68*236682dbSBreno Leitao # initialized 69*236682dbSBreno Leitao cleanup_bond_nsim 70*236682dbSBreno Leitao trap - EXIT 71*236682dbSBreno Leitao exit "${ksft_skip}" 72*236682dbSBreno Leitao fi 73*236682dbSBreno Leitao 74*236682dbSBreno Leitao # create_netdevsim() got the interface up, but it needs to be down 75*236682dbSBreno Leitao # before being enslaved. 76*236682dbSBreno Leitao ip -n "${TXNS}" \ 77*236682dbSBreno Leitao link set "${BOND_TX1_SLAVE_IF}" down 78*236682dbSBreno Leitao ip -n "${TXNS}" \ 79*236682dbSBreno Leitao link set "${BOND_TX2_SLAVE_IF}" down 80*236682dbSBreno Leitao ip -n "${TXNS}" \ 81*236682dbSBreno Leitao link set "${BOND_TX1_SLAVE_IF}" master "${BOND_TX_MAIN_IF}" 82*236682dbSBreno Leitao ip -n "${TXNS}" \ 83*236682dbSBreno Leitao link set "${BOND_TX2_SLAVE_IF}" master "${BOND_TX_MAIN_IF}" 84*236682dbSBreno Leitao ip -n "${TXNS}" \ 85*236682dbSBreno Leitao link set "${BOND_TX_MAIN_IF}" up 86*236682dbSBreno Leitao 87*236682dbSBreno Leitao # Setup RX 88*236682dbSBreno Leitao ip -n "${RXNS}" \ 89*236682dbSBreno Leitao link add "${BOND_RX_MAIN_IF}" type bond mode balance-rr 90*236682dbSBreno Leitao ip -n "${RXNS}" \ 91*236682dbSBreno Leitao link set "${BOND_RX1_SLAVE_IF}" down 92*236682dbSBreno Leitao ip -n "${RXNS}" \ 93*236682dbSBreno Leitao link set "${BOND_RX2_SLAVE_IF}" down 94*236682dbSBreno Leitao ip -n "${RXNS}" \ 95*236682dbSBreno Leitao link set "${BOND_RX1_SLAVE_IF}" master "${BOND_RX_MAIN_IF}" 96*236682dbSBreno Leitao ip -n "${RXNS}" \ 97*236682dbSBreno Leitao link set "${BOND_RX2_SLAVE_IF}" master "${BOND_RX_MAIN_IF}" 98*236682dbSBreno Leitao ip -n "${RXNS}" \ 99*236682dbSBreno Leitao link set "${BOND_RX_MAIN_IF}" up 100*236682dbSBreno Leitao 101*236682dbSBreno Leitao export DSTIF="${BOND_RX_MAIN_IF}" 102*236682dbSBreno Leitao export SRCIF="${BOND_TX_MAIN_IF}" 103*236682dbSBreno Leitao} 104*236682dbSBreno Leitao 105*236682dbSBreno Leitao# Create 4 netdevsim interfaces. Two of them will be bound to TX bonding iface 106*236682dbSBreno Leitao# and the other two will be bond to the RX interface (on the other namespace) 107*236682dbSBreno Leitaofunction create_ifaces_bond() { 108*236682dbSBreno Leitao BOND_TX1_SLAVE_IF=$(create_netdevsim "${NSIM_BOND_TX_1}" "${TXNS}") 109*236682dbSBreno Leitao BOND_TX2_SLAVE_IF=$(create_netdevsim "${NSIM_BOND_TX_2}" "${TXNS}") 110*236682dbSBreno Leitao BOND_RX1_SLAVE_IF=$(create_netdevsim "${NSIM_BOND_RX_1}" "${RXNS}") 111*236682dbSBreno Leitao BOND_RX2_SLAVE_IF=$(create_netdevsim "${NSIM_BOND_RX_2}" "${RXNS}") 112*236682dbSBreno Leitao} 113*236682dbSBreno Leitao 114*236682dbSBreno Leitao# netdevsim link BOND_TX to BOND_RX interfaces 115*236682dbSBreno Leitaofunction link_ifaces_bond() { 116*236682dbSBreno Leitao local BOND_TX1_SLAVE_IFIDX 117*236682dbSBreno Leitao local BOND_TX2_SLAVE_IFIDX 118*236682dbSBreno Leitao local BOND_RX1_SLAVE_IFIDX 119*236682dbSBreno Leitao local BOND_RX2_SLAVE_IFIDX 120*236682dbSBreno Leitao local TXNS_FD 121*236682dbSBreno Leitao local RXNS_FD 122*236682dbSBreno Leitao 123*236682dbSBreno Leitao BOND_TX1_SLAVE_IFIDX=$(ip netns exec "${TXNS}" \ 124*236682dbSBreno Leitao cat /sys/class/net/"$BOND_TX1_SLAVE_IF"/ifindex) 125*236682dbSBreno Leitao BOND_TX2_SLAVE_IFIDX=$(ip netns exec "${TXNS}" \ 126*236682dbSBreno Leitao cat /sys/class/net/"$BOND_TX2_SLAVE_IF"/ifindex) 127*236682dbSBreno Leitao BOND_RX1_SLAVE_IFIDX=$(ip netns exec "${RXNS}" \ 128*236682dbSBreno Leitao cat /sys/class/net/"$BOND_RX1_SLAVE_IF"/ifindex) 129*236682dbSBreno Leitao BOND_RX2_SLAVE_IFIDX=$(ip netns exec "${RXNS}" \ 130*236682dbSBreno Leitao cat /sys/class/net/"$BOND_RX2_SLAVE_IF"/ifindex) 131*236682dbSBreno Leitao 132*236682dbSBreno Leitao exec {TXNS_FD}</var/run/netns/"${TXNS}" 133*236682dbSBreno Leitao exec {RXNS_FD}</var/run/netns/"${RXNS}" 134*236682dbSBreno Leitao 135*236682dbSBreno Leitao # Linking TX ifaces to the RX ones (on the other namespace) 136*236682dbSBreno Leitao echo "${TXNS_FD}:$BOND_TX1_SLAVE_IFIDX $RXNS_FD:$BOND_RX1_SLAVE_IFIDX" \ 137*236682dbSBreno Leitao > "$NSIM_DEV_SYS_LINK" 138*236682dbSBreno Leitao echo "${TXNS_FD}:$BOND_TX2_SLAVE_IFIDX $RXNS_FD:$BOND_RX2_SLAVE_IFIDX" \ 139*236682dbSBreno Leitao > "$NSIM_DEV_SYS_LINK" 140*236682dbSBreno Leitao 141*236682dbSBreno Leitao exec {TXNS_FD}<&- 142*236682dbSBreno Leitao exec {RXNS_FD}<&- 143*236682dbSBreno Leitao} 144*236682dbSBreno Leitao 145*236682dbSBreno Leitaofunction create_all_ifaces() { 146*236682dbSBreno Leitao # setup_ns function is coming from lib.sh 147*236682dbSBreno Leitao setup_ns TXNS RXNS 148*236682dbSBreno Leitao export NAMESPACE="${RXNS}" 149*236682dbSBreno Leitao 150*236682dbSBreno Leitao # Create two interfaces for RX and two for TX 151*236682dbSBreno Leitao create_ifaces_bond 152*236682dbSBreno Leitao # Link netlink ifaces 153*236682dbSBreno Leitao link_ifaces_bond 154*236682dbSBreno Leitao} 155*236682dbSBreno Leitao 156*236682dbSBreno Leitao# configure DSTIF and SRCIF IPs 157*236682dbSBreno Leitaofunction configure_ifaces_ips() { 158*236682dbSBreno Leitao local IP_VERSION=${1:-"ipv4"} 159*236682dbSBreno Leitao select_ipv4_or_ipv6 "${IP_VERSION}" 160*236682dbSBreno Leitao 161*236682dbSBreno Leitao ip -n "${RXNS}" addr add "${DSTIP}"/24 dev "${DSTIF}" 162*236682dbSBreno Leitao ip -n "${RXNS}" link set "${DSTIF}" up 163*236682dbSBreno Leitao 164*236682dbSBreno Leitao ip -n "${TXNS}" addr add "${SRCIP}"/24 dev "${SRCIF}" 165*236682dbSBreno Leitao ip -n "${TXNS}" link set "${SRCIF}" up 166*236682dbSBreno Leitao} 167*236682dbSBreno Leitao 168*236682dbSBreno Leitaofunction test_enable_netpoll_on_enslaved_iface() { 169*236682dbSBreno Leitao echo 0 > "${NETCONS_PATH}"/enabled 170*236682dbSBreno Leitao 171*236682dbSBreno Leitao # At this stage, BOND_TX1_SLAVE_IF is enslaved to BOND_TX_MAIN_IF, and 172*236682dbSBreno Leitao # linked to BOND_RX1_SLAVE_IF inside the namespace. 173*236682dbSBreno Leitao echo "${BOND_TX1_SLAVE_IF}" > "${NETCONS_PATH}"/dev_name 174*236682dbSBreno Leitao 175*236682dbSBreno Leitao # This should fail with the following message in dmesg: 176*236682dbSBreno Leitao # netpoll: netconsole: ethX is a slave device, aborting 177*236682dbSBreno Leitao set +e 178*236682dbSBreno Leitao enable_netcons_ns 2> /dev/null 179*236682dbSBreno Leitao set -e 180*236682dbSBreno Leitao 181*236682dbSBreno Leitao if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 1 ]] 182*236682dbSBreno Leitao then 183*236682dbSBreno Leitao echo "test failed: Bonding and netpoll cannot co-exists." >&2 184*236682dbSBreno Leitao exit "${ksft_fail}" 185*236682dbSBreno Leitao fi 186*236682dbSBreno Leitao} 187*236682dbSBreno Leitao 188*236682dbSBreno Leitaofunction test_delete_bond_and_reenable_target() { 189*236682dbSBreno Leitao ip -n "${TXNS}" \ 190*236682dbSBreno Leitao link delete "${BOND_TX_MAIN_IF}" type bond 191*236682dbSBreno Leitao 192*236682dbSBreno Leitao # BOND_TX1_SLAVE_IF is not attached to a bond interface anymore 193*236682dbSBreno Leitao # netpoll can be plugged in there 194*236682dbSBreno Leitao echo "${BOND_TX1_SLAVE_IF}" > "${NETCONS_PATH}"/dev_name 195*236682dbSBreno Leitao 196*236682dbSBreno Leitao # this should work, since the interface is not enslaved 197*236682dbSBreno Leitao enable_netcons_ns 198*236682dbSBreno Leitao 199*236682dbSBreno Leitao if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 0 ]] 200*236682dbSBreno Leitao then 201*236682dbSBreno Leitao echo "test failed: Unable to start netpoll on an unbond iface." >&2 202*236682dbSBreno Leitao exit "${ksft_fail}" 203*236682dbSBreno Leitao fi 204*236682dbSBreno Leitao} 205*236682dbSBreno Leitao 206*236682dbSBreno Leitao# Send a netconsole message to the netconsole target 207*236682dbSBreno Leitaofunction test_send_netcons_msg_through_bond_iface() { 208*236682dbSBreno Leitao # Listen for netconsole port inside the namespace and 209*236682dbSBreno Leitao # destination interface 210*236682dbSBreno Leitao listen_port_and_save_to "${OUTPUT_FILE}" "${IP_VERSION}" & 211*236682dbSBreno Leitao # Wait for socat to start and listen to the port. 212*236682dbSBreno Leitao wait_for_port "${RXNS}" "${PORT}" "${IP_VERSION}" 213*236682dbSBreno Leitao # Send the message 214*236682dbSBreno Leitao echo "${MSG}: ${TARGET}" > /dev/kmsg 215*236682dbSBreno Leitao # Wait until socat saves the file to disk 216*236682dbSBreno Leitao busywait "${BUSYWAIT_TIMEOUT}" test -s "${OUTPUT_FILE}" 217*236682dbSBreno Leitao # Make sure the message was received in the dst part 218*236682dbSBreno Leitao # and exit 219*236682dbSBreno Leitao validate_result "${OUTPUT_FILE}" "${FORMAT}" 220*236682dbSBreno Leitao # kill socat in case it is still running 221*236682dbSBreno Leitao pkill_socat 222*236682dbSBreno Leitao} 223*236682dbSBreno Leitao 224*236682dbSBreno Leitao# BOND_TX1_SLAVE_IF has netconsole enabled on it, bind it to BOND_TX_MAIN_IF. 225*236682dbSBreno Leitao# Given BOND_TX_MAIN_IF was deleted, recreate it first 226*236682dbSBreno Leitaofunction test_enslave_netcons_enabled_iface { 227*236682dbSBreno Leitao # netconsole got disabled while the interface was down 228*236682dbSBreno Leitao if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 0 ]] 229*236682dbSBreno Leitao then 230*236682dbSBreno Leitao echo "test failed: netconsole expected to be enabled against BOND_TX1_SLAVE_IF" >&2 231*236682dbSBreno Leitao exit "${ksft_fail}" 232*236682dbSBreno Leitao fi 233*236682dbSBreno Leitao 234*236682dbSBreno Leitao # recreate the bonding iface. it got deleted by previous 235*236682dbSBreno Leitao # test (test_delete_bond_and_reenable_target) 236*236682dbSBreno Leitao ip -n "${TXNS}" \ 237*236682dbSBreno Leitao link add "${BOND_TX_MAIN_IF}" type bond mode balance-rr 238*236682dbSBreno Leitao 239*236682dbSBreno Leitao # sub-interface need to be down before attaching to bonding 240*236682dbSBreno Leitao # This will also disable netconsole. 241*236682dbSBreno Leitao ip -n "${TXNS}" \ 242*236682dbSBreno Leitao link set "${BOND_TX1_SLAVE_IF}" down 243*236682dbSBreno Leitao ip -n "${TXNS}" \ 244*236682dbSBreno Leitao link set "${BOND_TX1_SLAVE_IF}" master "${BOND_TX_MAIN_IF}" 245*236682dbSBreno Leitao ip -n "${TXNS}" \ 246*236682dbSBreno Leitao link set "${BOND_TX_MAIN_IF}" up 247*236682dbSBreno Leitao 248*236682dbSBreno Leitao # netconsole got disabled while the interface was down 249*236682dbSBreno Leitao if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 1 ]] 250*236682dbSBreno Leitao then 251*236682dbSBreno Leitao echo "test failed: Device is part of a bond iface, cannot have netcons enabled" >&2 252*236682dbSBreno Leitao exit "${ksft_fail}" 253*236682dbSBreno Leitao fi 254*236682dbSBreno Leitao} 255*236682dbSBreno Leitao 256*236682dbSBreno Leitao# Get netconsole enabled on a bonding interface and attach a second 257*236682dbSBreno Leitao# sub-interface. 258*236682dbSBreno Leitaofunction test_enslave_iface_to_bond { 259*236682dbSBreno Leitao # BOND_TX_MAIN_IF has only BOND_TX1_SLAVE_IF right now 260*236682dbSBreno Leitao echo "${BOND_TX_MAIN_IF}" > "${NETCONS_PATH}"/dev_name 261*236682dbSBreno Leitao enable_netcons_ns 262*236682dbSBreno Leitao 263*236682dbSBreno Leitao # netcons is attached to bond0 and BOND_TX1_SLAVE_IF is 264*236682dbSBreno Leitao # part of BOND_TX_MAIN_IF. Attach BOND_TX2_SLAVE_IF to BOND_TX_MAIN_IF. 265*236682dbSBreno Leitao ip -n "${TXNS}" \ 266*236682dbSBreno Leitao link set "${BOND_TX2_SLAVE_IF}" master "${BOND_TX_MAIN_IF}" 267*236682dbSBreno Leitao if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 0 ]] 268*236682dbSBreno Leitao then 269*236682dbSBreno Leitao echo "test failed: Netconsole should be enabled on bonding interface. Failed" >&2 270*236682dbSBreno Leitao exit "${ksft_fail}" 271*236682dbSBreno Leitao fi 272*236682dbSBreno Leitao} 273*236682dbSBreno Leitao 274*236682dbSBreno Leitaofunction test_enslave_iff_disabled_netpoll_iface { 275*236682dbSBreno Leitao local ret 276*236682dbSBreno Leitao 277*236682dbSBreno Leitao # Create two interfaces. veth interfaces it known to have 278*236682dbSBreno Leitao # IFF_DISABLE_NETPOLL set 279*236682dbSBreno Leitao if ! ip link add "${VETH0}" type veth peer name "${VETH1}" 280*236682dbSBreno Leitao then 281*236682dbSBreno Leitao echo "Failed to create veth TX interface. Is CONFIG_VETH set?" >&2 282*236682dbSBreno Leitao exit "${ksft_skip}" 283*236682dbSBreno Leitao fi 284*236682dbSBreno Leitao set +e 285*236682dbSBreno Leitao # This will print RTNETLINK answers: Device or resource busy 286*236682dbSBreno Leitao ip link set "${VETH0}" master "${BOND_TX_MAIN_IF}" 2> /dev/null 287*236682dbSBreno Leitao ret=$? 288*236682dbSBreno Leitao set -e 289*236682dbSBreno Leitao if [[ $ret -eq 0 ]] 290*236682dbSBreno Leitao then 291*236682dbSBreno Leitao echo "test failed: veth interface could not be enslaved" 292*236682dbSBreno Leitao exit "${ksft_fail}" 293*236682dbSBreno Leitao fi 294*236682dbSBreno Leitao} 295*236682dbSBreno Leitao 296*236682dbSBreno Leitao# Given that netconsole picks the current net namespace, we need to enable it 297*236682dbSBreno Leitao# from inside the TXNS namespace 298*236682dbSBreno Leitaofunction enable_netcons_ns() { 299*236682dbSBreno Leitao ip netns exec "${TXNS}" sh -c \ 300*236682dbSBreno Leitao "mount -t configfs configfs /sys/kernel/config && echo 1 > $NETCONS_PATH/enabled" 301*236682dbSBreno Leitao} 302*236682dbSBreno Leitao 303*236682dbSBreno Leitao#################### 304*236682dbSBreno Leitao# Tests start here # 305*236682dbSBreno Leitao#################### 306*236682dbSBreno Leitao 307*236682dbSBreno Leitao# Create regular interfaces using netdevsim and link them 308*236682dbSBreno Leitaocreate_all_ifaces 309*236682dbSBreno Leitao 310*236682dbSBreno Leitao# Setup the bonding interfaces 311*236682dbSBreno Leitao# BOND_RX_MAIN_IF has BOND_RX{1,2}_SLAVE_IF 312*236682dbSBreno Leitao# BOND_TX_MAIN_IF has BOND_TX{1,2}_SLAVE_IF 313*236682dbSBreno Leitaosetup_bonding_ifaces 314*236682dbSBreno Leitao 315*236682dbSBreno Leitao# Configure the ips as BOND_RX1_SLAVE_IF and BOND_TX1_SLAVE_IF 316*236682dbSBreno Leitaoconfigure_ifaces_ips "${IP_VERSION}" 317*236682dbSBreno Leitao 318*236682dbSBreno Leitao_create_dynamic_target "${FORMAT}" "${NETCONS_PATH}" 319*236682dbSBreno Leitaoenable_netcons_ns 320*236682dbSBreno Leitaoset_user_data 321*236682dbSBreno Leitao 322*236682dbSBreno Leitao# Test #1 : Create an bonding interface and attach netpoll into 323*236682dbSBreno Leitao# the bonding interface. Netconsole/netpoll should work on 324*236682dbSBreno Leitao# the bonding interface. 325*236682dbSBreno Leitaotest_send_netcons_msg_through_bond_iface 326*236682dbSBreno Leitaoecho "test #1: netpoll on bonding interface worked. Test passed" >&2 327*236682dbSBreno Leitao 328*236682dbSBreno Leitao# Test #2: Attach netpoll to an enslaved interface 329*236682dbSBreno Leitao# Try to attach netpoll to an enslaved sub-interface (while still being part of 330*236682dbSBreno Leitao# a bonding interface), which shouldn't be allowed 331*236682dbSBreno Leitaotest_enable_netpoll_on_enslaved_iface 332*236682dbSBreno Leitaoecho "test #2: netpoll correctly rejected enslaved interface (expected behavior). Test passed." >&2 333*236682dbSBreno Leitao 334*236682dbSBreno Leitao# Test #3: Unplug the sub-interface from bond and enable netconsole 335*236682dbSBreno Leitao# Detach the interface from a bonding interface and attach netpoll again 336*236682dbSBreno Leitaotest_delete_bond_and_reenable_target 337*236682dbSBreno Leitaoecho "test #3: Able to attach to an unbound interface. Test passed." >&2 338*236682dbSBreno Leitao 339*236682dbSBreno Leitao# Test #4: Enslave a sub-interface that had netconsole enabled 340*236682dbSBreno Leitao# Try to enslave an interface that has netconsole/netpoll enabled. 341*236682dbSBreno Leitao# Previous test has netconsole enabled in BOND_TX1_SLAVE_IF, try to enslave it 342*236682dbSBreno Leitaotest_enslave_netcons_enabled_iface 343*236682dbSBreno Leitaoecho "test #4: Enslaving an interface with netpoll attached. Test passed." >&2 344*236682dbSBreno Leitao 345*236682dbSBreno Leitao# Test #5: Enslave a sub-interface to a bonding interface 346*236682dbSBreno Leitao# Enslave an interface to a bond interface that has netpoll attached 347*236682dbSBreno Leitao# At this stage, BOND_TX_MAIN_IF is created and BOND_TX1_SLAVE_IF is part of 348*236682dbSBreno Leitao# it. Netconsole is currently disabled 349*236682dbSBreno Leitaotest_enslave_iface_to_bond 350*236682dbSBreno Leitaoecho "test #5: Enslaving an interface to bond+netpoll. Test passed." >&2 351*236682dbSBreno Leitao 352*236682dbSBreno Leitao# Test #6: Enslave a IFF_DISABLE_NETPOLL sub-interface to a bonding interface 353*236682dbSBreno Leitao# At this stage, BOND_TX_MAIN_IF has both sub interface and netconsole is 354*236682dbSBreno Leitao# enabled. This test will try to enslave an a veth (IFF_DISABLE_NETPOLL) interface 355*236682dbSBreno Leitao# and it should fail, with netpoll: veth0 doesn't support polling 356*236682dbSBreno Leitaotest_enslave_iff_disabled_netpoll_iface 357*236682dbSBreno Leitaoecho "test #6: Enslaving IFF_DISABLE_NETPOLL ifaces to bond iface is not supported. Test passed." >&2 358*236682dbSBreno Leitao 359*236682dbSBreno Leitaocleanup_bond 360*236682dbSBreno Leitaotrap - EXIT 361*236682dbSBreno Leitaoexit "${EXIT_STATUS}" 362