diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-01-19 13:41:49 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-01-19 13:41:49 +0000 |
commit | 146274f4db319610397361537c24a23f1d4d59e5 (patch) | |
tree | 2959a22d1364c4fb064f417463fdcaf5832e5ff0 /regress/sys/netinet/pmtu/tcp_connect.py | |
parent | bf424eede316da34b41e9ee8ad9490cb7fbcbe31 (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/pmtu/tcp_connect.py')
-rwxr-xr-x | regress/sys/netinet/pmtu/tcp_connect.py | 13 |
1 files changed, 10 insertions, 3 deletions
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', |