summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAmit Cohen <amitc@mellanox.com>2020-01-05 18:20:57 +0200
committerDavid S. Miller <davem@davemloft.net>2020-01-06 13:38:37 -0800
commitef11ffa21b75c97780f345615e46e5e985406513 (patch)
tree0194f393c28d6431a21f93410b01ae2e79aa4bf2 /tools
parentca360db4b82537d0cbc7a54018b2096c757c4828 (diff)
downloadlinux-ef11ffa21b75c97780f345615e46e5e985406513.tar.bz2
selftests: forwarding: router: Add test case for destination IP link-local
Add test case to check that packets are not dropped when they need to be routed and their destination is link-local, i.e., 169.254.0.0/16. Signed-off-by: Amit Cohen <amitc@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/net/forwarding/router.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/router.sh b/tools/testing/selftests/net/forwarding/router.sh
index c894f7240417..057f91b05098 100755
--- a/tools/testing/selftests/net/forwarding/router.sh
+++ b/tools/testing/selftests/net/forwarding/router.sh
@@ -8,6 +8,7 @@ ALL_TESTS="
mc_mac_mismatch
ipv4_sip_equal_dip
ipv6_sip_equal_dip
+ ipv4_dip_link_local
"
NUM_NETIFS=4
@@ -287,6 +288,30 @@ ipv6_sip_equal_dip()
tc filter del dev $rp2 egress protocol ipv6 pref 1 handle 101 flower
}
+ipv4_dip_link_local()
+{
+ local dip=169.254.1.1
+
+ RET=0
+
+ tc filter add dev $rp2 egress protocol ip pref 1 handle 101 \
+ flower dst_ip $dip action pass
+
+ ip neigh add 169.254.1.1 lladdr 00:11:22:33:44:55 dev $rp2
+ ip route add 169.254.1.0/24 dev $rp2
+
+ $MZ $h1 -t udp "sp=54321,dp=12345" -c 5 -d 1msec -b $rp1mac -B $dip -q
+
+ tc_check_packets "dev $rp2 egress" 101 5
+ check_err $? "Packets were dropped"
+
+ log_test "IPv4 destination IP is link-local"
+
+ ip route del 169.254.1.0/24 dev $rp2
+ ip neigh del 169.254.1.1 lladdr 00:11:22:33:44:55 dev $rp2
+ tc filter del dev $rp2 egress protocol ip pref 1 handle 101 flower
+}
+
trap cleanup EXIT
setup_prepare