summaryrefslogtreecommitdiff
path: root/regress/sys/net/pf_opts/icmp_max.py
blob: 8c5aaee338f64b54500ef2279b3fabc9cc58456a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/local/bin/python3

print("send icmp with maximum length option")

import os
import sys
from addr import *
from scapy.all import *

if len(sys.argv) != 2:
	print("usage: icmp_max.py Nn")
	exit(2)

N=sys.argv[1]
IF=eval("IF_"+N);
ADDR=eval("ADDR_"+N);

pid=os.getpid()
eid=pid & 0xffff
payload=b"ABCDEFGHIJKLMNOP"
packet=IP(src=ADDR, dst=ADDR, options=40*b"\001")/ \
    ICMP(type=6, id=eid)/payload

send(packet, iface=IF)