Control: clone 887804 -1 Control: retitle -1 python3-scapy: IPv6.summary() throws "TypeError: inet_pton() argument 2 must be str, not map" when dst is series Control: tags -1 + patch Control: forwarded -1 https://github.com/phaethon/scapy/issues/233
On Fri 2018-01-19 23:51:35 -0500, Daniel Kahn Gillmor wrote: > even worse, this gets triggered whenever creating a series of packets > from a series of addresses in IPv6 on python3. hm, i take it back -- the error described when calling summary() in python3 is not the same as the error described in 887804 -- on a properly-configured python3-scapy system on debian, the functions from scapy.pton_ntop shouldn't ever be loaded because the system inet_pton and inet_ntop should be used instead. This second failure can be fixed with the attached patch. one of the two hunks of this patch is already applied upstream in 0.23, but the other isn't yet fixed upstream, though it has been reported (see the "forwarded" URL). --dkg
diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py index f1be392..88ef781 100644 --- a/scapy/layers/inet6.py +++ b/scapy/layers/inet6.py @@ -159,7 +159,7 @@ class Net6(Gen): # syntax ex. fec0::/126 netmask = min(8,max(netmask,0)) a = (int(a) & (0xff<<netmask),(int(a) | (0xff>>(8-netmask)))+1) return a - self.parsed = map(lambda x,y: parse_digit(x,y), tmp, map(lambda x,nm=self.plen: x-nm, tuple)) + self.parsed = list(map(lambda x,y: parse_digit(x,y), tmp, map(lambda x,nm=self.plen: x-nm, tuple))) def rec(n, l): if n and n % 2 == 0: @@ -201,7 +201,7 @@ class IP6Field(Field): except socket.error: x = Net6(x) elif type(x) is list: - x = map(Net6, x) + x = list(map(Net6, x)) return x def i2m(self, pkt, x): return inet_pton(socket.AF_INET6, x)