Skip to content
Snippets Groups Projects
Commit 10476dc8 authored by Pierre Lalet's avatar Pierre Lalet
Browse files

Merged in p-l/scapy (pull request #131)

Fix IPv6 random addresses (thanks Guillaume Valadon!)
parents d8671fbe 8986cc34
No related branches found
No related tags found
No related merge requests found
...@@ -294,7 +294,7 @@ class RandIP6(RandString): ...@@ -294,7 +294,7 @@ class RandIP6(RandString):
remain = random.randint(0,remain) remain = random.randint(0,remain)
for j in range(remain): for j in range(remain):
ip.append("%04x" % random.randint(0,65535)) ip.append("%04x" % random.randint(0,65535))
if n == 0: elif n == 0:
ip.append("0") ip.append("0")
elif not n: elif not n:
ip.append("") ip.append("")
...@@ -303,7 +303,7 @@ class RandIP6(RandString): ...@@ -303,7 +303,7 @@ class RandIP6(RandString):
if len(ip) == 9: if len(ip) == 9:
ip.remove("") ip.remove("")
if ip[-1] == "": if ip[-1] == "":
ip[-1] = 0 ip[-1] = "0"
return ":".join(ip) return ":".join(ip)
class RandOID(RandString): class RandOID(RandString):
......
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