Skip to content
Snippets Groups Projects
Commit 692b5a9e authored by Guillaume Valadon's avatar Guillaume Valadon
Browse files

Merge pull request #25 from p-l-/fix-ether-auto-dstaddr

Fix crash when an unpriv user builds an Ether() packet without dst set
parents c311a497 a57b6ebd
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,8 @@
Classes and functions for layer 2 protocols.
"""
import os,struct,time
import os, struct, time, socket
from scapy.base_classes import Net
from scapy.config import conf
from scapy.packet import *
......@@ -86,7 +87,10 @@ class DestMACField(MACField):
MACField.__init__(self, name, None)
def i2h(self, pkt, x):
if x is None:
x = conf.neighbor.resolve(pkt,pkt.payload)
try:
x = conf.neighbor.resolve(pkt,pkt.payload)
except socket.error:
pass
if x is None:
x = "ff:ff:ff:ff:ff:ff"
warning("Mac address to reach destination not found. Using broadcast.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment