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

NDB: Route is not found when using destination with prefixlen #808

Closed
mawiegand opened this issue May 27, 2021 · 4 comments
Closed

NDB: Route is not found when using destination with prefixlen #808

mawiegand opened this issue May 27, 2021 · 4 comments

Comments

@mawiegand
Copy link
Contributor

Getting a route via ndb.routes[{"dst": "10.0.4.0/24"}] seems to be no longer working:

>>> ndb.routes[{"dst": "10.0.4.0/24"}]
{'dst': '10.0.4.0/24'}
{'dst': '10.0.4.0/24', 'target': 'localhost'}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/pyroute2/ndb/auth_manager.py", line 69, in guard
    return f(obj, *argv, **kwarg)
  File "/usr/lib/python3/dist-packages/pyroute2/ndb/main.py", line 551, in __getitem__
    ret = self.template(key, table)
  File "/usr/lib/python3/dist-packages/pyroute2/ndb/main.py", line 392, in template
    auth_managers=self.auth_managers)
  File "/usr/lib/python3/dist-packages/pyroute2/ndb/objects/route.py", line 525, in __init__
    super(Route, self).__init__(*argv, **kwarg)
  File "/usr/lib/python3/dist-packages/pyroute2/ndb/objects/__init__.py", line 327, in __init__
    raise KeyError('object does not exists')
KeyError: 'object does not exists'

The same applies to ndb.routes.get({"dst": "10.0.4.0/24"}).

When using

>>> ndb.routes["10.0.4.0/24"]
{'dst': '10.0.4.0', 'dst_len': 24, 'target': 'localhost'}
{'multipath': [], 'metrics': {}, 'dst': '10.0.4.0', 'dst_len': 24, 'target': 'localhost', 'table': 254, 'tflags': 0, 'family': 2, 'tos': 0, 'scope': 253, 'oif': 4, 'priority': 0, 'via': '', 'newdst': '', 'src_len': 0, 'proto': 2, 'type': 1, 'flags': 0, 'src': None, 'iif': None, 'gateway': None, 'prefsrc': '10.0.4.15', 'protoinfo': None, 'flow': None, 'mark': None, 'pref': None, 'encap_type': None, 'route_id': None, 'gc_mark': None}

the route is found.

Tested with pyroute2 version 0.5.19 and 0.6.2.

Would be nice if this could be fixed and maybe patched for version 0.5 which we are using. 🙂

Thanks!

@svinota svinota added the bug label May 27, 2021
@svinota
Copy link
Owner

svinota commented May 27, 2021

Thanks, fixing!

svinota added a commit that referenced this issue May 27, 2021
@mawiegand
Copy link
Contributor Author

Thank you! 6aa174e seems to fix it. 😄
Any plans for a new release in the near future? Otherwise we will patch it on our own. 🙂

@svinota
Copy link
Owner

svinota commented May 28, 2021

0.6.3 will be out on Monday with several minor fixes.

@svinota
Copy link
Owner

svinota commented May 31, 2021

@mawiegand 0.6.3 is out

@svinota svinota closed this as completed Jun 5, 2021
@svinota svinota added the fixed label Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants