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

Error parsing OSPF LSDB output: host bits set #20

Closed
rbeumer opened this issue Aug 4, 2021 · 4 comments
Closed

Error parsing OSPF LSDB output: host bits set #20

rbeumer opened this issue Aug 4, 2021 · 4 comments
Assignees

Comments

@rbeumer
Copy link

rbeumer commented Aug 4, 2021

I was testing with the lastest docker image and uploading an OSPF LSDB. The uploading works for an IOS-XR LSDB but when I am testing the output from a Cisco IOS LSDB it trows an internal server error. The Flask logs show the following error:

[2021-08-04 08:54:41 +0000] [13] [ERROR] Error handling request /upload-ospf-lsdb
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 134, in handle
    self.handle_request(listener, req, client, addr)
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 175, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/usr/local/lib/python3.6/site-packages/connexion/apps/abstract.py", line 249, in __call__
    return self.app(environ, start_response)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "routes.pyx", line 2063, in routes.upload_file
  File "Helpers.pyx", line 1883, in Helpers.ParsingHelper.doParseLsdbAndBuildGraph
  File "Helpers.pyx", line 1274, in Helpers.ParsingHelper.parse_router_lsa
  File "/usr/local/lib/python3.6/ipaddress.py", line 1519, in __init__
    raise ValueError('%s has host bits set' % self)
ValueError: x.x.x.x/31 has host bits set

The IP address has obiously been obfuscated.

When I check the LSDB output the IP address mentioned in the error is part of a type 1 router LSA. It is first part of a /31 point to point link and also mentioned als a stub network.

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: x.x.x.x
     (Link Data) Router Interface address: x.x.x.x <== IP address with the /31 mask mentioned in the error
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: x.x.x.x <== IP address with the /31 mask mentioned in the error
     (Link Data) Network Mask: 255.255.255.254
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

The Python IP address library is throwing this error because the address mentioned is not the network address it seems, though with a /31 you won't have a dedicated network address. In my case it is the second address in the /31.

I can't check the code to see why and how the IP address is being checked by the ipaddress module so I can't speculate on how to solve it. Would you be willing to add the code to this repository so others might help solving this issue?

@Vadims06
Copy link
Owner

Vadims06 commented Aug 4, 2021

Hi @rbeumer, thank you for your feedback and for such deep investigation. I met cases when OSPF use non-network addresses and probably my implemented logic doesn't cover all cases) I will try to recreate the issue, fix, release it next week.

@Vadims06 Vadims06 closed this as completed Aug 4, 2021
@Vadims06 Vadims06 reopened this Aug 4, 2021
@Vadims06
Copy link
Owner

Vadims06 commented Aug 8, 2021

Hi @rbeumer, the fix has been released in v2.21.1. Please make a docker-compose pull and provide me an update.

@Vadims06 Vadims06 self-assigned this Aug 8, 2021
@rbeumer
Copy link
Author

rbeumer commented Aug 9, 2021

Thanks! The fix seems to work, uploading the LSDB output is now working without any errors, also no errors from the Flask container.

@Vadims06
Copy link
Owner

fixed

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

2 participants