From cf6d6d0cd38c716e3e951e13c11c914cd594aad5 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Thu, 30 Jul 2015 16:01:10 +0100 Subject: [PATCH] add test for PMTU discovery and packet fragmentation --- test/100_cross_hosts_2_test.sh | 6 ------ test/105_frag_2_test.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100755 test/105_frag_2_test.sh diff --git a/test/100_cross_hosts_2_test.sh b/test/100_cross_hosts_2_test.sh index a2f77068..4ea28f74 100755 --- a/test/100_cross_hosts_2_test.sh +++ b/test/100_cross_hosts_2_test.sh @@ -27,10 +27,4 @@ start_container $HOST2 net:$SUBNET_2 --name=c6 C6=$(container_ip $HOST2 c6) assert_raises "exec_on $HOST1 c5 $PING $C6" -# check large packets get through. The first attempt typically fails, -# since the PMTU hasn't been discovered yet. The 2nd attempt should -# succeed. -exec_on $HOST1 c1 $PING -s 65000 $C2 2>&1 1>/dev/null || true -assert_raises "exec_on $HOST1 c1 $PING -s 65000 $C2" - end_suite diff --git a/test/105_frag_2_test.sh b/test/105_frag_2_test.sh new file mode 100755 index 00000000..2a450118 --- /dev/null +++ b/test/105_frag_2_test.sh @@ -0,0 +1,33 @@ +#! /bin/bash + +. ./config.sh + +C1=10.2.1.41 +C2=10.2.1.71 + +# 700 = Linux's minimum PMTU (552) + weave framing overheads +# (currently about 60, but we leave some margin). That way the PMTUs +# seen by containers is still >= 552. +drop_large_udp_packets="FORWARD -p udp --destination-port 6783 -m length '!' --length 0:700 -j DROP" + +start_suite "PMTU discovery and packet fragmentation" + +weave_on $HOST1 launch +weave_on $HOST2 launch + +start_container $HOST1 $C1/24 --name=c1 +start_container $HOST2 $C2/24 --name=c2 + +run_on $HOST2 "sudo iptables -I $drop_large_udp_packets" +assert_raises "weave_on $HOST2 connect $HOST1" +sleep 35 # give weave time to discover the PMTU + +# Check large packets get through. The first attempt typically fails, +# since the sending container hasn't discovered the PMTU yet. The 2nd +# attempt should succeed. +exec_on $HOST2 c2 $PING -s 10000 $C1 2>&1 1>/dev/null || true +assert_raises "exec_on $HOST2 c2 $PING -s 10000 $C1" + +run_on $HOST2 "sudo iptables -D $drop_large_udp_packets" + +end_suite