Skip to content

Commit

Permalink
selftests: pmtu: Move route installs to a new function
Browse files Browse the repository at this point in the history
Move the route add commands to a new function called setup_routing_old.
The '_old' refers to the classic way of installing routes.

Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Ahern authored and David S. Miller committed Jun 10, 2019
1 parent 243781d commit f4ca0c3
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions tools/testing/selftests/net/pmtu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,20 @@ setup_xfrm6() {
setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr}
}

setup_routing_old() {
for i in ${routes}; do
[ "${ns}" = "" ] && ns="${i}" && continue
[ "${addr}" = "" ] && addr="${i}" && continue
[ "${gw}" = "" ] && gw="${i}"

ns_name="$(nsname ${ns})"

ip -n ${ns_name} route add ${addr} via ${gw}

ns=""; addr=""; gw=""
done
}

setup_routing() {
for i in ${NS_R1} ${NS_R2}; do
ip netns exec ${i} sysctl -q net/ipv4/ip_forward=1
Expand Down Expand Up @@ -478,17 +492,7 @@ setup_routing() {
ns=""; peer=""; segment=""
done

for i in ${routes}; do
[ "${ns}" = "" ] && ns="${i}" && continue
[ "${addr}" = "" ] && addr="${i}" && continue
[ "${gw}" = "" ] && gw="${i}"

ns_name="$(nsname ${ns})"

ip -n ${ns_name} route add ${addr} via ${gw}

ns=""; addr=""; gw=""
done
setup_routing_old
}

setup() {
Expand Down

0 comments on commit f4ca0c3

Please sign in to comment.