[Pkg-netmeasure-discuss] Bug#887905: python-scapy: scapy.utils6.in6_ptop() fails on IPv6 addresses with more than one block of zeros
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Sun Jan 21 15:30:49 UTC 2018
Package: python-scapy
Version: 2.3.3-3
Severity: normal
Consider the following example, based on the codepath in
arch/linux.py's read_routes6 (the example is compatible with both
python 2.7 and python3, so that i could test against python3-scapy):
----------------
import struct
import scapy.utils6
import codecs
f1 = b'20010db8000000010000000000000000'
print(f1)
f2 = struct.unpack('4s4s4s4s4s4s4s4s', f1)
print(f2)
f3= b':'.join(f2)
print(f3)
f4 = codecs.decode(f3)
print(f4)
f5 = scapy.utils6.in6_ptop(f4)
print(f5)
----------------
The final result should be:
2001:db8:0:1::
but it currently returns:
2001:db8::1::
which is not a valid IPv6 representation because there are two groups
of :: in the address.
fwiw, python3-scapy does not have the same problem; rather, it returns
the correct address.
--dkg
-- System Information:
Debian Release: buster/sid
APT prefers testing-debug
APT policy: (500, 'testing-debug'), (500, 'testing'), (500, 'oldstable'), (200, 'unstable-debug'), (200, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.14.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages python-scapy depends on:
ii python 2.7.14-4
python-scapy recommends no packages.
Versions of packages python-scapy suggests:
ii ebtables 2.0.10.4-3.5+b1
ii graphviz 2.38.0-18
pn gv <none>
pn hexer <none>
ii imagemagick 8:6.9.7.4+dfsg-16
ii imagemagick-6.q16 [imagemagick] 8:6.9.7.4+dfsg-16
ii librsvg2-bin 2.40.20-2
ii python-crypto 2.6.1-8
pn python-gnuplot <none>
ii python-pcapy 0.10.8-1+b1
pn python-pyx <none>
ii python-visual 1:5.12-1.6+b6
ii sox 14.4.2-3
ii tcpdump 4.9.2-2
pn tcpreplay <none>
ii wireshark 2.4.4-1
pn xpdf <none>
-- no debconf information
More information about the Pkg-netmeasure-discuss
mailing list