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

ipdb: IPv6 MP fix breaks handling of tables > 255 #543

Closed
PaulSD opened this issue Sep 22, 2018 · 2 comments
Closed

ipdb: IPv6 MP fix breaks handling of tables > 255 #543

PaulSD opened this issue Sep 22, 2018 · 2 comments

Comments

@PaulSD
Copy link
Contributor

PaulSD commented Sep 22, 2018

8278ecb has broken handling of IPv6 routes in route tables above 255:

# ip -6 route add table 256 1234::/64 dev eth0
# ip route add table 256 1.2.3.0/24 dev eth0
# python
>>> from pyroute2 import IPDB
>>> ipdb = IPDB()
>>> ipdb.routes.tables[256]
[{'metrics': {}, 'oif': 2, 'dst_len': 64, 'family': 10, 'proto': 3, 'tos': 0, 'dst': '1234::/64', 'pref': '00', 'flags': 0, 'ipdb_priority': 0, 'priority': 1024, 'header': {'pid': 3844071573, 'length': 116, 'flags': 2, 'error': None, 'type': 24, 'sequence_number': 257}, 'scope': 0, 'attrs': [('RTA_TABLE', 256), ('RTA_DST', '1234::'), ('RTA_PRIORITY', 1024), ('RTA_OIF', 2), ('RTA_CACHEINFO', {'rta_error': 0, 'rta_id': 0, 'rta_expires': 0, 'rta_ts': 0, 'rta_lastuse': 2159, 'rta_tsage': 0, 'rta_used': 0, 'rta_clntref': 1}), ('RTA_PREF', '00')], 'encap': {}, 'src_len': 0, 'table': 0, 'multipath': (), 'type': 1, 'event': 'RTM_NEWROUTE', 'ipdb_scope': 'system'}, {'oif': 2, 'dst_len': 24, 'family': 2, 'proto': 4, 'tos': 0, 'dst': '1.2.3.0/24', 'ipdb_priority': 0, 'metrics': {}, 'flags': 0, 'encap': {}, 'src_len': 0, 'table': 256, 'multipath': (), 'type': 1, 'scope': 0, 'ipdb_scope': 'system'}]
>>> ipdb.routes.tables[256][0].remove().commit()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pyroute2/ipdb/routes.py", line 584, in commit
    raise error
pyroute2.netlink.exceptions.NetlinkError: (3, 'No such process')

Notice that the IPv6 Route object hasn't been cleaned up properly (it still has 'header' and 'attrs' fields, the 'table' field hasn't been overwritten by the RTA_TABLE attr, etc), although the IPv4 Route object has been cleaned up.
Because of this, the remove() call on the IPv6 route fails because the incorrect 'table' value ends up being sent in RTA_TABLE in the netlink message requesting route deletion.

@PaulSD PaulSD changed the title ipdb: IPv6 MP handling breaks handling of tables > 255 ipdb: IPv6 MP fix breaks handling of tables > 255 Sep 22, 2018
@svinota svinota added the bug label Sep 22, 2018
svinota added a commit that referenced this issue Sep 24, 2018
@svinota
Copy link
Owner

svinota commented Sep 24, 2018

Didn't make a proper test yet (so not closing the ticket), but it should help if I understood the issue.

@PaulSD
Copy link
Contributor Author

PaulSD commented Sep 25, 2019

Sorry, forgot to follow up on this. Yes, it appears fixed now.

@svinota svinota added the fixed label Sep 26, 2019
@svinota svinota closed this as completed Sep 26, 2019
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