2 # SPDX-License-Identifier: GPL-2.0
4 # Kselftest framework requirement - SKIP code is 4.
7 ALL_TESTS
="loopback_test"
14 simple_if_init
$h1 192.0.2.1/24
15 tc qdisc add dev
$h1 clsact
20 tc qdisc del dev
$h1 clsact
21 simple_if_fini
$h1 192.0.2.1/24
38 tc filter add dev
$h1 ingress protocol arp pref
1 handle
101 flower \
39 skip_hw arp_op reply arp_tip
192.0.2.1 action drop
41 $MZ $h1 -c 1 -t arp
-q
43 tc_check_packets
"dev $h1 ingress" 101 1
44 check_fail $?
"Matched on a filter without loopback setup"
46 ethtool
-K $h1 loopback on
47 check_err $?
"Failed to enable loopback"
51 $MZ $h1 -c 1 -t arp
-q
53 tc_check_packets
"dev $h1 ingress" 101 1
54 check_err $?
"Did not match on filter with loopback"
56 ethtool
-K $h1 loopback off
57 check_err $?
"Failed to disable loopback"
59 $MZ $h1 -c 1 -t arp
-q
61 tc_check_packets
"dev $h1 ingress" 101 2
62 check_fail $?
"Matched on a filter after loopback was removed"
64 tc filter del dev
$h1 ingress protocol arp pref
1 handle
101 flower
79 if ethtool
-k $h1 |
grep loopback |
grep -q fixed
; then
80 log_test
"SKIP: dev $h1 does not support loopback feature"