Skip to content

Commit 2da0bbd

Browse files
committed
Protection against Scapy bug #193
1 parent d63bcbd commit 2da0bbd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test-scapy.py

+7
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ def usage(msg=None):
4646
sys.exit(1)
4747

4848
if dst == "127.0.0.1" or dst == "::1": # TODO: not sufficient because there are also global addresses that are on the machine
49+
old_setting=conf.L3socket
4950
conf.L3socket=L3RawSocket # http://wiki.spiritofhack.net/index.php/Scapy-erreurs#Je_ne_peux_pas_pinguer_127.0.0.1._Scapy_ne_marche_pas_avec_127.0.0.1_ni_localhost
51+
# Test it (Scapy bug #193 http://trac.secdev.org/scapy/ticket/193)
52+
try:
53+
sr1(p, timeout=0.01)
54+
except NameError:
55+
print >>sys.stderr, "Warning, setting the local link as raw failed (Scapy bug #193)"
56+
conf.L3socket=old_setting
5057

5158
p = IP(dst=dst)/UDP(sport=RandShort(),dport=dport)/DNS(rd=1,qd=DNSQR(qname=qname))
5259

0 commit comments

Comments
 (0)