2 # SPDX-License-Identifier: GPL-2.0
8 simple_if_init
$h1 192.0.1.1/24
9 ip route add
193.0.0.0/8 via
192.0.1.2 dev
$h1
14 ip route del
193.0.0.0/8 via
192.0.1.2 dev
$h1
15 simple_if_fini
$h1 192.0.1.1/24
20 simple_if_init
$h2 192.0.2.1/24
21 tc qdisc add dev
$h2 handle ffff
: ingress
26 tc qdisc del dev
$h2 handle ffff
: ingress
27 simple_if_fini
$h2 192.0.2.1/24
32 ip link
set dev
$rp1 up
33 ip link
set dev
$rp2 up
35 ip address add
192.0.1.2/24 dev
$rp1
36 ip address add
192.0.2.2/24 dev
$rp2
41 ip address del
192.0.2.2/24 dev
$rp2
42 ip address del
192.0.1.2/24 dev
$rp1
44 ip link
set dev
$rp2 down
45 ip link
set dev
$rp1 down
48 router_setup_prepare
()
57 rp1mac
=$
(mac_get
$rp1)
67 router_offload_validate
()
72 offloaded_count
=$
(ip route |
grep -o 'offload' |
wc -l)
73 [[ $offloaded_count -ge $route_count ]]
76 router_routes_create
()
81 ROUTE_FILE
="$(mktemp)"
89 if [[ $count -eq $route_count ]]; then
93 echo route add
193.
${i}.${j}.${k}/32 via \
94 192.0.2.1 dev
$rp2 >> $ROUTE_FILE
100 ip
-b $ROUTE_FILE &> /dev
/null
103 router_routes_destroy
()
105 if [[ -v ROUTE_FILE
]]; then
118 router_routes_create
$route_count
120 router_offload_validate
$route_count
121 check_err_fail
$should_fail $?
"Offload of $route_count routes"
122 if [[ $RET -ne 0 ]] ||
[[ $should_fail -eq 1 ]]; then
126 tc filter add dev
$h2 ingress protocol ip pref
1 flower \
127 skip_sw dst_ip
193.0.0.0/8 action drop
135 if [[ $count -eq $route_count ]]; then
139 $MZ $h1 -c 1 -p 64 -a $h1mac -b $rp1mac \
140 -A 192.0.1.1 -B 193.
${i}.${j}.${k} \
147 tc_check_packets
"dev $h2 ingress" 1 $route_count
148 check_err $?
"Offload mismatch"
150 tc filter del dev
$h2 ingress protocol ip pref
1 flower \
151 skip_sw dst_ip
193.0.0.0/8 action drop
153 router_routes_destroy
160 router_routes_destroy