Skip to content

Commit

Permalink
selftests: add vlan hw filter tests
Browse files Browse the repository at this point in the history
Add one basic vlan hw filter test.

Signed-off-by: Liu Jian <liujian56@huawei.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Liu Jian authored and Paolo Abeni committed Dec 19, 2023
1 parent 01a564b commit 2258b66
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/testing/selftests/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ TEST_PROGS += test_bridge_neigh_suppress.sh
TEST_PROGS += test_vxlan_nolocalbypass.sh
TEST_PROGS += test_bridge_backup_port.sh
TEST_PROGS += fdb_flush.sh
TEST_PROGS += vlan_hw_filter.sh

TEST_FILES := settings

Expand Down
29 changes: 29 additions & 0 deletions tools/testing/selftests/net/vlan_hw_filter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0

readonly NETNS="ns-$(mktemp -u XXXXXX)"

ret=0

cleanup() {
ip netns del $NETNS
}

trap cleanup EXIT

fail() {
echo "ERROR: ${1:-unexpected return code} (ret: $_)" >&2
ret=1
}

ip netns add ${NETNS}
ip netns exec ${NETNS} ip link add bond0 type bond mode 0
ip netns exec ${NETNS} ip link add bond_slave_1 type veth peer veth2
ip netns exec ${NETNS} ip link set bond_slave_1 master bond0
ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
ip netns exec ${NETNS} ip link add link bond_slave_1 name bond_slave_1.0 type vlan id 0
ip netns exec ${NETNS} ip link add link bond0 name bond0.0 type vlan id 0
ip netns exec ${NETNS} ip link set bond_slave_1 nomaster
ip netns exec ${NETNS} ip link del veth2 || fail "Please check vlan HW filter function"

exit $ret

0 comments on commit 2258b66

Please sign in to comment.