2 # SPDX-License-Identifier: GPL-2.0
5 : ${TIMEOUT:=20000} # ms
9 simple_if_init
$h1 192.0.1.1/24
14 simple_if_fini
$h1 192.0.1.1/24
19 simple_if_init
$h2 192.0.2.1/24
20 tc qdisc add dev
$h2 handle ffff
: ingress
25 tc qdisc del dev
$h2 handle ffff
: ingress
26 simple_if_fini
$h2 192.0.2.1/24
31 ip link
set dev
$rp1 up
32 ip link
set dev
$rp2 up
34 ip address add
192.0.1.2/24 dev
$rp1
35 ip address add
192.0.2.2/24 dev
$rp2
40 ip address del
192.0.2.2/24 dev
$rp2
41 ip address del
192.0.1.2/24 dev
$rp1
43 ip link
set dev
$rp2 down
44 ip link
set dev
$rp1 down
47 router_setup_prepare
()
56 rp1mac
=$
(mac_get
$rp1)
69 local route_count
=$1; shift
71 local t1
=$
(ip route |
grep -o 'offload' |
wc -l)
72 local delta
=$
((t1
- t0
))
74 [[ $delta -ge $route_count ]]
77 router_routes_create
()
82 ROUTE_FILE
="$(mktemp)"
90 if [[ $count -eq $route_count ]]; then
94 echo route add
193.
${i}.${j}.${k}/32 dev
$rp2 \
101 ip
-b $ROUTE_FILE &> /dev
/null
104 router_routes_destroy
()
106 if [[ -v ROUTE_FILE
]]; then
119 local t0
=$
(ip route |
grep -o 'offload' |
wc -l)
120 router_routes_create
$route_count
121 delta
=$
(busywait
"$TIMEOUT" wait_for_routes
$t0 $route_count)
123 check_err_fail
$should_fail $?
"Offload routes: Expected $route_count, got $delta."
124 if [[ $RET -ne 0 ]] ||
[[ $should_fail -eq 1 ]]; then
128 router_routes_destroy
135 router_routes_destroy