@@ -17,6 +17,40 @@ def _test():
1717
1818retry_test(_test)
1919
20+ = Arping - interface that has no ip
21+ ~ mock
22+
23+ from unittest import mock
24+
25+ _old_routes = conf.route.routes
26+ _old_ifaces = conf.ifaces.data.copy()
27+
28+ try:
29+ conf.route.routes = [
30+ (180996905, 4294967295, '0.0.0.0', 'eth0', '10.201.203.41', 0),
31+ (180997119, 4294967295, '0.0.0.0', 'eth0', '10.201.203.41', 0),
32+ (0, 0, '10.201.203.254', 'eth0', '0.0.0.0', 0),
33+ (180996864, 4294967040, '0.0.0.0', 'eth0', '10.201.203.41', 0),
34+ (3758096384, 4026531840, '0.0.0.0', 'eth0', '10.201.203.41', 250)
35+ ]
36+ conf.ifaces._add_fake_iface("toto", mac="11:22:33:aa:bb:cc", ips=[])
37+
38+ def dummy_srp(pkts, **kwargs):
39+ assert pkts.dst == "ff:ff:ff:ff:ff:ff"
40+ assert pkts.src == "11:22:33:aa:bb:cc"
41+ assert pkts[ARP].psrc == "0.0.0.0"
42+ assert pkts[ARP].pdst == Net("192.168.0.1/24")
43+ assert pkts[ARP].hwsrc == "11:22:33:aa:bb:cc"
44+ # No results, we don't care.
45+ return SndRcvList([]), PacketList(pkts)
46+
47+ with mock.patch("scapy.layers.l2.srp", side_effect=dummy_srp):
48+ arping("192.168.0.1/24", iface="toto")
49+
50+ finally:
51+ conf.route.routes = _old_routes
52+ conf.ifaces.data = _old_ifaces
53+
2054= Test ARPingResult output
2155~ manufdb
2256
0 commit comments