keep IPv4 addrs as IPv4
This commit is contained in:
+12
@@ -33,6 +33,8 @@ class Connection:
|
|||||||
def __init__(self, host, cid, addr, afam):
|
def __init__(self, host, cid, addr, afam):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.cid = cid
|
self.cid = cid
|
||||||
|
if addr[0:7] == "::ffff:":
|
||||||
|
addr = addr[7:]
|
||||||
self.addr = addr
|
self.addr = addr
|
||||||
self.afam = afam
|
self.afam = afam
|
||||||
self.rtts = [0]
|
self.rtts = [0]
|
||||||
@@ -245,6 +247,8 @@ class Host:
|
|||||||
return addr.find(".") > 0
|
return addr.find(".") > 0
|
||||||
|
|
||||||
def conndata(self, cid, addr, rtt, now):
|
def conndata(self, cid, addr, rtt, now):
|
||||||
|
if addr[0:7] == "::ffff:":
|
||||||
|
addr = addr[7:]
|
||||||
if self.isIPv4(addr):
|
if self.isIPv4(addr):
|
||||||
afam = "IPv4"
|
afam = "IPv4"
|
||||||
else:
|
else:
|
||||||
@@ -259,6 +263,14 @@ class Host:
|
|||||||
|
|
||||||
# called when reloading class from pickle, add new fields here
|
# called when reloading class from pickle, add new fields here
|
||||||
def fixup(self):
|
def fixup(self):
|
||||||
|
for c in ["IPv4", "IPv6"]:
|
||||||
|
print("Host %s" % self.name)
|
||||||
|
if c in self.connections:
|
||||||
|
addr = self.connections[c].addr
|
||||||
|
if addr[0:7] == "::ffff:":
|
||||||
|
addr = addr[7:]
|
||||||
|
self.connections[c].addr = addr
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# def dispstate(self):
|
# def dispstate(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user