xref: /openbsd-src/regress/sys/netinet/arp/arp_otherproxy.py (revision ac29c8e0bbd85ab37116eea98eaaa09e07bf6b26)
1*ac29c8e0Sbluhm#!/usr/local/bin/python3
2018ce5eeSbluhm# send Address Resolution Protocol Request for Proxy ARP on other interface
3018ce5eeSbluhm# expect no answer
4018ce5eeSbluhm
5018ce5eeSbluhmimport os
6018ce5eeSbluhmfrom addr import *
7018ce5eeSbluhmfrom scapy.all import *
8018ce5eeSbluhm
9018ce5eeSbluhmarp=ARP(op='who-has', hwsrc=LOCAL_MAC, psrc=LOCAL_ADDR,
10b07894d8Sbluhm    hwdst="ff:ff:ff:ff:ff:ff", pdst=OTHER_FAKE_ADDR)
11018ce5eeSbluhmeth=Ether(src=LOCAL_MAC, dst="ff:ff:ff:ff:ff:ff")/arp
12018ce5eeSbluhm
13018ce5eeSbluhme=srp1(eth, iface=LOCAL_IF, timeout=2)
14018ce5eeSbluhm
15018ce5eeSbluhmif e and e.type == ETH_P_ARP:
16018ce5eeSbluhm	a=e.payload
17018ce5eeSbluhm	a.show()
18*ac29c8e0Sbluhm	print("ARP REPLY")
19018ce5eeSbluhm	exit(1)
20018ce5eeSbluhm
21*ac29c8e0Sbluhmprint("no arp reply")
22018ce5eeSbluhmexit(0)
23