Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BFD: parsing bfdaddr failes on BFD event. #54

Open
runborg opened this issue Mar 25, 2024 · 1 comment
Open

BFD: parsing bfdaddr failes on BFD event. #54

runborg opened this issue Mar 25, 2024 · 1 comment

Comments

@runborg
Copy link
Collaborator

runborg commented Mar 25, 2024

There have been inciedents where a BFD case have gotten a incorrect bfdaddr set in zino1 backend.
This makes zinolib fail with this error message:

----> 1 for x in sess.cases_iter():
      2     pass

File ~/zino2/zino-env/lib/python3.10/site-packages/zinolib/ritz.py:535, in ritz.cases_iter(self)
    528 """Return list with cases from zino as a iter
    529
    530 Usage:
    531     for case in ritz_session.cases_iter():
    532         print(case.id)
    533 """
    534 for k in self.get_caseids():
--> 535     yield Case(self, k)

File ~/zino2/zino-env/lib/python3.10/site-packages/zinolib/ritz.py:193, in Case.__init__(self, zino, caseid)
    191 self._zino = zino
    192 self._caseid = caseid
--> 193 self._attrs = self._zino.get_attributes(caseid)

File ~/zino2/zino-env/lib/python3.10/site-packages/zinolib/ritz.py:592, in ritz.get_attributes(self, caseid)
    590 attrlist = self.get_raw_attributes(caseid)
    591 caseinfo = self.convert_attribute_list_to_case_dict(attrlist)
--> 592 caseinfo = self.clean_attributes(caseinfo)
    593 return caseinfo

File ~/zino2/zino-env/lib/python3.10/site-packages/zinolib/ritz.py:633, in ritz.clean_attributes(self, caseinfo)
    631 if "bfdaddr" in caseinfo:
    632     print(caseinfo)
--> 633     caseinfo["bfdaddr"] = ipaddress.ip_address(caseinfo["bfdaddr"])
    635 return caseinfo

File /usr/lib/python3.10/ipaddress.py:54, in ip_address(address)
     51 except (AddressValueError, NetmaskValueError):
     52     pass
---> 54 raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')

ValueError: 'unknown(bad type (0))' does not appear to be an IPv4 or IPv6 address

This happens because zino1 cant detect if this is a IPv4 og IPv6 BFD message.
The reason for this issue happening in the backend in the first place is for now unknown.

i've hotfixed my local zinolib with the following in ritz.py: (sorry, no diff available)

631          if "bfdaddr" in caseinfo:
632             try:
633                 caseinfo["bfdaddr"] = ipaddress.ip_address(caseinfo["bfdaddr"])
634             except ValueError:
635                pass
@runborg
Copy link
Collaborator Author

runborg commented Jun 21, 2024

it might be more correct to return a ip 0.0.0.0 or something like that when this happens?.. so the client does get its ip address but it will be a incorrect address anyways..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant