2 # SPDX-License-Identifier: GPL-2.0
4 # Test devlink-trap ACL drops functionality over mlxsw.
6 lib_dir
=$
(dirname $0)/..
/..
/..
/net
/forwarding
9 ingress_flow_action_drop_test
10 egress_flow_action_drop_test
13 source $lib_dir/tc_common.sh
14 source $lib_dir/lib.sh
15 source $lib_dir/devlink_lib.sh
39 ip link add dev br0
type bridge vlan_filtering
1 mcast_snooping
0
41 ip link
set dev
$swp1 master br0
42 ip link
set dev
$swp2 master br0
44 ip link
set dev br0 up
45 ip link
set dev
$swp1 up
46 ip link
set dev
$swp2 up
48 tc qdisc add dev
$swp1 clsact
49 tc qdisc add dev
$swp2 clsact
54 tc qdisc del dev
$swp2 clsact
55 tc qdisc del dev
$swp1 clsact
57 ip link
set dev
$swp2 down
58 ip link
set dev
$swp1 down
94 ingress_flow_action_drop_test
()
98 tc filter add dev
$swp2 egress protocol ip pref
1 handle
101 \
99 flower src_mac
$h1mac action pass
101 tc filter add dev
$swp1 ingress protocol ip pref
1 handle
101 \
102 flower dst_ip
192.0.2.2 action drop
104 $MZ $h1 -c 0 -p 100 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
110 devlink_trap_drop_test ingress_flow_action_drop
$swp2 101
112 log_test
"ingress_flow_action_drop"
114 tc filter del dev
$swp1 ingress protocol ip pref
1 handle
101 flower
116 devlink_trap_drop_cleanup
$mz_pid $swp2 ip
1 101
119 egress_flow_action_drop_test
()
123 tc filter add dev
$swp2 egress protocol ip pref
2 handle
102 \
124 flower src_mac
$h1mac action pass
126 tc filter add dev
$swp2 egress protocol ip pref
1 handle
101 \
127 flower dst_ip
192.0.2.2 action drop
129 $MZ $h1 -c 0 -p 100 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
135 devlink_trap_drop_test egress_flow_action_drop
$swp2 102
137 log_test
"egress_flow_action_drop"
139 tc filter del dev
$swp2 egress protocol ip pref
1 handle
101 flower
141 devlink_trap_drop_cleanup
$mz_pid $swp2 ip
2 102