svinota / pyroute2

Python Netlink and PF_ROUTE library — network configuration and monitoring
https://pyroute2.org/
Other
948 stars 243 forks source link

NDB MPLS Not working #1114

Open svenauhagen opened 1 year ago

svenauhagen commented 1 year ago

Hi,

I am on the latest 0.7.9 release and I can not query any MPLS routes. IPRoute gets them just fine:

>>> ipr = IPRoute()
>>> ipr.route('show', family=AF_MPLS)
({'family': 28, 'dst_len': 20, 'src_len': 0, 'tos': 0, 'table': 254, 'proto': 4, 'scope': 0, 'type': 1, 'flags': 0, 'attrs': [('RTA_DST', [{'label': 110, 'tc': 0, 'bos': 1, 'ttl': 0}]), ('RTA_NEWDST', [{'label': 200, 'tc': 0, 'bos': 1, 'ttl': 0}]), ('RTA_VIA', {'family': 2, 'addr': '192.168.10.1'}), ('RTA_OIF', 5)], 'header': {'length': 64, 'type': 24, 'flags': 2, 'sequence_number': 255, 'pid': 4185219065, 'error': None, 'target': 'localhost', 'stats': Stats(qsize=0, delta=0, delay=0)}, 'event': 'RTM_NEWROUTE'}, {'family': 28, 'dst_len': 20, 'src_len': 0, 'tos': 0, 'table': 254, 'proto': 4, 'scope': 0, 'type': 1, 'flags': 0, 'attrs': [('RTA_DST', [{'label': 200, 'tc': 0, 'bos': 1, 'ttl': 0}]), ('RTA_VIA', {'family': 2, 'addr': '192.168.10.1'}), ('RTA_OIF', 5)], 'header': {'length': 56, 'type': 24, 'flags': 2, 'sequence_number': 255, 'pid': 4185219065, 'error': None, 'target': 'localhost', 'stats': Stats(qsize=0, delta=0, delay=0)}, 'event': 'RTM_NEWROUTE'})
>>> ndb = NDB(log='debug')
2023-07-27 13:58:55,667    DEBUG pyroute2.ndb.281472798781248.sources.localhost: init
2023-07-27 13:58:55,668    DEBUG pyroute2.ndb.281472798781248.sources.localhost: starting the source
2023-07-27 13:58:55,668    DEBUG pyroute2.ndb.281472798781248.sources.localhost/nsmanager: init
2023-07-27 13:58:55,669    DEBUG pyroute2.ndb.281472798781248.sources.localhost: connecting
2023-07-27 13:58:55,669    DEBUG pyroute2.ndb.281472798781248.sources.localhost: loading
2023-07-27 13:58:55,671    DEBUG pyroute2.ndb.281472798781248.sources.localhost/nsmanager: starting the source
2023-07-27 13:58:55,671    DEBUG pyroute2.ndb.281472798781248.sources.localhost/nsmanager: connecting
2023-07-27 13:58:55,684    DEBUG pyroute2.ndb.281472798781248.sources.localhost/nsmanager: loading
2023-07-27 13:58:55,689    DEBUG pyroute2.ndb.281472798781248.sources.localhost: running
2023-07-27 13:58:55,694    DEBUG pyroute2.ndb.281472798781248.sources.localhost/nsmanager: running
>>> ndb.routes.dump().filter(family=AF_MPLS)

>>>

Here are the actual routes in my system:

ip -f mpls r s 110 as to 200 via inet 192.168.10.1 dev eno0 proto static 200 via inet 192.168.10.1 dev eno0 proto static

Anything I can try out or debug on my end to find out the problem?

Best and thanks Sven

svenauhagen commented 1 year ago

I found the problem, the initial dump is not including MPLS routes. I just sent a PR for it.

svinota commented 1 year ago

Thanks!