summaryrefslogtreecommitdiff
path: root/regress/sys/netinet
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-01-19 13:41:49 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-01-19 13:41:49 +0000
commit146274f4db319610397361537c24a23f1d4d59e5 (patch)
tree2959a22d1364c4fb064f417463fdcaf5832e5ff0 /regress/sys/netinet
parentbf424eede316da34b41e9ee8ad9490cb7fbcbe31 (diff)
Sending a PMTU ICMP packet will trigger a TCP retransmit. The test
assumed that it would have to send an additional ACK for that. There was a race where the test could miss the TCP retransmit before it did send the ACK. Sniff for the TCP retransmit before sending the ICMP packet and do not send the ACK.
Diffstat (limited to 'regress/sys/netinet')
-rw-r--r--regress/sys/netinet/pmtu/Makefile4
-rwxr-xr-xregress/sys/netinet/pmtu/tcp_atomicfrag6.py8
-rwxr-xr-xregress/sys/netinet/pmtu/tcp_connect.py13
-rwxr-xr-xregress/sys/netinet/pmtu/tcp_connect6.py13
4 files changed, 24 insertions, 14 deletions
diff --git a/regress/sys/netinet/pmtu/Makefile b/regress/sys/netinet/pmtu/Makefile
index 6c0193d580e..84106579f0c 100644
--- a/regress/sys/netinet/pmtu/Makefile
+++ b/regress/sys/netinet/pmtu/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.8 2017/01/18 19:26:59 bluhm Exp $
+# $OpenBSD: Makefile,v 1.9 2017/01/19 13:41:48 bluhm Exp $
# The following ports must be installed:
#
@@ -89,8 +89,6 @@ PYTHON = python2.7 -u ./
PYTHON = PYTHONPATH=${.OBJDIR} python2.7 -u ${.CURDIR}/
.endif
-.PHONY: clean-arp
-
# Clear local and remote path mtu routes, set fake net route
reset-route:
@echo '\n======== $@ ========'
diff --git a/regress/sys/netinet/pmtu/tcp_atomicfrag6.py b/regress/sys/netinet/pmtu/tcp_atomicfrag6.py
index fe7b669fe88..33488bd2255 100755
--- a/regress/sys/netinet/pmtu/tcp_atomicfrag6.py
+++ b/regress/sys/netinet/pmtu/tcp_atomicfrag6.py
@@ -30,15 +30,13 @@ time.sleep(1)
print "Send ICMP6 packet too big packet with MTU 1272."
icmp6=ICMPv6PacketTooBig(mtu=1272)/data.payload
-sendp(e/IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/icmp6, iface=LOCAL_IF)
-
-print "Path MTU discovery will resend first data with length 1272."
-# srp1 cannot be used, fragment answer will not match on outgoing udp packet
+# srp1 cannot be used, fragment answer will not match outgoing icmp packet
if os.fork() == 0:
time.sleep(1)
- sendp(e/ip6/ack, iface=LOCAL_IF)
+ sendp(e/IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/icmp6, iface=LOCAL_IF)
os._exit(0)
+print "Path MTU discovery will resend first data with length 1272."
ans=sniff(iface=LOCAL_IF, timeout=3, filter=
"ip6 and src "+ip6.dst+" and dst "+ip6.src+" and proto ipv6-frag")
diff --git a/regress/sys/netinet/pmtu/tcp_connect.py b/regress/sys/netinet/pmtu/tcp_connect.py
index 4061b06d8cf..a1cb55d0aa2 100755
--- a/regress/sys/netinet/pmtu/tcp_connect.py
+++ b/regress/sys/netinet/pmtu/tcp_connect.py
@@ -30,14 +30,21 @@ time.sleep(1)
print "Send ICMP fragmentation needed packet with MTU 1300."
icmp=ICMP(type="dest-unreach", code="fragmentation-needed",
nexthopmtu=1300)/data
-send(IP(src=LOCAL_ADDR, dst=REMOTE_ADDR)/icmp, iface=LOCAL_IF)
+# sr1 cannot be used, tcp data will not match outgoing icmp packet
+if os.fork() == 0:
+ time.sleep(1)
+ send(IP(src=LOCAL_ADDR, dst=REMOTE_ADDR)/icmp, iface=LOCAL_IF)
+ os._exit(0)
print "Path MTU discovery will resend first data with length 1300."
-data=sr1(ip/ack, iface=LOCAL_IF, timeout=5)
+ans=sniff(iface=LOCAL_IF, timeout=3, count=1, filter=
+ "ip and src %s and tcp port %u and dst %s and tcp port %u" %
+ (ip.dst, syn.dport, ip.src, syn.sport))
-if data is None:
+if len(ans) == 0:
print "ERROR: no data retransmit from chargen server received"
exit(1)
+data=ans[0]
print "Cleanup the other's socket with a reset packet."
rst=TCP(sport=synack.dport, dport=synack.sport, seq=2, flags='AR',
diff --git a/regress/sys/netinet/pmtu/tcp_connect6.py b/regress/sys/netinet/pmtu/tcp_connect6.py
index cccc9d5462c..67b9c50a6af 100755
--- a/regress/sys/netinet/pmtu/tcp_connect6.py
+++ b/regress/sys/netinet/pmtu/tcp_connect6.py
@@ -30,14 +30,21 @@ time.sleep(1)
print "Send ICMP6 packet too big packet with MTU 1300."
icmp6=ICMPv6PacketTooBig(mtu=1300)/data.payload
-sendp(e/IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/icmp6, iface=LOCAL_IF)
+# srp1 cannot be used, tcp data will not match outgoing icmp packet
+if os.fork() == 0:
+ time.sleep(1)
+ sendp(e/IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/icmp6, iface=LOCAL_IF)
+ os._exit(0)
print "Path MTU discovery will resend first data with length 1300."
-data=srp1(e/ip6/ack, iface=LOCAL_IF, timeout=5)
+ans=sniff(iface=LOCAL_IF, timeout=3, count=1, filter=
+ "ip6 and src %s and tcp port %u and dst %s and tcp port %u" %
+ (ip6.dst, syn.dport, ip6.src, syn.sport))
-if data is None:
+if len(ans) == 0:
print "ERROR: no data retransmit from chargen server received"
exit(1)
+data=ans[0]
print "Cleanup the other's socket with a reset packet."
rst=TCP(sport=synack.dport, dport=synack.sport, seq=2, flags='AR',