Skip to content

nlmsg_base.get_nested() returns None for both external and noexternal for Geneve devices #795

Closed
@jtluka

Description

@jtluka

This is a generic issue with the *COLLECT_METADATA attributes for tunnel devices such as VXLAN, GENEVE or GRE (or simply any attributes that do not take any value).

For example the pyroute2/netlink/rtnl/ifinfmsg/plugins/geneve.py defines ('IFLA_GENEVE_COLLECT_METADATA', 'none'),.

So, if the tunnel is created with:

ip l add mygnv type geneve external

The netlink message parsed by pyroute2 contains:

('IFLA_LINKINFO', {'attrs': [('IFLA_INFO_KIND', 'geneve'), ('IFLA_INFO_DATA', {'attrs': [('IFLA_GENEVE_ID', 0), ('IFLA_GENEVE_TTL', 0), ('IFLA_GENEVE_TOS', 0), ('IFLA_GENEVE_LABEL', 0), ('IFLA_GENEVE_DF', 'unset'), ('IFLA_GENEVE_PORT', 6081), ('IFLA_GENEVE_COLLECT_METADATA', None), ('IFLA_GENEVE_UDP_ZERO_CSUM6_RX', 1), ('IFLA_GENEVE_TTL_INHERIT', 0)]})]})

If another tunnel with noexternal flag is defined, the IFLA_GENEVE_COLLECT_METADATA is not present in the message.

ip l add mygnv-noext type geneve noexternal id 1234 remote 192.168.101.2 dstport 4444

And the message looks as:

('IFLA_LINKINFO', {'attrs': [('IFLA_INFO_KIND', 'geneve'), ('IFLA_INFO_DATA', {'attrs': [('IFLA_GENEVE_ID', 1234), ('IFLA_GENEVE_REMOTE', '192.168.101.2'), ('IFLA_GENEVE_UDP_CSUM', 0), ('IFLA_GENEVE_TTL', 0), ('IFLA_GENEVE_TOS', 0), ('IFLA_GENEVE_LABEL', 0), ('IFLA_GENEVE_DF', 'unset'), ('IFLA_GENEVE_PORT', 4444), ('IFLA_GENEVE_UDP_ZERO_CSUM6_RX', 1), ('IFLA_GENEVE_TTL_INHERIT', 0)]})]})

When a user wants to fetch the value of the IFLA_GENEVE_COLLECT_METADATA the value would be always None and it's not possible to determine whether the flag is set to external or noexternal because nlmsg_base.get_nested() returns None value also if the attribute could not be found.

I think that it would make sense to change the type of the *COLLECT_METADATA to flag.

@svinota would that work?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions