You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It seems that links to nodes without IP addresses (e.g. hubs, RJ45) causes an error when re-opening the network XML. Upon initial creation and running, it works as expected, but core-pygui produces following error when re-opening due to a bug when parsing the XML:
2020-06-10 10:16:58,428 - ERROR - app:show_exception - app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/netaddr/strategy/ipv4.py", line 125, in str_to_int
return _struct.unpack('>I', _inet_pton(AF_INET, addr))[0]
OSError: illegal IP address string passed to inet_pton
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/netaddr/ip/__init__.py", line 311, in __init__
self._value = self._module.str_to_int(addr, flags)
File "/usr/local/lib/python3.6/dist-packages/netaddr/strategy/ipv4.py", line 129, in str_to_int
raise AddrFormatError('%r is not a valid IPv4 address string!' % addr)
netaddr.core.AddrFormatError: '' is not a valid IPv4 address string!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/netaddr/ip/__init__.py", line 791, in parse_ip_network
ip = IPAddress(val1, module.version, flags=INET_PTON)
File "/usr/local/lib/python3.6/dist-packages/netaddr/ip/__init__.py", line 314, in __init__
% (addr, self._module.version))
netaddr.core.AddrFormatError: base address '' is not IPv4
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/netaddr/strategy/ipv4.py", line 265, in expand_partial_address
tokens = ['%d' % int(addr)]
ValueError: invalid literal for int() with base 10: ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/netaddr/ip/__init__.py", line 928, in __init__
implicit_prefix, flags)
File "/usr/local/lib/python3.6/dist-packages/netaddr/ip/__init__.py", line 795, in parse_ip_network
expanded_addr = _ipv4.expand_partial_address(val1)
File "/usr/local/lib/python3.6/dist-packages/netaddr/strategy/ipv4.py", line 267, in expand_partial_address
raise error
netaddr.core.AddrFormatError: invalid partial IPv4 address: ''!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/core/gui/task.py", line 38, in run
values = self.task(*self.args)
File "/usr/local/lib/python3.6/dist-packages/core/gui/coreclient.py", line 604, in open_xml
self.join_session(response.session_id)
File "/usr/local/lib/python3.6/dist-packages/core/gui/coreclient.py", line 272, in join_session
self.interfaces_manager.joined(session.links)
File "/usr/local/lib/python3.6/dist-packages/core/gui/interface.py", line 126, in joined
index = get_index(interface)
File "/usr/local/lib/python3.6/dist-packages/core/gui/interface.py", line 16, in get_index
net = netaddr.IPNetwork(f"{interface.ip4}/{interface.ip4mask}")
File "/usr/local/lib/python3.6/dist-packages/netaddr/ip/__init__.py", line 938, in __init__
raise AddrFormatError('invalid IPNetwork %s' % addr)
netaddr.core.AddrFormatError: invalid IPNetwork /0
The culprit here seems to be core/gui/interface.py . It is trying to parse ip4 and ip4_mask from links that don't have ip addresses in the saved xml. My current local fix is to check to see if the link has an ip4 within the joined() function:
interface.py
defjoined(self, links: List["core_pb2.Link"]) ->None:
interfaces= []
forlinkinlinks:
iflink.HasField("interface_one"):
interfaces.append(link.interface_one)
iflink.HasField("interface_two"):
interfaces.append(link.interface_two)
# add to used subnets and mark used indexesforinterfaceininterfaces:
# *Ensure an ip4 or ip6 address exists*ifinterface.ip4orinterface.ip6:
subnets=self.get_subnets(interface) # previous commit tried to fix w/ thisindex=get_index(interface)
subnets.used_indexes.add(index)
ifsubnets.key() notinself.used_subnets:
self.used_subnets[subnets.key()] =subnets
I saw that this commit a36674a is trying to solve the same problem, but was still receiving the error.
To Reproduce
Steps to reproduce the behavior:
Make a network that has a RJ45 or Hub linked to another node
Save it as XML
Reopen the XML within core-pygui
See error in log about Invalid IPNetwork
Desktop (please complete the following information):
OS: e.g. Ubuntu 18.04
CORE Version - develop branch, but I believe it will occur in 6.4.0 as well
EMANE Version N/A
The text was updated successfully, but these errors were encountered:
I believe this is now fixed and will avoid this problem, on the develop branch.
In the future I would still like to shift to tracking the subnets used for ipv4/ipv6 individually as well as tracking user changes from the UI to avoid conflicting addresses etc, but there are possibilities of this happening at the moment when a user modifies addresses manually for now.
Describe the bug
It seems that links to nodes without IP addresses (e.g. hubs, RJ45) causes an error when re-opening the network XML. Upon initial creation and running, it works as expected, but core-pygui produces following error when re-opening due to a bug when parsing the XML:
The culprit here seems to be core/gui/interface.py . It is trying to parse ip4 and ip4_mask from links that don't have ip addresses in the saved xml. My current local fix is to check to see if the link has an ip4 within the joined() function:
interface.py
I saw that this commit a36674a is trying to solve the same problem, but was still receiving the error.
To Reproduce
Steps to reproduce the behavior:
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: