File tree Expand file tree Collapse file tree 1 file changed +35
-1
lines changed
tools/testing/selftests/net/forwarding Expand file tree Collapse file tree 1 file changed +35
-1
lines changed Original file line number Diff line number Diff line change 22# SPDX-License-Identifier: GPL-2.0
33
44ALL_TESTS=" match_dst_mac_test match_src_mac_test match_dst_ip_test \
5- match_src_ip_test match_ip_flags_test match_pcp_test match_vlan_test"
5+ match_src_ip_test match_ip_flags_test match_pcp_test match_vlan_test \
6+ match_ip_tos_test"
67NUM_NETIFS=2
78source tc_common.sh
89source lib.sh
@@ -276,6 +277,39 @@ match_vlan_test()
276277 log_test " VLAN match ($tcflags )"
277278}
278279
280+ match_ip_tos_test ()
281+ {
282+ RET=0
283+
284+ tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
285+ $tcflags dst_ip 192.0.2.2 ip_tos 0x20 action drop
286+ tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
287+ $tcflags dst_ip 192.0.2.2 ip_tos 0x18 action drop
288+
289+ $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
290+ -t ip tos=18 -q
291+
292+ tc_check_packets " dev $h2 ingress" 101 1
293+ check_fail $? " Matched on a wrong filter (0x18)"
294+
295+ tc_check_packets " dev $h2 ingress" 102 1
296+ check_err $? " Did not match on correct filter (0x18)"
297+
298+ $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
299+ -t ip tos=20 -q
300+
301+ tc_check_packets " dev $h2 ingress" 102 2
302+ check_fail $? " Matched on a wrong filter (0x20)"
303+
304+ tc_check_packets " dev $h2 ingress" 101 1
305+ check_err $? " Did not match on correct filter (0x20)"
306+
307+ tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
308+ tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
309+
310+ log_test " ip_tos match ($tcflags )"
311+ }
312+
279313setup_prepare ()
280314{
281315 h1=${NETIFS[p1]}
You can’t perform that action at this time.
0 commit comments