-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Correctly parse IFLA_VLAN_PROTOCOL in IPDB interface #393
Conversation
Thanks a lot! Will be merged tomorrow. |
Can you please verify that if this has any impact on #361 My tests might be inconsistent and messy, but compared to pyroute2 0.4.18 this seems to work: This is qinq.py (with ipdb): from pyroute2 import IPDB, NetNS
ipdb = IPDB()
# create host dummy
ipdb.create(kind="dummy", ifname="qtest").commit()
hidx = ipdb.interfaces['qtest']
# create 802.1ad s-vlan interface (external tag)
ipdb.create(kind="vlan", ifname="qtest.50", link=hidx, vlan_id=50, vlan_protocol=0x88a8).commit()
# create 802.1q c-vlan interface (internal tag)
ipdb.create(kind="vlan", ifname="qtest.50.120", link=hidx, vlan_id=120, vlan_protocol=0x8100).commit()
# print the links
for link in (ipdb.interfaces['qtest.50'], ipdb.interfaces['qtest.50.120']):
print(link.ifname)
print("\t%s" % (link.vlan_protocol)) Vanilla pyroute 0.4.18
notice both devices created as type 802.1Q (even though qinq.py displays otherwise) After applying the patch (git master + pr):
** both devices created correctly** I would love to hear your opinion regarding this issue. Thanks! |
Since there is no automatic mapping between NLAs — that may have really weird layout sometimes, as there is no standard — and «flat» IPDB dictionaries, we have to explicitly tell, how to load some specific attributes. Your solution is exactly what I would do to fix the issue. Thanks a lot! Also, notice the test code added to cover the issue: 9a2e02c |
In issue #361 the example file qinq.zip works with IPRoute.
When trying the same with IPDB, parsing the result when committing an interface with vlan_protocol fails:
This fixes the issue for me.
This is the modified qinq.py: