Skip to content
Snippets Groups Projects
Commit 6c79aef0 authored by Guillaume Valadon's avatar Guillaume Valadon Committed by Guillaume Valadon
Browse files

Pierre comments

parent 3cf623f1
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,7 @@ def get_if_raw_addr(ifname): ...@@ -57,7 +57,7 @@ def get_if_raw_addr(ifname):
return "\0\0\0\0" return "\0\0\0\0"
# Get IPv4 addresses # Get IPv4 addresses
addresses = [l for l in fd.readlines() if l.find("netmask") >= 0] addresses = [l for l in fd if l.find("netmask") >= 0]
if not addresses: if not addresses:
warning("No IPv4 address found on %s !" % ifname) warning("No IPv4 address found on %s !" % ifname)
return "\0\0\0\0" return "\0\0\0\0"
......
...@@ -105,7 +105,7 @@ class Route6: ...@@ -105,7 +105,7 @@ class Route6:
l = filter(lambda x: in6_ptop(x[0]) == dst and x[1] == plen, self.routes) l = filter(lambda x: in6_ptop(x[0]) == dst and x[1] == plen, self.routes)
if gw: if gw:
gw = in6_ptop(gw) gw = in6_ptop(gw)
l = filter(lambda x: in6_ptop(x[2]) == gw, self.routes) l = [x for x in self.routes if in6_ptop(x[2]) == gw]
if len(l) == 0: if len(l) == 0:
warning("No matching route found") warning("No matching route found")
elif len(l) > 1: elif len(l) > 1:
......
...@@ -17,6 +17,7 @@ from scapy.config import conf ...@@ -17,6 +17,7 @@ from scapy.config import conf
from scapy.data import * from scapy.data import *
from scapy.utils import * from scapy.utils import *
from scapy.pton_ntop import * from scapy.pton_ntop import *
from scapy.volatile import RandMAC
def construct_source_candidate_set(addr, plen, laddr, loname): def construct_source_candidate_set(addr, plen, laddr, loname):
...@@ -357,10 +358,7 @@ def in6_getLocalUniquePrefix(): ...@@ -357,10 +358,7 @@ def in6_getLocalUniquePrefix():
i = int(tod) i = int(tod)
j = int((tod - i)*(2**32)) j = int((tod - i)*(2**32))
tod = struct.pack("!II", i,j) tod = struct.pack("!II", i,j)
# TODO: Add some check regarding system address gathering mac = RandMAC()
from scapy.arch import get_if_raw_hwaddr
rawmac = get_if_raw_hwaddr(conf.iface6)[1]
mac = ":".join(map(lambda x: "%.02x" % ord(x), list(rawmac)))
# construct modified EUI-64 ID # construct modified EUI-64 ID
eui64 = inet_pton(socket.AF_INET6, '::' + in6_mactoifaceid(mac))[8:] eui64 = inet_pton(socket.AF_INET6, '::' + in6_mactoifaceid(mac))[8:]
import sha import sha
......
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