Lines Matching +full:route +full:- +full:up

2 # SPDX-License-Identifier: GPL-2.0
14 # is assigned an IPv4 and an IPv6 address. A host-route allows a veth to
20 # For IPv4 and IPv6 reachability tests, the route simply sets the peer's
27 # +-----------------------------------------------------------------------+
34 # | * IPv4 route: 192.0.2.103/32 reachable via 192.0.2.11 |
35 # | * IPv6 route: 2001:db8::103/128 reachable via 2001:db8::11 |
36 # | * IPv6 route: 2001:db8::203/128 reachable via 2001:db8::11 |
43 # +---+-------------------------------------------------------------------+
47 # +---+-------------------------------------------------------------------+
65 # +---+-------------------------------------------------------------------+
69 # +---+-------------------------------------------------------------------+
87 # +---+-------------------------------------------------------------------+
91 # +---+-------------------------------------------------------------------+
102 # | * IPv4 route: 192.0.2.100/32 reachable via 192.0.2.32 |
103 # | * IPv6 route: 2001:db8::100/128 reachable via 2001:db8::32 |
104 # | * IPv6 route: 2001:db8::200/128 reachable via 2001:db8::32 |
107 # +-----------------------------------------------------------------------+
113 readonly NS0=$(mktemp -u ns0-XXXXXXXX)
114 readonly NS1=$(mktemp -u ns1-XXXXXXXX)
115 readonly NS2=$(mktemp -u ns2-XXXXXXXX)
116 readonly NS3=$(mktemp -u ns3-XXXXXXXX)
130 if [ "${ERR}" -eq 4 ]; then
131 echo "Error: Setting up the testing environment failed." >&2
139 # New namespaces are cleaned up manually in case of error, to ensure that only
156 # Configure a network interface using a host route
176 ip -netns "${NS}" link set dev "${DEV}" up
177 ip -netns "${NS}" address add dev "${DEV}" "${LOCAL_IP4}" peer "${PEER_IP4}"
178 ip -netns "${NS}" address add dev "${DEV}" "${LOCAL_IP6}" peer "${PEER_IP6}" nodad
183 # * set up the loopback device in all network namespaces (NS0..NS3),
184 # * set up a veth pair to connect each netns in sequence (NS0 with NS1,
192 ip -netns "${ns}" link set dev lo up
205 tc -netns "${NS1}" qdisc add dev veth10 ingress
206 tc -netns "${NS2}" qdisc add dev veth23 ingress
209 # Set up the IPv4, IPv6 and MPLS overlays.
215 # * route these IP addresses via the intermediate namespaces (for the MPLS
225 # Add the overlay IP addresses and route them through the veth devices
226 ip -netns "${NS0}" address add 192.0.2.100/32 dev lo
227 ip -netns "${NS3}" address add 192.0.2.103/32 dev lo
228 ip -netns "${NS0}" route add 192.0.2.103/32 src 192.0.2.100 via 192.0.2.11
229 ip -netns "${NS3}" route add 192.0.2.100/32 src 192.0.2.103 via 192.0.2.32
231 # Route the overlay addresses in the intermediate namespaces
233 ip netns exec "${NS1}" sysctl -qw net.ipv4.ip_forward=1
234 ip netns exec "${NS2}" sysctl -qw net.ipv4.ip_forward=1
235 ip -netns "${NS1}" route add 192.0.2.100/32 via 192.0.2.10
236 ip -netns "${NS2}" route add 192.0.2.103/32 via 192.0.2.33
241 ip netns exec "${NS1}" sysctl -qw net.ipv4.conf.all.rp_filter=0
242 ip netns exec "${NS2}" sysctl -qw net.ipv4.conf.all.rp_filter=0
243 ip netns exec "${NS1}" sysctl -qw net.ipv4.conf.default.rp_filter=0
244 ip netns exec "${NS2}" sysctl -qw net.ipv4.conf.default.rp_filter=0
249 # Add the overlay IP addresses and route them through the veth devices
250 ip -netns "${NS0}" address add 2001:db8::100/128 dev lo
251 ip -netns "${NS3}" address add 2001:db8::103/128 dev lo
252 ip -netns "${NS0}" route add 2001:db8::103/128 src 2001:db8::100 via 2001:db8::11
253 ip -netns "${NS3}" route add 2001:db8::100/128 src 2001:db8::103 via 2001:db8::32
255 # Route the overlay addresses in the intermediate namespaces
257 ip netns exec "${NS1}" sysctl -qw net.ipv6.conf.all.forwarding=1
258 ip netns exec "${NS2}" sysctl -qw net.ipv6.conf.all.forwarding=1
259 ip -netns "${NS1}" route add 2001:db8::100/128 via 2001:db8::10
260 ip -netns "${NS2}" route add 2001:db8::103/128 via 2001:db8::33
266 ip -netns "${NS0}" address add 2001:db8::200/128 dev lo
267 ip -netns "${NS3}" address add 2001:db8::203/128 dev lo
268 ip -netns "${NS0}" route add 2001:db8::203/128 src 2001:db8::200 encap mpls 203 via 2001:db8::11
269 ip -netns "${NS3}" route add 2001:db8::200/128 src 2001:db8::203 encap mpls 200 via 2001:db8::32
271 # Route the MPLS packets in the intermediate namespaces
273 ip netns exec "${NS1}" sysctl -qw net.mpls.platform_labels=256
274 ip netns exec "${NS2}" sysctl -qw net.mpls.platform_labels=256
275 ip -netns "${NS1}" -family mpls route add 200 via inet6 2001:db8::10
276 ip -netns "${NS2}" -family mpls route add 203 via inet6 2001:db8::33
297 printf "TEST: %-60s " "${MSG}"
300 ip netns exec "${NS0}" "${PING}" -w 5 -c 1 "${IP}" > /dev/null 2>&1
302 set -e
304 if [ "${RET}" -eq 0 ]; then
351 # Set up a bareudp overlay and run reachability tests over IPv4 and IPv6
395 …ip -netns "${NS1}" link add name bareudp_ns1 up type bareudp dstport 6635 ethertype "${ETHERTYPE}"…
396 …ip -netns "${NS2}" link add name bareudp_ns2 up type bareudp dstport 6635 ethertype "${ETHERTYPE}"…
401 tc -netns "${NS1}" filter add dev veth10 ingress protocol ipv4 \
405 tc -netns "${NS2}" filter add dev veth23 ingress protocol ipv4 \
414 tc -netns "${NS1}" filter add dev veth10 ingress protocol ipv6 \
418 tc -netns "${NS2}" filter add dev veth23 ingress protocol ipv6 \
426 ip netns exec "${NS1}" sysctl -qw net.mpls.conf.bareudp_ns1.input=1
427 ip netns exec "${NS2}" sysctl -qw net.mpls.conf.bareudp_ns2.input=1
430 tc -netns "${NS1}" filter add dev veth10 ingress protocol mpls_uc \
434 tc -netns "${NS2}" filter add dev veth23 ingress protocol mpls_uc \
444 # the IPv4 underlay, before setting up and testing the IPv6 underlay
445 tc -netns "${NS1}" filter delete dev veth10 ingress
446 tc -netns "${NS2}" filter delete dev veth23 ingress
451 tc -netns "${NS1}" filter add dev veth10 ingress protocol ipv4 \
455 tc -netns "${NS2}" filter add dev veth23 ingress protocol ipv4 \
464 tc -netns "${NS1}" filter add dev veth10 ingress protocol ipv6 \
468 tc -netns "${NS2}" filter add dev veth23 ingress protocol ipv6 \
477 tc -netns "${NS1}" filter add dev veth10 ingress protocol mpls_uc \
481 tc -netns "${NS2}" filter add dev veth23 ingress protocol mpls_uc \
490 tc -netns "${NS1}" filter delete dev veth10 ingress
491 tc -netns "${NS2}" filter delete dev veth23 ingress
492 ip -netns "${NS1}" link delete bareudp_ns1
493 ip -netns "${NS2}" link delete bareudp_ns2
498 ip link help 2>&1 | grep -q bareudp
499 if [ $? -ne 0 ]; then
505 ping -w 1 -c 1 ::1 > /dev/null 2>&1 || PING6="ping6"
510 echo "Usage: $0 [-p]"
524 # Create namespaces before setting up the exit trap.
529 set -e
542 if [ "${ERR}" -eq 1 ]; then