From a0e0018c9a7ef5ce7f6d2c3ae16aecbbd16a8f67 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 16:18:53 +0200 Subject: Adding upstream version 6.1.0. Signed-off-by: Daniel Baumann --- testsuite/tests/ip/link/add_type_bareudp.t | 86 +++++++++++++++++++++++++++ testsuite/tests/ip/link/add_type_xfrm.t | 17 ++++++ testsuite/tests/ip/link/new_link.t | 15 +++++ testsuite/tests/ip/link/show_dev_wo_vf_rate.t | 6 ++ testsuite/tests/ip/netns/set_nsid.t | 22 +++++++ testsuite/tests/ip/netns/set_nsid_batch.t | 18 ++++++ testsuite/tests/ip/route/add_default_route.t | 35 +++++++++++ testsuite/tests/ip/rule/dsfield.t | 29 +++++++++ testsuite/tests/ip/tunnel/add_tunnel.t | 27 +++++++++ 9 files changed, 255 insertions(+) create mode 100755 testsuite/tests/ip/link/add_type_bareudp.t create mode 100755 testsuite/tests/ip/link/add_type_xfrm.t create mode 100755 testsuite/tests/ip/link/new_link.t create mode 100755 testsuite/tests/ip/link/show_dev_wo_vf_rate.t create mode 100755 testsuite/tests/ip/netns/set_nsid.t create mode 100755 testsuite/tests/ip/netns/set_nsid_batch.t create mode 100755 testsuite/tests/ip/route/add_default_route.t create mode 100755 testsuite/tests/ip/rule/dsfield.t create mode 100755 testsuite/tests/ip/tunnel/add_tunnel.t (limited to 'testsuite/tests/ip') diff --git a/testsuite/tests/ip/link/add_type_bareudp.t b/testsuite/tests/ip/link/add_type_bareudp.t new file mode 100755 index 0000000..8a2a1ed --- /dev/null +++ b/testsuite/tests/ip/link/add_type_bareudp.t @@ -0,0 +1,86 @@ +#!/bin/sh + +. lib/generic.sh + +ts_log "[Testing Add BareUDP interface (unicast MPLS)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (unicast MPLS)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype mpls_uc + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (unicast MPLS)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype mpls_uc" +test_on "nomultiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (unicast MPLS)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (multicast MPLS)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (multicast MPLS)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype mpls_mc + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (multicast MPLS)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype mpls_mc" +test_on "nomultiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (multicast MPLS)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (unicast and multicast MPLS)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (unicast and multicast MPLS)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype mpls_uc multiproto + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (unicast and multicast MPLS)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype mpls_uc" +test_on "multiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (unicast and multicast MPLS)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (IPv4)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (IPv4)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype ipv4 + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (IPv4)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype ip" +test_on "nomultiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (IPv4)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (IPv6)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (IPv6)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype ipv6 + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (IPv6)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype ipv6" +test_on "nomultiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (IPv6)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (IPv4 and IPv6)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (IPv4 and IPv6)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype ipv4 multiproto + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (IPv4 and IPv6)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype ip" +test_on "multiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (IPv4 and IPv6)" link del dev $NEW_DEV diff --git a/testsuite/tests/ip/link/add_type_xfrm.t b/testsuite/tests/ip/link/add_type_xfrm.t new file mode 100755 index 0000000..caba0e4 --- /dev/null +++ b/testsuite/tests/ip/link/add_type_xfrm.t @@ -0,0 +1,17 @@ +#!/bin/sh + +. lib/generic.sh + +ts_log "[Testing Add XFRM Interface, With IF-ID]" + +PHYS_DEV="lo" +NEW_DEV="$(rand_dev)" +IF_ID="0xf" + +ts_ip "$0" "Add $NEW_DEV xfrm interface" link add dev $NEW_DEV type xfrm dev $PHYS_DEV if_id $IF_ID + +ts_ip "$0" "Show $NEW_DEV xfrm interface" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "if_id $IF_ID" + +ts_ip "$0" "Del $NEW_DEV xfrm interface" link del dev $NEW_DEV diff --git a/testsuite/tests/ip/link/new_link.t b/testsuite/tests/ip/link/new_link.t new file mode 100755 index 0000000..c17650a --- /dev/null +++ b/testsuite/tests/ip/link/new_link.t @@ -0,0 +1,15 @@ +#!/bin/sh + +. lib/generic.sh + +ts_log "[Testing add/del virtual links]" + +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV dummy interface" link add dev $NEW_DEV type dummy + +ts_ip "$0" "Show $NEW_DEV dummy interface" link show dev $NEW_DEV +test_on "$NEW_DEV" +test_lines_count 2 + +ts_ip "$0" "Del $NEW_DEV dummy interface" link del dev $NEW_DEV diff --git a/testsuite/tests/ip/link/show_dev_wo_vf_rate.t b/testsuite/tests/ip/link/show_dev_wo_vf_rate.t new file mode 100755 index 0000000..5b3c004 --- /dev/null +++ b/testsuite/tests/ip/link/show_dev_wo_vf_rate.t @@ -0,0 +1,6 @@ +#!/bin/sh + +. lib/generic.sh + +NL_FILE="tests/ip/link/dev_wo_vf_rate.nl" +ts_ip "$0" "Show VF devices w/o VF rate info" -d monitor file $NL_FILE diff --git a/testsuite/tests/ip/netns/set_nsid.t b/testsuite/tests/ip/netns/set_nsid.t new file mode 100755 index 0000000..8f8c779 --- /dev/null +++ b/testsuite/tests/ip/netns/set_nsid.t @@ -0,0 +1,22 @@ +#!/bin/sh + +. lib/generic.sh + +ts_log "[Testing netns nsid]" + +NS=testnsid +NSID=99 + +ts_ip "$0" "Add new netns $NS" netns add $NS +ts_ip "$0" "Set $NS nsid to $NSID" netns set $NS $NSID + +ts_ip "$0" "List netns" netns list +test_on "$NS \(id: $NSID\)" + +ts_ip "$0" "List netns without explicit list or show" netns +test_on "$NS \(id: $NSID\)" + +ts_ip "$0" "List nsid" netns list-id +test_on "$NSID \(iproute2 netns name: $NS\)" + +ts_ip "$0" "Delete netns $NS" netns del $NS diff --git a/testsuite/tests/ip/netns/set_nsid_batch.t b/testsuite/tests/ip/netns/set_nsid_batch.t new file mode 100755 index 0000000..196fd4b --- /dev/null +++ b/testsuite/tests/ip/netns/set_nsid_batch.t @@ -0,0 +1,18 @@ +#!/bin/sh + +. lib/generic.sh + +ts_log "[Testing netns nsid in batch mode]" + +NS=testnsid +NSID=99 +BATCHFILE=`mktemp` + +echo "netns add $NS" >> $BATCHFILE +echo "netns set $NS $NSID" >> $BATCHFILE +echo "netns list-id" >> $BATCHFILE +ts_ip "$0" "Add ns, set nsid and list in batch mode" -b $BATCHFILE +test_on "nsid $NSID \(iproute2 netns name: $NS\)" +rm -f $BATCHFILE + +ts_ip "$0" "Delete netns $NS" netns del $NS diff --git a/testsuite/tests/ip/route/add_default_route.t b/testsuite/tests/ip/route/add_default_route.t new file mode 100755 index 0000000..ded4edc --- /dev/null +++ b/testsuite/tests/ip/route/add_default_route.t @@ -0,0 +1,35 @@ +#!/bin/sh + +. lib/generic.sh + +ts_log "[Testing add default route]" + +DEV=dummy0 + +ts_ip "$0" "Add new interface $DEV" link add $DEV type dummy +ts_ip "$0" "Set $DEV into UP state" link set up dev $DEV + +ts_ip "$0" "Add 1.1.1.1/24 addr on $DEV" addr add 1.1.1.1/24 dev $DEV +ts_ip "$0" "Add default route via 1.1.1.2" route add default via 1.1.1.2 + +ts_ip "$0" "Show IPv4 default route" -4 route show default +test_on "default via 1.1.1.2 dev $DEV" +test_lines_count 1 + +ts_ip "$0" "Add another IPv4 route dst 2.2.2.0/24" -4 route add 2.2.2.0/24 dev $DEV +ts_ip "$0" "Show IPv4 default route" -4 route show default +test_on "default via 1.1.1.2 dev $DEV" +test_lines_count 1 + +ts_ip "$0" "Add dead:beef::1/64 addr on $DEV" -6 addr add dead:beef::1/64 dev $DEV +ts_ip "$0" "Add default route via dead:beef::2" route add default via dead:beef::2 +ts_ip "$0" "Show IPv6 default route" -6 route show default +test_on "default via dead:beef::2 dev $DEV" +test_lines_count 1 + +ts_ip "$0" "Add another IPv6 route dst cafe:babe::/64" -6 route add cafe:babe::/64 dev $DEV +ts_ip "$0" "Show IPv6 default route" -6 route show default +test_on "default via dead:beef::2 dev $DEV" +test_lines_count 1 + +ts_ip "$0" "Del $DEV dummy interface" link del dev $DEV diff --git a/testsuite/tests/ip/rule/dsfield.t b/testsuite/tests/ip/rule/dsfield.t new file mode 100755 index 0000000..79ad4e2 --- /dev/null +++ b/testsuite/tests/ip/rule/dsfield.t @@ -0,0 +1,29 @@ +#!/bin/sh + +. lib/generic.sh + +ts_log "[Testing rule with option dsfield/tos]" + +ts_ip "$0" "Add IPv4 rule with dsfield 0x10" -4 rule add dsfield 0x10 +ts_ip "$0" "Show IPv4 rule with dsfield 0x10" -4 rule show dsfield 0x10 +test_on "tos 0x10" +test_lines_count 1 +ts_ip "$0" "Delete IPv4 rule with dsfield 0x10" -4 rule del dsfield 0x10 + +ts_ip "$0" "Add IPv4 rule with tos 0x10" -4 rule add tos 0x10 +ts_ip "$0" "Show IPv4 rule with tos 0x10" -4 rule show tos 0x10 +test_on "tos 0x10" +test_lines_count 1 +ts_ip "$0" "Delete IPv4 rule with tos 0x10" -4 rule del tos 0x10 + +ts_ip "$0" "Add IPv6 rule with dsfield 0x10" -6 rule add dsfield 0x10 +ts_ip "$0" "Show IPv6 rule with dsfield 0x10" -6 rule show dsfield 0x10 +test_on "tos 0x10" +test_lines_count 1 +ts_ip "$0" "Delete IPv6 rule with dsfield 0x10" -6 rule del dsfield 0x10 + +ts_ip "$0" "Add IPv6 rule with tos 0x10" -6 rule add tos 0x10 +ts_ip "$0" "Show IPv6 rule with tos 0x10" -6 rule show tos 0x10 +test_on "tos 0x10" +test_lines_count 1 +ts_ip "$0" "Delete IPv6 rule with tos 0x10" -6 rule del tos 0x10 diff --git a/testsuite/tests/ip/tunnel/add_tunnel.t b/testsuite/tests/ip/tunnel/add_tunnel.t new file mode 100755 index 0000000..65db431 --- /dev/null +++ b/testsuite/tests/ip/tunnel/add_tunnel.t @@ -0,0 +1,27 @@ +#!/bin/sh + +. lib/generic.sh + +TUNNEL_NAME="tunnel_test_ip" +KMODS="ip6_gre ip6_tunnel ip_gre ip_tunnel gre" + +# unload kernel modules to remove dummy interfaces only if they were not in use beforehand +kmods_remove= +# note that checkbashism reports command -v, but dash supports it and it's POSIX 2008 compliant +if command -v lsmod >/dev/null 2>&1 && command -v rmmod >/dev/null 2>&1; then + for i in $KMODS; do + lsmod | grep -q "^$i" || kmods_remove="$kmods_remove $i"; + done +fi + +ts_log "[Testing add/del tunnels]" + +ts_ip "$0" "Add GRE tunnel over IPv4" tunnel add name $TUNNEL_NAME mode gre local 1.1.1.1 remote 2.2.2.2 +ts_ip "$0" "Del GRE tunnel over IPv4" tunnel del $TUNNEL_NAME + +ts_ip "$0" "Add GRE tunnel over IPv6" tunnel add name $TUNNEL_NAME mode ip6gre local dead:beef::1 remote dead:beef::2 +ts_ip "$0" "Del GRE tunnel over IPv6" tunnel del $TUNNEL_NAME + +for mod in $kmods_remove; do + sudo rmmod "$mod" +done -- cgit v1.2.3