2 # SPDX-License-Identifier: GPL-2.0
4 ALL_TESTS
="tunnel_key_nofrag_test"
14 simple_if_init
$h1 192.0.2.1/24
17 tunnel_create h1-et vxlan
192.0.2.1 192.0.2.2 dev
$h1 dstport
0 external
18 tc qdisc add dev h1-et clsact
26 tc qdisc del dev h1-et clsact
30 simple_if_fini
$h1 192.0.2.1/24
35 simple_if_init
$h2 192.0.2.2/24
40 simple_if_fini
$h2 192.0.2.2/24
45 simple_if_init
$swp1 192.0.2.2/24
46 tc qdisc add dev
$swp1 clsact
47 simple_if_init
$swp2 192.0.2.1/24
52 simple_if_fini
$swp2 192.0.2.1/24
53 tc qdisc del dev
$swp1 clsact
54 simple_if_fini
$swp1 192.0.2.2/24
68 swp1origmac
=$
(mac_get
$swp1)
69 swp2origmac
=$
(mac_get
$swp2)
70 ip link
set $swp1 address
$h2mac
71 ip link
set $swp2 address
$h1mac
79 if ! tc action add action tunnel_key
help 2>&1 |
grep -q nofrag
; then
80 log_test
"SKIP: iproute doesn't support nofrag"
95 ip link
set $swp2 address
$swp2origmac
96 ip link
set $swp1 address
$swp1origmac
99 tunnel_key_nofrag_test
()
104 tc filter add dev
$swp1 ingress protocol ip pref
100 handle
100 \
105 flower src_ip
192.0.2.1 dst_ip
192.0.2.2 ip_proto udp \
106 ip_flags nofrag action drop
107 tc filter add dev
$swp1 ingress protocol ip pref
101 handle
101 \
108 flower src_ip
192.0.2.1 dst_ip
192.0.2.2 ip_proto udp \
109 ip_flags firstfrag action drop
110 tc filter add dev
$swp1 ingress protocol ip pref
102 handle
102 \
111 flower src_ip
192.0.2.1 dst_ip
192.0.2.2 ip_proto udp \
112 ip_flags nofirstfrag action drop
115 tc filter add dev h1-et egress protocol all pref
1 handle
1 matchall
$tcflags \
116 action tunnel_key
set src_ip
192.0.2.1 dst_ip
192.0.2.2 id
42 nofrag index
10
117 $MZ h1-et
-c 1 -p 930 -a 00:aa
:bb
:cc
:dd:ee
-b 00:ee
:dd:cc
:bb
:aa
-t ip
-q
118 tc_check_packets
"dev $swp1 ingress" 100 1
119 check_err $?
"packet smaller than MTU was not tunneled"
121 $MZ h1-et
-c 1 -p 931 -a 00:aa
:bb
:cc
:dd:ee
-b 00:ee
:dd:cc
:bb
:aa
-t ip
-q
122 tc_check_packets
"dev $swp1 ingress" 100 1
123 check_err $?
"packet bigger than MTU matched nofrag (nofrag was set)"
124 tc_check_packets
"dev $swp1 ingress" 101 0
125 check_err $?
"packet bigger than MTU matched firstfrag (nofrag was set)"
126 tc_check_packets
"dev $swp1 ingress" 102 0
127 check_err $?
"packet bigger than MTU matched nofirstfrag (nofrag was set)"
129 # test 'nofrag' cleared
130 tc actions change action tunnel_key
set src_ip
192.0.2.1 dst_ip
192.0.2.2 id
42 index
10
131 $MZ h1-et
-c 1 -p 931 -a 00:aa
:bb
:cc
:dd:ee
-b 00:ee
:dd:cc
:bb
:aa
-t ip
-q
132 tc_check_packets
"dev $swp1 ingress" 100 1
133 check_err $?
"packet bigger than MTU matched nofrag (nofrag was unset)"
134 tc_check_packets
"dev $swp1 ingress" 101 1
135 check_err $?
"packet bigger than MTU didn't match firstfrag (nofrag was unset) "
136 tc_check_packets
"dev $swp1 ingress" 102 1
137 check_err $?
"packet bigger than MTU didn't match nofirstfrag (nofrag was unset) "
139 for i
in 100 101 102; do
140 tc filter del dev
$swp1 ingress protocol ip pref
$i handle
$i flower
142 tc filter del dev h1-et egress pref
1 handle
1 matchall
144 log_test
"tunnel_key nofrag ($tcflags)"
155 if [[ $?
-ne 0 ]]; then
156 log_info
"Could not test offloaded functionality"