summaryrefslogtreecommitdiff
path: root/regress/sys/net/pf_forward/ping_mtu.py
diff options
context:
space:
mode:
Diffstat (limited to 'regress/sys/net/pf_forward/ping_mtu.py')
-rw-r--r--regress/sys/net/pf_forward/ping_mtu.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/regress/sys/net/pf_forward/ping_mtu.py b/regress/sys/net/pf_forward/ping_mtu.py
new file mode 100644
index 00000000000..76985ae867a
--- /dev/null
+++ b/regress/sys/net/pf_forward/ping_mtu.py
@@ -0,0 +1,22 @@
+#!/usr/local/bin/python2.7
+# check wether path mtu to dst is as expected
+
+import os
+from addr import *
+from scapy.all import *
+
+dstaddr=sys.argv[1]
+expect=int(sys.argv[2])
+pid=os.getpid()
+payload="a" * 1452
+a=srp1(Ether(src=SRC_MAC, dst=PF_MAC)/IP(flags="DF", src=SRC_OUT, dst=dstaddr)/
+ ICMP(id=pid)/payload, iface=SRC_IF, timeout=2)
+if a and a.payload.payload.type==3 and a.payload.payload.code==4:
+ mtu=a.payload.payload.unused
+ print "mtu=%d" % (mtu)
+ if mtu == expect:
+ exit(0)
+ print "MTU!=%d" % (expect)
+ exit(1)
+print "MTU=UNKNOWN"
+exit(2)