cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

extack.sh (3471B)


      1#!/bin/bash
      2# SPDX-License-Identifier: GPL-2.0
      3#
      4# Test operations that we expect to report extended ack.
      5
      6lib_dir=$(dirname $0)/../../../net/forwarding
      7
      8ALL_TESTS="
      9	netdev_pre_up_test
     10	vxlan_vlan_add_test
     11	vxlan_bridge_create_test
     12	bridge_create_test
     13"
     14NUM_NETIFS=2
     15source $lib_dir/lib.sh
     16
     17setup_prepare()
     18{
     19	swp1=${NETIFS[p1]}
     20	swp2=${NETIFS[p2]}
     21
     22	ip link set dev $swp1 up
     23	ip link set dev $swp2 up
     24}
     25
     26cleanup()
     27{
     28	pre_cleanup
     29
     30	ip link set dev $swp2 down
     31	ip link set dev $swp1 down
     32}
     33
     34netdev_pre_up_test()
     35{
     36	RET=0
     37
     38	ip link add name br1 up type bridge vlan_filtering 0 mcast_snooping 0
     39	ip link add name vx1 up type vxlan id 1000 \
     40		local 192.0.2.17 remote 192.0.2.18 \
     41		dstport 4789 nolearning noudpcsum tos inherit ttl 100
     42
     43	ip link set dev vx1 master br1
     44	check_err $?
     45
     46	ip link set dev $swp1 master br1
     47	check_err $?
     48
     49	ip link add name br2 up type bridge vlan_filtering 0 mcast_snooping 0
     50	ip link add name vx2 up type vxlan id 2000 \
     51		local 192.0.2.17 remote 192.0.2.18 \
     52		dstport 4789 nolearning noudpcsum tos inherit ttl 100
     53
     54	ip link set dev vx2 master br2
     55	check_err $?
     56
     57	ip link set dev $swp2 master br2
     58	check_err $?
     59
     60	# Unsupported configuration: mlxsw demands that all offloaded VXLAN
     61	# devices have the same TTL.
     62	ip link set dev vx2 down
     63	ip link set dev vx2 type vxlan ttl 200
     64
     65	ip link set dev vx2 up &>/dev/null
     66	check_fail $?
     67
     68	ip link set dev vx2 up 2>&1 >/dev/null | grep -q mlxsw_spectrum
     69	check_err $?
     70
     71	log_test "extack - NETDEV_PRE_UP"
     72
     73	ip link del dev vx2
     74	ip link del dev br2
     75
     76	ip link del dev vx1
     77	ip link del dev br1
     78}
     79
     80vxlan_vlan_add_test()
     81{
     82	RET=0
     83
     84	ip link add name br1 up type bridge vlan_filtering 1 mcast_snooping 0
     85
     86	# Unsupported configuration: mlxsw demands VXLAN with "noudpcsum".
     87	ip link add name vx1 up type vxlan id 1000 \
     88		local 192.0.2.17 remote 192.0.2.18 \
     89		dstport 4789 tos inherit ttl 100
     90
     91	ip link set dev vx1 master br1
     92	check_err $?
     93
     94	bridge vlan add dev vx1 vid 1
     95	check_err $?
     96
     97	ip link set dev $swp1 master br1
     98	check_err $?
     99
    100	bridge vlan add dev vx1 vid 1 pvid untagged 2>&1 >/dev/null \
    101		| grep -q mlxsw_spectrum
    102	check_err $?
    103
    104	log_test "extack - map VLAN at VXLAN device"
    105
    106	ip link del dev vx1
    107	ip link del dev br1
    108}
    109
    110vxlan_bridge_create_test()
    111{
    112	RET=0
    113
    114	# Unsupported configuration: mlxsw demands VXLAN with "noudpcsum".
    115	ip link add name vx1 up type vxlan id 1000 \
    116		local 192.0.2.17 remote 192.0.2.18 \
    117		dstport 4789 tos inherit ttl 100
    118
    119	# Test with VLAN-aware bridge.
    120	ip link add name br1 up type bridge vlan_filtering 1 mcast_snooping 0
    121
    122	ip link set dev vx1 master br1
    123
    124	ip link set dev $swp1 master br1 2>&1 > /dev/null \
    125		| grep -q mlxsw_spectrum
    126	check_err $?
    127
    128	# Test with VLAN-unaware bridge.
    129	ip link set dev br1 type bridge vlan_filtering 0
    130
    131	ip link set dev $swp1 master br1 2>&1 > /dev/null \
    132		| grep -q mlxsw_spectrum
    133	check_err $?
    134
    135	log_test "extack - bridge creation with VXLAN"
    136
    137	ip link del dev br1
    138	ip link del dev vx1
    139}
    140
    141bridge_create_test()
    142{
    143	RET=0
    144
    145	ip link add name br1 up type bridge vlan_filtering 1
    146	ip link add name br2 up type bridge vlan_filtering 1
    147
    148	ip link set dev $swp1 master br1
    149	check_err $?
    150
    151	# Only one VLAN-aware bridge is supported, so this should fail with
    152	# an extack.
    153	ip link set dev $swp2 master br2 2>&1 > /dev/null \
    154		| grep -q mlxsw_spectrum
    155	check_err $?
    156
    157	log_test "extack - multiple VLAN-aware bridges creation"
    158
    159	ip link del dev br2
    160	ip link del dev br1
    161}
    162
    163trap cleanup EXIT
    164
    165setup_prepare
    166setup_wait
    167
    168tests_run
    169
    170exit $EXIT_STATUS