/
usr
/
src
/
linux-headers-5.15.0-181
/
tools
/
testing
/
selftests
/
net
/
forwarding
/
/usr/src/linux-headers-5.15.0-181/tools/testing/selftests/net/forwarding
mkdir
upload
Name
Size
Mode
Actions
bridge_igmp.sh
15152
0755
edit
dl
rm
bridge_mld.sh
16563
0755
edit
dl
rm
bridge_port_isolation.sh
2378
0755
edit
dl
rm
bridge_sticky_fdb.sh
1159
0755
edit
dl
rm
bridge_vlan_aware.sh
2524
0755
edit
dl
rm
bridge_vlan_unaware.sh
1248
0755
edit
dl
rm
custom_multipath_hash.sh
9993
0755
edit
dl
rm
devlink_lib.sh
13118
0644
edit
dl
rm
dual_vxlan_bridge.sh
11439
0755
edit
dl
rm
ethtool.sh
6745
0755
edit
dl
rm
ethtool_extended_state.sh
1923
0755
edit
dl
rm
ethtool_lib.sh
2815
0644
edit
dl
rm
fib_offload_lib.sh
25157
0644
edit
dl
rm
gre_custom_multipath_hash.sh
12768
0755
edit
dl
rm
gre_inner_v4_multipath.sh
7730
0755
edit
dl
rm
gre_inner_v6_multipath.sh
7843
0755
edit
dl
rm
gre_multipath.sh
6439
0755
edit
dl
rm
gre_multipath_nh.sh
9301
0755
edit
dl
rm
gre_multipath_nh_res.sh
9491
0755
edit
dl
rm
ip6gre_custom_multipath_hash.sh
13038
0755
edit
dl
rm
ip6gre_inner_v4_multipath.sh
7956
0755
edit
dl
rm
ip6gre_inner_v6_multipath.sh
8069
0755
edit
dl
rm
ip6_forward_instats_vrf.sh
3092
0755
edit
dl
rm
ipip_flat_gre.sh
838
0755
edit
dl
rm
ipip_flat_gre_key.sh
860
0755
edit
dl
rm
ipip_flat_gre_keys.sh
886
0755
edit
dl
rm
ipip_hier_gre.sh
887
0755
edit
dl
rm
ipip_hier_gre_key.sh
910
0755
edit
dl
rm
ipip_hier_gre_keys.sh
938
0755
edit
dl
rm
ipip_lib.sh
8557
0644
edit
dl
rm
lib.sh
28668
0644
edit
dl
rm
loopback.sh
1589
0755
edit
dl
rm
Makefile
1718
0644
edit
dl
rm
mirror_gre.sh
3366
0755
edit
dl
rm
mirror_gre_bound.sh
5929
0755
edit
dl
rm
mirror_gre_bridge_1d.sh
4504
0755
edit
dl
rm
mirror_gre_bridge_1d_vlan.sh
2717
0755
edit
dl
rm
mirror_gre_bridge_1q.sh
4380
0755
edit
dl
rm
mirror_gre_bridge_1q_lag.sh
7485
0755
edit
dl
rm
mirror_gre_changes.sh
5824
0755
edit
dl
rm
mirror_gre_flower.sh
2891
0755
edit
dl
rm
mirror_gre_lag_lacp.sh
7458
0755
edit
dl
rm
mirror_gre_lib.sh
2565
0644
edit
dl
rm
mirror_gre_neigh.sh
2338
0755
edit
dl
rm
mirror_gre_nh.sh
2974
0755
edit
dl
rm
mirror_gre_topo_lib.sh
3524
0644
edit
dl
rm
mirror_gre_vlan.sh
1715
0755
edit
dl
rm
mirror_gre_vlan_bridge_1q.sh
9117
0755
edit
dl
rm
mirror_lib.sh
2964
0644
edit
dl
rm
mirror_topo_lib.sh
2758
0644
edit
dl
rm
mirror_vlan.sh
2303
0755
edit
dl
rm
pedit_dsfield.sh
6789
0755
edit
dl
rm
pedit_l4port.sh
4564
0755
edit
dl
rm
q_in_vni.sh
10926
0755
edit
dl
rm
router.sh
6322
0755
edit
dl
rm
router_bridge.sh
1794
0755
edit
dl
rm
router_bridge_vlan.sh
2108
0755
edit
dl
rm
router_broadcast.sh
5142
0755
edit
dl
rm
router_mpath_nh.sh
9828
0755
edit
dl
rm
router_mpath_nh_res.sh
10223
0755
edit
dl
rm
router_multicast.sh
11597
0755
edit
dl
rm
router_multipath.sh
8449
0755
edit
dl
rm
router_nh.sh
2627
0755
edit
dl
rm
router_vid_1.sh
2153
0755
edit
dl
rm
sch_ets.sh
781
0755
edit
dl
rm
sch_ets_core.sh
7456
0644
edit
dl
rm
sch_ets_tests.sh
4044
0644
edit
dl
rm
sch_red.sh
11358
0755
edit
dl
rm
sch_tbf_core.sh
5140
0644
edit
dl
rm
sch_tbf_ets.sh
118
0755
edit
dl
rm
sch_tbf_etsprio.sh
711
0644
edit
dl
rm
sch_tbf_prio.sh
118
0755
edit
dl
rm
sch_tbf_root.sh
422
0755
edit
dl
rm
skbedit_priority.sh
3901
0755
edit
dl
rm
tc_actions.sh
6606
0755
edit
dl
rm
tc_chains.sh
4945
0755
edit
dl
rm
tc_common.sh
524
0644
edit
dl
rm
tc_flower.sh
21752
0755
edit
dl
rm
tc_flower_router.sh
3096
0755
edit
dl
rm
tc_mpls_l2vpn.sh
5146
0755
edit
dl
rm
tc_police.sh
12111
0755
edit
dl
rm
tc_shblocks.sh
2748
0755
edit
dl
rm
tc_vlan_modify.sh
3246
0755
edit
dl
rm
vxlan_asymmetric.sh
17978
0755
edit
dl
rm
vxlan_bridge_1d.sh
20863
0755
edit
dl
rm
vxlan_bridge_1d_port_8472.sh
172
0755
edit
dl
rm
vxlan_bridge_1q.sh
24053
0755
edit
dl
rm
vxlan_bridge_1q_port_8472.sh
172
0755
edit
dl
rm
vxlan_symmetric.sh
18488
0755
edit
dl
rm
Edit:
/usr/src/linux-headers-5.15.0-181/tools/testing/selftests/net/forwarding/pedit_dsfield.sh
(6789B)
#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # This test sends traffic from H1 to H2. Either on ingress of $swp1, or on # egress of $swp2, the traffic is acted upon by a pedit action. An ingress # filter installed on $h2 verifies that the packet looks like expected. # # +----------------------+ +----------------------+ # | H1 | | H2 | # | + $h1 | | $h2 + | # | | 192.0.2.1/28 | | 192.0.2.2/28 | | # +----|-----------------+ +----------------|-----+ # | | # +----|----------------------------------------------------------------|-----+ # | SW | | | # | +-|----------------------------------------------------------------|-+ | # | | + $swp1 BR $swp2 + | | # | +--------------------------------------------------------------------+ | # +---------------------------------------------------------------------------+ ALL_TESTS=" ping_ipv4 ping_ipv6 test_ip_dsfield test_ip_dscp test_ip_ecn test_ip_dscp_ecn test_ip6_dsfield test_ip6_dscp test_ip6_ecn " NUM_NETIFS=4 source lib.sh source tc_common.sh : ${HIT_TIMEOUT:=2000} # ms h1_create() { simple_if_init $h1 192.0.2.1/28 2001:db8:1::1/64 } h1_destroy() { simple_if_fini $h1 192.0.2.1/28 2001:db8:1::1/64 } h2_create() { simple_if_init $h2 192.0.2.2/28 2001:db8:1::2/64 tc qdisc add dev $h2 clsact } h2_destroy() { tc qdisc del dev $h2 clsact simple_if_fini $h2 192.0.2.2/28 2001:db8:1::2/64 } switch_create() { ip link add name br1 up type bridge vlan_filtering 1 ip link set dev $swp1 master br1 ip link set dev $swp1 up ip link set dev $swp2 master br1 ip link set dev $swp2 up tc qdisc add dev $swp1 clsact tc qdisc add dev $swp2 clsact } switch_destroy() { tc qdisc del dev $swp2 clsact tc qdisc del dev $swp1 clsact ip link set dev $swp2 down ip link set dev $swp2 nomaster ip link set dev $swp1 down ip link set dev $swp1 nomaster ip link del dev br1 } setup_prepare() { h1=${NETIFS[p1]} swp1=${NETIFS[p2]} swp2=${NETIFS[p3]} h2=${NETIFS[p4]} h2mac=$(mac_get $h2) vrf_prepare h1_create h2_create switch_create } cleanup() { pre_cleanup switch_destroy h2_destroy h1_destroy vrf_cleanup } ping_ipv4() { ping_test $h1 192.0.2.2 } ping_ipv6() { ping6_test $h1 2001:db8:1::2 } do_test_pedit_dsfield_common() { local pedit_locus=$1; shift local pedit_action=$1; shift local mz_flags=$1; shift RET=0 # TOS 125: DSCP 31, ECN 1. Used for testing that the relevant part is # overwritten when zero is selected. $MZ $mz_flags $h1 -c 10 -d 20msec -p 100 \ -a own -b $h2mac -q -t tcp tos=0x7d,sp=54321,dp=12345 local pkts pkts=$(busywait "$TC_HIT_TIMEOUT" until_counter_is ">= 10" \ tc_rule_handle_stats_get "dev $h2 ingress" 101) check_err $? "Expected to get 10 packets on test probe, but got $pkts." pkts=$(tc_rule_handle_stats_get "$pedit_locus" 101) ((pkts >= 10)) check_err $? "Expected to get 10 packets on pedit rule, but got $pkts." log_test "$pedit_locus pedit $pedit_action" } do_test_pedit_dsfield() { local pedit_locus=$1; shift local pedit_action=$1; shift local match_prot=$1; shift local match_flower=$1; shift local mz_flags=$1; shift local saddr=$1; shift local daddr=$1; shift tc filter add $pedit_locus handle 101 pref 1 \ flower action pedit ex munge $pedit_action tc filter add dev $h2 ingress handle 101 pref 1 prot $match_prot \ flower skip_hw $match_flower action pass do_test_pedit_dsfield_common "$pedit_locus" "$pedit_action" "$mz_flags" tc filter del dev $h2 ingress pref 1 tc filter del $pedit_locus pref 1 } do_test_ip_dsfield() { local locus=$1; shift local dsfield for dsfield in 0 1 2 3 128 252 253 254 255; do do_test_pedit_dsfield "$locus" \ "ip dsfield set $dsfield" \ ip "ip_tos $dsfield" \ "-A 192.0.2.1 -B 192.0.2.2" done } test_ip_dsfield() { do_test_ip_dsfield "dev $swp1 ingress" do_test_ip_dsfield "dev $swp2 egress" } do_test_ip_dscp() { local locus=$1; shift local dscp for dscp in 0 1 2 3 32 61 62 63; do do_test_pedit_dsfield "$locus" \ "ip dsfield set $((dscp << 2)) retain 0xfc" \ ip "ip_tos $(((dscp << 2) | 1))" \ "-A 192.0.2.1 -B 192.0.2.2" done } test_ip_dscp() { do_test_ip_dscp "dev $swp1 ingress" do_test_ip_dscp "dev $swp2 egress" } do_test_ip_ecn() { local locus=$1; shift local ecn for ecn in 0 1 2 3; do do_test_pedit_dsfield "$locus" \ "ip dsfield set $ecn retain 0x03" \ ip "ip_tos $((124 | $ecn))" \ "-A 192.0.2.1 -B 192.0.2.2" done } test_ip_ecn() { do_test_ip_ecn "dev $swp1 ingress" do_test_ip_ecn "dev $swp2 egress" } do_test_ip_dscp_ecn() { local locus=$1; shift tc filter add $locus handle 101 pref 1 \ flower action pedit ex munge ip dsfield set 124 retain 0xfc \ action pedit ex munge ip dsfield set 1 retain 0x03 tc filter add dev $h2 ingress handle 101 pref 1 prot ip \ flower skip_hw ip_tos 125 action pass do_test_pedit_dsfield_common "$locus" "set DSCP + set ECN" \ "-A 192.0.2.1 -B 192.0.2.2" tc filter del dev $h2 ingress pref 1 tc filter del $locus pref 1 } test_ip_dscp_ecn() { do_test_ip_dscp_ecn "dev $swp1 ingress" do_test_ip_dscp_ecn "dev $swp2 egress" } do_test_ip6_dsfield() { local locus=$1; shift local dsfield for dsfield in 0 1 2 3 128 252 253 254 255; do do_test_pedit_dsfield "$locus" \ "ip6 traffic_class set $dsfield" \ ipv6 "ip_tos $dsfield" \ "-6 -A 2001:db8:1::1 -B 2001:db8:1::2" done } test_ip6_dsfield() { do_test_ip6_dsfield "dev $swp1 ingress" do_test_ip6_dsfield "dev $swp2 egress" } do_test_ip6_dscp() { local locus=$1; shift local dscp for dscp in 0 1 2 3 32 61 62 63; do do_test_pedit_dsfield "$locus" \ "ip6 traffic_class set $((dscp << 2)) retain 0xfc" \ ipv6 "ip_tos $(((dscp << 2) | 1))" \ "-6 -A 2001:db8:1::1 -B 2001:db8:1::2" done } test_ip6_dscp() { do_test_ip6_dscp "dev $swp1 ingress" do_test_ip6_dscp "dev $swp2 egress" } do_test_ip6_ecn() { local locus=$1; shift local ecn for ecn in 0 1 2 3; do do_test_pedit_dsfield "$locus" \ "ip6 traffic_class set $ecn retain 0x3" \ ipv6 "ip_tos $((124 | $ecn))" \ "-6 -A 2001:db8:1::1 -B 2001:db8:1::2" done } test_ip6_ecn() { do_test_ip6_ecn "dev $swp1 ingress" do_test_ip6_ecn "dev $swp2 egress" } trap cleanup EXIT setup_prepare setup_wait tests_run exit $EXIT_STATUS
Save
cmd:
run