summaryrefslogtreecommitdiff
path: root/regress/sys/net
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-01-18 23:03:45 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-01-18 23:03:45 +0000
commitfefc498348108378933ab33a8b82c70c39fee74b (patch)
treefe2ad6f9e98f6f28f1c99fbf918142ed59b31f7a /regress/sys/net
parentb3c92999b4f5788c9a75d594c3db92e9c2ea606c (diff)
Do not use privileged or NFS source ports for UDP packets as inetd
ignores such packets. This should avoid some sporadic failures. While there, use variable names consistently in all tests.
Diffstat (limited to 'regress/sys/net')
-rw-r--r--regress/sys/net/pf_forward/ping6_mtu.py4
-rw-r--r--regress/sys/net/pf_forward/ping_mtu.py4
-rw-r--r--regress/sys/net/pf_fragment/frag.py12
-rw-r--r--regress/sys/net/pf_fragment/frag6.py12
-rw-r--r--regress/sys/net/pf_fragment/frag6_cutnew.py12
-rw-r--r--regress/sys/net/pf_fragment/frag6_cutold.py12
-rw-r--r--regress/sys/net/pf_fragment/frag6_dropnew.py14
-rw-r--r--regress/sys/net/pf_fragment/frag6_dropold.py14
-rw-r--r--regress/sys/net/pf_fragment/frag6_ext.py12
-rw-r--r--regress/sys/net/pf_fragment/frag_cutnew.py12
-rw-r--r--regress/sys/net/pf_fragment/frag_cutold.py12
-rw-r--r--regress/sys/net/pf_fragment/frag_dropnew.py14
-rw-r--r--regress/sys/net/pf_fragment/frag_dropold.py14
-rw-r--r--regress/sys/net/pf_fragment/ping6_cksum.py4
-rw-r--r--regress/sys/net/pf_fragment/ping6_mtu_1300.py4
-rw-r--r--regress/sys/net/pf_fragment/ping_cksum.py4
-rw-r--r--regress/sys/net/pf_fragment/ping_mtu_1300.py4
-rw-r--r--regress/sys/net/pf_fragment/udp6_cksum.py7
-rw-r--r--regress/sys/net/pf_fragment/udp_cksum.py7
-rw-r--r--regress/sys/net/pf_state/challenge_ack.py22
20 files changed, 114 insertions, 86 deletions
diff --git a/regress/sys/net/pf_forward/ping6_mtu.py b/regress/sys/net/pf_forward/ping6_mtu.py
index 14e47210f0a..405e2d635c3 100644
--- a/regress/sys/net/pf_forward/ping6_mtu.py
+++ b/regress/sys/net/pf_forward/ping6_mtu.py
@@ -24,8 +24,8 @@ srcaddr=sys.argv[1]
dstaddr=sys.argv[2]
size=int(sys.argv[3])
expect=int(sys.argv[4])
-pid=os.getpid() & 0xffff
-hdr=IPv6(src=srcaddr, dst=dstaddr)/ICMPv6EchoRequest(id=pid)
+eid=os.getpid() & 0xffff
+hdr=IPv6(src=srcaddr, dst=dstaddr)/ICMPv6EchoRequest(id=eid)
payload="a" * (size - len(str(hdr)))
ip=hdr/payload
iplen=IPv6(str(ip)).plen
diff --git a/regress/sys/net/pf_forward/ping_mtu.py b/regress/sys/net/pf_forward/ping_mtu.py
index 4afba9ca250..7e952ab0046 100644
--- a/regress/sys/net/pf_forward/ping_mtu.py
+++ b/regress/sys/net/pf_forward/ping_mtu.py
@@ -11,8 +11,8 @@ srcaddr=sys.argv[1]
dstaddr=sys.argv[2]
size=int(sys.argv[3])
expect=int(sys.argv[4])
-pid=os.getpid() & 0xffff
-hdr=IP(flags="DF", src=srcaddr, dst=dstaddr)/ICMP(id=pid)
+eid=os.getpid() & 0xffff
+hdr=IP(flags="DF", src=srcaddr, dst=dstaddr)/ICMP(type='echo-request', id=eid)
payload="a" * (size - len(str(hdr)))
ip=hdr/payload
iplen=IP(str(ip)).len
diff --git a/regress/sys/net/pf_fragment/frag.py b/regress/sys/net/pf_fragment/frag.py
index ff93cabddd9..f9f3030fe82 100644
--- a/regress/sys/net/pf_fragment/frag.py
+++ b/regress/sys/net/pf_fragment/frag.py
@@ -17,13 +17,15 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNO"
-packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(id=pid)/payload
+packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(type='echo-request', id=eid)/payload
+fid=pid & 0xffff
frag0=str(packet)[20:36]
frag1=str(packet)[36:44]
-pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=0, flags='MF')/frag0
-pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=2)/frag1
+pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=0, flags='MF')/frag0
+pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=2)/frag1
eth=[]
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt0)
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt1)
@@ -42,7 +44,7 @@ if a and a.type == ETH_P_IP and \
icmptypes[a.payload.payload.type] == 'echo-reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
load=a.payload.payload.payload.load
diff --git a/regress/sys/net/pf_fragment/frag6.py b/regress/sys/net/pf_fragment/frag6.py
index e24c4fe5f71..fa0649cd57b 100644
--- a/regress/sys/net/pf_fragment/frag6.py
+++ b/regress/sys/net/pf_fragment/frag6.py
@@ -17,11 +17,13 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNO"
-packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=pid, data=payload)
-frag0=IPv6ExtHdrFragment(nh=58, id=pid, m=1)/str(packet)[40:56]
-frag1=IPv6ExtHdrFragment(nh=58, id=pid, offset=2)/str(packet)[56:64]
+packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=eid, data=payload)
+fid=pid & 0xffffffff
+frag0=IPv6ExtHdrFragment(nh=58, id=fid, m=1)/str(packet)[40:56]
+frag1=IPv6ExtHdrFragment(nh=58, id=fid, offset=2)/str(packet)[56:64]
pkt0=IPv6(src=SRC_OUT6, dst=dstaddr)/frag0
pkt1=IPv6(src=SRC_OUT6, dst=dstaddr)/frag1
eth=[]
@@ -41,7 +43,7 @@ if a and a.type == ETH_P_IPV6 and \
icmp6types[a.payload.payload.type] == 'Echo Reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
data=a.payload.payload.data
diff --git a/regress/sys/net/pf_fragment/frag6_cutnew.py b/regress/sys/net/pf_fragment/frag6_cutnew.py
index 5127ed827f9..98e2eda2b50 100644
--- a/regress/sys/net/pf_fragment/frag6_cutnew.py
+++ b/regress/sys/net/pf_fragment/frag6_cutnew.py
@@ -22,12 +22,14 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNO"
dummy="01234567"
-packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=pid, data=payload)
-frag0=IPv6ExtHdrFragment(nh=58, id=pid, m=1)/str(packet)[40:56]
-frag1=IPv6ExtHdrFragment(nh=58, id=pid, offset=1)/(dummy+str(packet)[56:64])
+packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=eid, data=payload)
+fid=pid & 0xffffffff
+frag0=IPv6ExtHdrFragment(nh=58, id=fid, m=1)/str(packet)[40:56]
+frag1=IPv6ExtHdrFragment(nh=58, id=fid, offset=1)/(dummy+str(packet)[56:64])
pkt0=IPv6(src=SRC_OUT6, dst=dstaddr)/frag0
pkt1=IPv6(src=SRC_OUT6, dst=dstaddr)/frag1
eth=[]
@@ -50,7 +52,7 @@ if a and a.type == ETH_P_IPV6 and \
icmp6types[a.payload.payload.type] == 'Echo Reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
data=a.payload.payload.data
diff --git a/regress/sys/net/pf_fragment/frag6_cutold.py b/regress/sys/net/pf_fragment/frag6_cutold.py
index ae72575b3af..c9bbfd46a9e 100644
--- a/regress/sys/net/pf_fragment/frag6_cutold.py
+++ b/regress/sys/net/pf_fragment/frag6_cutold.py
@@ -22,12 +22,14 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNO"
dummy="01234567"
-packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=pid, data=payload)
-frag0=IPv6ExtHdrFragment(nh=58, id=pid, m=1)/str(packet)[40:56]
-frag1=IPv6ExtHdrFragment(nh=58, id=pid, offset=1)/(dummy+str(packet)[56:64])
+packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=eid, data=payload)
+fid=pid & 0xffffffff
+frag0=IPv6ExtHdrFragment(nh=58, id=fid, m=1)/str(packet)[40:56]
+frag1=IPv6ExtHdrFragment(nh=58, id=fid, offset=1)/(dummy+str(packet)[56:64])
pkt0=IPv6(src=SRC_OUT6, dst=dstaddr)/frag0
pkt1=IPv6(src=SRC_OUT6, dst=dstaddr)/frag1
eth=[]
@@ -50,7 +52,7 @@ if a and a.type == ETH_P_IPV6 and \
icmp6types[a.payload.payload.type] == 'Echo Reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
data=a.payload.payload.data
diff --git a/regress/sys/net/pf_fragment/frag6_dropnew.py b/regress/sys/net/pf_fragment/frag6_dropnew.py
index e3078d94263..6a7d5b861c3 100644
--- a/regress/sys/net/pf_fragment/frag6_dropnew.py
+++ b/regress/sys/net/pf_fragment/frag6_dropnew.py
@@ -23,13 +23,15 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNOQRSTUVWX"
dummy="01234567"
-packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=pid, data=payload)
-frag0=IPv6ExtHdrFragment(nh=58, id=pid, offset=0, m=1)/str(packet)[40:48]
-frag1=IPv6ExtHdrFragment(nh=58, id=pid, offset=2, m=1)/dummy
-frag2=IPv6ExtHdrFragment(nh=58, id=pid, offset=1)/str(packet)[48:72]
+packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=eid, data=payload)
+fid=pid & 0xffffffff
+frag0=IPv6ExtHdrFragment(nh=58, id=fid, offset=0, m=1)/str(packet)[40:48]
+frag1=IPv6ExtHdrFragment(nh=58, id=fid, offset=2, m=1)/dummy
+frag2=IPv6ExtHdrFragment(nh=58, id=fid, offset=1)/str(packet)[48:72]
pkt0=IPv6(src=SRC_OUT6, dst=dstaddr)/frag0
pkt1=IPv6(src=SRC_OUT6, dst=dstaddr)/frag1
pkt2=IPv6(src=SRC_OUT6, dst=dstaddr)/frag2
@@ -54,7 +56,7 @@ if a and a.type == ETH_P_IPV6 and \
icmp6types[a.payload.payload.type] == 'Echo Reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
data=a.payload.payload.data
diff --git a/regress/sys/net/pf_fragment/frag6_dropold.py b/regress/sys/net/pf_fragment/frag6_dropold.py
index 152c980c7c9..951954f708f 100644
--- a/regress/sys/net/pf_fragment/frag6_dropold.py
+++ b/regress/sys/net/pf_fragment/frag6_dropold.py
@@ -23,13 +23,15 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNOQRSTUVWX"
dummy="01234567"
-packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=pid, data=payload)
-frag0=IPv6ExtHdrFragment(nh=58, id=pid, offset=0, m=1)/str(packet)[40:48]
-frag1=IPv6ExtHdrFragment(nh=58, id=pid, offset=2, m=1)/dummy
-frag2=IPv6ExtHdrFragment(nh=58, id=pid, offset=1)/str(packet)[48:72]
+packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=eid, data=payload)
+fid=pid & 0xffffffff
+frag0=IPv6ExtHdrFragment(nh=58, id=fid, offset=0, m=1)/str(packet)[40:48]
+frag1=IPv6ExtHdrFragment(nh=58, id=fid, offset=2, m=1)/dummy
+frag2=IPv6ExtHdrFragment(nh=58, id=fid, offset=1)/str(packet)[48:72]
pkt0=IPv6(src=SRC_OUT6, dst=dstaddr)/frag0
pkt1=IPv6(src=SRC_OUT6, dst=dstaddr)/frag1
pkt2=IPv6(src=SRC_OUT6, dst=dstaddr)/frag2
@@ -54,7 +56,7 @@ if a and a.type == ETH_P_IPV6 and \
icmp6types[a.payload.payload.type] == 'Echo Reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
data=a.payload.payload.data
diff --git a/regress/sys/net/pf_fragment/frag6_ext.py b/regress/sys/net/pf_fragment/frag6_ext.py
index 62abc2a350d..5c50c848eea 100644
--- a/regress/sys/net/pf_fragment/frag6_ext.py
+++ b/regress/sys/net/pf_fragment/frag6_ext.py
@@ -17,11 +17,13 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNO"
-packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=pid, data=payload)
-frag0=IPv6ExtHdrFragment(nh=58, id=pid, m=1)/str(packet)[40:56]
-frag1=IPv6ExtHdrFragment(nh=58, id=pid, offset=2)/str(packet)[56:64]
+packet=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=eid, data=payload)
+fid=pid & 0xffffffff
+frag0=IPv6ExtHdrFragment(nh=58, id=fid, m=1)/str(packet)[40:56]
+frag1=IPv6ExtHdrFragment(nh=58, id=fid, offset=2)/str(packet)[56:64]
pkt0=IPv6(src=SRC_OUT6, dst=dstaddr)/IPv6ExtHdrHopByHop()/frag0
pkt1=IPv6(src=SRC_OUT6, dst=dstaddr)/IPv6ExtHdrHopByHop()/frag1
eth=[]
@@ -41,7 +43,7 @@ if a and a.type == ETH_P_IPV6 and \
icmp6types[a.payload.payload.type] == 'Echo Reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
data=a.payload.payload.data
diff --git a/regress/sys/net/pf_fragment/frag_cutnew.py b/regress/sys/net/pf_fragment/frag_cutnew.py
index fbbceecd019..261d2245688 100644
--- a/regress/sys/net/pf_fragment/frag_cutnew.py
+++ b/regress/sys/net/pf_fragment/frag_cutnew.py
@@ -25,14 +25,16 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNO"
dummy="01234567"
-packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(id=pid)/payload
+packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(type='echo-request', id=eid)/payload
frag0=str(packet)[20:36]
frag1=dummy+str(packet)[36:44]
-pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=0, flags='MF')/frag0
-pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=1)/frag1
+fid=pid & 0xffff
+pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=0, flags='MF')/frag0
+pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=1)/frag1
eth=[]
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt0)
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt1)
@@ -51,7 +53,7 @@ if a and a.type == ETH_P_IP and \
icmptypes[a.payload.payload.type] == 'echo-reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
load=a.payload.payload.payload.load
diff --git a/regress/sys/net/pf_fragment/frag_cutold.py b/regress/sys/net/pf_fragment/frag_cutold.py
index 9dcfecde6ea..3c69819cb7d 100644
--- a/regress/sys/net/pf_fragment/frag_cutold.py
+++ b/regress/sys/net/pf_fragment/frag_cutold.py
@@ -26,14 +26,16 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNO"
dummy="01234567"
-packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(id=pid)/payload
+packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(type='echo-request', id=eid)/payload
+fid=pid & 0xffff
frag0=str(packet)[20:36]
frag1=dummy+str(packet)[36:44]
-pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=0, flags='MF')/frag0
-pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=1)/frag1
+pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=0, flags='MF')/frag0
+pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=1)/frag1
eth=[]
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt1)
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt0)
@@ -52,7 +54,7 @@ if a and a.type == ETH_P_IP and \
icmptypes[a.payload.payload.type] == 'echo-reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
load=a.payload.payload.payload.load
diff --git a/regress/sys/net/pf_fragment/frag_dropnew.py b/regress/sys/net/pf_fragment/frag_dropnew.py
index f7466fbf0cf..bd6123f7a89 100644
--- a/regress/sys/net/pf_fragment/frag_dropnew.py
+++ b/regress/sys/net/pf_fragment/frag_dropnew.py
@@ -27,16 +27,18 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNOQRSTUVWX"
dummy="01234567"
-packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(id=pid)/payload
+packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(type='echo-request', id=eid)/payload
+fid=pid & 0xffff
frag0=str(packet)[20:28]
frag1=dummy
frag2=str(packet)[28:52]
-pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=0, flags='MF')/frag0
-pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=2, flags='MF')/frag1
-pkt2=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=1)/frag2
+pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=0, flags='MF')/frag0
+pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=2, flags='MF')/frag1
+pkt2=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=1)/frag2
eth=[]
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt2)
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt1)
@@ -56,7 +58,7 @@ if a and a.type == ETH_P_IP and \
icmptypes[a.payload.payload.type] == 'echo-reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
load=a.payload.payload.payload.load
diff --git a/regress/sys/net/pf_fragment/frag_dropold.py b/regress/sys/net/pf_fragment/frag_dropold.py
index fd03b09f117..d444d075d4d 100644
--- a/regress/sys/net/pf_fragment/frag_dropold.py
+++ b/regress/sys/net/pf_fragment/frag_dropold.py
@@ -27,16 +27,18 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+pid=os.getpid()
+eid=pid & 0xffff
payload="ABCDEFGHIJKLOMNOQRSTUVWX"
dummy="01234567"
-packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(id=pid)/payload
+packet=IP(src=SRC_OUT, dst=dstaddr)/ICMP(type='echo-request', id=eid)/payload
+fid=pid & 0xffff
frag0=str(packet)[20:28]
frag1=dummy
frag2=str(packet)[28:52]
-pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=0, flags='MF')/frag0
-pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=2, flags='MF')/frag1
-pkt2=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=pid, frag=1)/frag2
+pkt0=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=0, flags='MF')/frag0
+pkt1=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=2, flags='MF')/frag1
+pkt2=IP(src=SRC_OUT, dst=dstaddr, proto=1, id=fid, frag=1)/frag2
eth=[]
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt0)
eth.append(Ether(src=SRC_MAC, dst=PF_MAC)/pkt1)
@@ -56,7 +58,7 @@ if a and a.type == ETH_P_IP and \
icmptypes[a.payload.payload.type] == 'echo-reply':
id=a.payload.payload.id
print "id=%#x" % (id)
- if id != pid:
+ if id != eid:
print "WRONG ECHO REPLY ID"
exit(2)
load=a.payload.payload.payload.load
diff --git a/regress/sys/net/pf_fragment/ping6_cksum.py b/regress/sys/net/pf_fragment/ping6_cksum.py
index 57d44a509bc..cdac1d00928 100644
--- a/regress/sys/net/pf_fragment/ping6_cksum.py
+++ b/regress/sys/net/pf_fragment/ping6_cksum.py
@@ -6,10 +6,10 @@ from addr import *
from scapy.all import *
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+eid=os.getpid() & 0xffff
payload="a" * 1452
p=(Ether(src=SRC_MAC, dst=PF_MAC)/IPv6(src=SRC_OUT6, dst=dstaddr)/
- ICMPv6EchoRequest(id=pid, data=payload))
+ ICMPv6EchoRequest(id=eid, data=payload))
echocksum=IPv6(str(p.payload)).payload.cksum
print "echocksum=%#04x" % (echocksum)
a=srp1(p, iface=SRC_IF, timeout=2)
diff --git a/regress/sys/net/pf_fragment/ping6_mtu_1300.py b/regress/sys/net/pf_fragment/ping6_mtu_1300.py
index 38d6db15f4c..bca636adb24 100644
--- a/regress/sys/net/pf_fragment/ping6_mtu_1300.py
+++ b/regress/sys/net/pf_fragment/ping6_mtu_1300.py
@@ -19,8 +19,8 @@ class Sniff1(threading.Thread):
self.packet = self.captured[0]
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
-hdr=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=pid)
+eid=os.getpid() & 0xffff
+hdr=IPv6(src=SRC_OUT6, dst=dstaddr)/ICMPv6EchoRequest(id=eid)
payload="a" * (1400 - len(str(hdr)))
ip=hdr/payload
eth=Ether(src=SRC_MAC, dst=PF_MAC)/ip
diff --git a/regress/sys/net/pf_fragment/ping_cksum.py b/regress/sys/net/pf_fragment/ping_cksum.py
index 73885f9ef34..97a73139d25 100644
--- a/regress/sys/net/pf_fragment/ping_cksum.py
+++ b/regress/sys/net/pf_fragment/ping_cksum.py
@@ -6,10 +6,10 @@ from addr import *
from scapy.all import *
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+eid=os.getpid() & 0xffff
payload="a" * 1472
p=(Ether(src=SRC_MAC, dst=PF_MAC)/IP(flags="DF", src=SRC_OUT, dst=dstaddr)/
- ICMP(id=pid)/payload)
+ ICMP(type='echo-request', id=eid)/payload)
ipcksum=IP(str(p.payload)).chksum
print "ipcksum=%#04x" % (ipcksum)
echocksum=IP(str(p.payload)).payload.chksum
diff --git a/regress/sys/net/pf_fragment/ping_mtu_1300.py b/regress/sys/net/pf_fragment/ping_mtu_1300.py
index 7e5ffa22c6b..2918858e2fe 100644
--- a/regress/sys/net/pf_fragment/ping_mtu_1300.py
+++ b/regress/sys/net/pf_fragment/ping_mtu_1300.py
@@ -6,8 +6,8 @@ from addr import *
from scapy.all import *
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
-hdr=IP(flags="DF", src=SRC_OUT, dst=dstaddr)/ICMP(id=pid)
+eid=os.getpid() & 0xffff
+hdr=IP(flags="DF", src=SRC_OUT, dst=dstaddr)/ICMP(type='echo-request', id=eid)
payload="a" * (1400 - len(str(hdr)))
ip=hdr/payload
eth=Ether(src=SRC_MAC, dst=PF_MAC)/ip
diff --git a/regress/sys/net/pf_fragment/udp6_cksum.py b/regress/sys/net/pf_fragment/udp6_cksum.py
index 91f51d1c807..a335f3f2620 100644
--- a/regress/sys/net/pf_fragment/udp6_cksum.py
+++ b/regress/sys/net/pf_fragment/udp6_cksum.py
@@ -6,10 +6,13 @@ from addr import *
from scapy.all import *
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+uport=os.getpid() & 0xffff
+# inetd ignores UDP packets from privileged port or nfs
+if uport < 1024 or uport == 2049:
+ port+=1024
payload="a" * 1452
p=(Ether(src=SRC_MAC, dst=PF_MAC)/IPv6(src=SRC_OUT6, dst=dstaddr)/
- UDP(sport=pid,dport=9)/payload)
+ UDP(sport=uport, dport=9)/payload)
udpcksum=IPv6(str(p.payload)).payload.chksum
print "udpcksum=%#04x" % (udpcksum)
a=srp1(p, iface=SRC_IF, timeout=2)
diff --git a/regress/sys/net/pf_fragment/udp_cksum.py b/regress/sys/net/pf_fragment/udp_cksum.py
index 010151d54e3..c04ab749080 100644
--- a/regress/sys/net/pf_fragment/udp_cksum.py
+++ b/regress/sys/net/pf_fragment/udp_cksum.py
@@ -6,10 +6,13 @@ from addr import *
from scapy.all import *
dstaddr=sys.argv[1]
-pid=os.getpid() & 0xffff
+uport=os.getpid() & 0xffff
+# inetd ignores UDP packets from privileged port or nfs
+if uport < 1024 or uport == 2049:
+ port+=1024
payload="a" * 1472
p=(Ether(src=SRC_MAC, dst=PF_MAC)/IP(flags="DF", src=SRC_OUT, dst=dstaddr)/
- UDP(sport=pid,dport=9)/payload)
+ UDP(sport=uport, dport=9)/payload)
ipcksum=IP(str(p.payload)).chksum
print "ipcksum=%#04x" % (ipcksum)
udpcksum=IP(str(p.payload)).payload.chksum
diff --git a/regress/sys/net/pf_state/challenge_ack.py b/regress/sys/net/pf_state/challenge_ack.py
index 774765450c4..793e407895e 100644
--- a/regress/sys/net/pf_state/challenge_ack.py
+++ b/regress/sys/net/pf_state/challenge_ack.py
@@ -23,29 +23,29 @@ class Sniff1(threading.Thread):
if self.captured:
self.packet = self.captured[0]
-fake_port=os.getpid() & 0xffff
+tport=os.getpid() & 0xffff
ip=IP(src=FAKE_NET_ADDR, dst=REMOTE_ADDR)
print "Send SYN packet, receive SYN+ACK"
-syn=TCP(sport=fake_port, dport='echo', seq=1, flags='S', window=(2**16)-1)
-syn_ack=sr1(ip/syn, iface=LOCAL_IF, timeout=5)
+syn=TCP(sport=tport, dport='echo', seq=1, flags='S', window=(2**16)-1)
+synack=sr1(ip/syn, iface=LOCAL_IF, timeout=5)
-if syn_ack is None:
+if synack is None:
print "ERROR: no matching SYN+ACK packet received"
exit(1)
print "Send ACK packet to finish handshake."
-ack=TCP(sport=syn_ack.dport, dport=syn_ack.sport, seq=2, flags='A',
- ack=syn_ack.seq+1)
+ack=TCP(sport=synack.dport, dport=synack.sport, seq=2, flags='A',
+ ack=synack.seq+1)
send(ip/ack, iface=LOCAL_IF)
print "Connection is established, send bogus SYN, expect challenge ACK"
-bogus_syn=TCP(sport=fake_port, dport='echo', seq=1000000, flags='S',
+bogus_syn=TCP(sport=syn.sport, dport=syn.dport, seq=1000000, flags='S',
window=(2**16)-1)
sniffer = Sniff1();
-sniffer.filter = "src %s and tcp port echo and dst %s and tcp port %u " \
- "and tcp[tcpflags] = tcp-ack" % (REMOTE_ADDR, FAKE_NET_ADDR, fake_port)
+sniffer.filter = "src %s and tcp port %u and dst %s and tcp port %u " \
+ "and tcp[tcpflags] = tcp-ack" % (ip.dst, syn.dport, ip.src, syn.sport)
sniffer.start()
time.sleep(1)
send(ip/bogus_syn, iface=LOCAL_IF)
@@ -56,9 +56,9 @@ if challenge_ack is None:
print "ERROR: no matching ACK packet received"
exit(1)
-if challenge_ack.getlayer(TCP).seq != (syn_ack.seq + 1):
+if challenge_ack.getlayer(TCP).seq != (synack.seq + 1):
print "ERROR: expecting seq %d got %d in challange ack" % \
- (challenge_ack.getlayer(TCP).seq, (syn_ack.seq + 1))
+ (challenge_ack.getlayer(TCP).seq, (synack.seq + 1))
exit(1)
exit(0)