1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# 4# Run a series of udpgso regression tests 5 6set -o errexit 7set -o nounset 8 9setup_loopback() { 10 ip addr add dev lo 10.0.0.1/32 11 ip addr add dev lo fd00::1/128 nodad noprefixroute 12} 13 14test_dev_mtu() { 15 setup_loopback 16 # Reduce loopback MTU 17 ip link set dev lo mtu 1500 18} 19 20test_route_mtu() { 21 setup_loopback 22 # Remove default local routes 23 ip route del local 10.0.0.1/32 table local dev lo 24 ip route del local fd00::1/128 table local dev lo 25 # Install local routes with reduced MTU 26 ip route add local 10.0.0.1/32 table local dev lo mtu 1500 27 ip route add local fd00::1/128 table local dev lo mtu 1500 28} 29 30if [ "$#" -gt 0 ]; then 31 "$1" 32 shift 2 # pop "test_*" arg and "--" delimiter 33 exec "$@" 34fi 35 36echo "ipv4 cmsg" 37./in_netns.sh "$0" test_dev_mtu -- ./udpgso -4 -C 38 39echo "ipv4 setsockopt" 40./in_netns.sh "$0" test_dev_mtu -- ./udpgso -4 -C -s 41 42echo "ipv6 cmsg" 43./in_netns.sh "$0" test_dev_mtu -- ./udpgso -6 -C 44 45echo "ipv6 setsockopt" 46./in_netns.sh "$0" test_dev_mtu -- ./udpgso -6 -C -s 47 48echo "ipv4 connected" 49./in_netns.sh "$0" test_route_mtu -- ./udpgso -4 -c 50 51echo "ipv6 connected" 52./in_netns.sh "$0" test_route_mtu -- ./udpgso -6 -c 53 54echo "ipv4 msg_more" 55./in_netns.sh "$0" test_dev_mtu -- ./udpgso -4 -C -m 56 57echo "ipv6 msg_more" 58./in_netns.sh "$0" test_dev_mtu -- ./udpgso -6 -C -m 59