fixed issue with services identifying ip4/ip6 addresses
This commit is contained in:
parent
e20da62366
commit
52c6f2f31c
7 changed files with 49 additions and 33 deletions
|
@ -4,6 +4,7 @@ nrl.py: defines services provided by NRL protolib tools hosted here:
|
|||
"""
|
||||
|
||||
from core import utils
|
||||
from core.nodes import ipaddress
|
||||
from core.nodes.ipaddress import Ipv4Prefix
|
||||
from core.services.coreservices import CoreService
|
||||
|
||||
|
@ -36,9 +37,9 @@ class NrlService(CoreService):
|
|||
if hasattr(ifc, "control") and ifc.control is True:
|
||||
continue
|
||||
for a in ifc.addrlist:
|
||||
if a.find(".") >= 0:
|
||||
addr = a.split("/")[0]
|
||||
pre = Ipv4Prefix("%s/%s" % (addr, prefixlen))
|
||||
a = a.split("/")[0]
|
||||
if ipaddress.is_ipv4_address(a):
|
||||
pre = Ipv4Prefix("%s/%s" % (a, prefixlen))
|
||||
return str(pre)
|
||||
# raise ValueError, "no IPv4 address found"
|
||||
return "0.0.0.0/%s" % prefixlen
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue