From 60bf436a09abbe79d4e689abbd94dd279592f3ed Mon Sep 17 00:00:00 2001 From: Guillaume Valadon <guillaume@valadon.net> Date: Sun, 16 Feb 2014 16:16:26 +0100 Subject: [PATCH] Ensure that the 'ip' variable contains a valid IP address --HG-- branch : Issue #803 - 2 --- scapy/layers/l2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scapy/layers/l2.py b/scapy/layers/l2.py index 749d571b..ae42b62d 100644 --- a/scapy/layers/l2.py +++ b/scapy/layers/l2.py @@ -50,6 +50,7 @@ def getmacbyip(ip, chainCC=0): """Return MAC address corresponding to a given IP address""" if isinstance(ip,Net): ip = iter(ip).next() + ip = inet_ntoa(inet_aton(ip)) tmp = map(ord, inet_aton(ip)) if (tmp[0] & 0xf0) == 0xe0: # mcast @ return "01:00:5e:%.2x:%.2x:%.2x" % (tmp[1]&0x7f,tmp[2],tmp[3]) -- GitLab