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

lib/route: add rtnl_neigh ext flags support #405

Closed

Conversation

ronand-atl
Copy link
Contributor

This PR adds support for extended neighbor flags which are sent as an attribute.

A use case for this feature is being able to detect if an FDB entry has the locked flag set.

@thom311
Copy link
Owner

thom311 commented Sep 12, 2024

hm, while internally kernel merges the 8 bit flags with the ext-flags

    neigh_flags_ext = pn->flags >> NTF_EXT_SHIFT;
    neigh_flags     = pn->flags & NTF_OLD_MASK;

on the netlink API these are basically independent flags (for example, NTF_EXT_MANAGED is 0x1, and not 0x100). That seem an unfortunate decision, because those could just as well be the same flags (with the exception, that on netlink, flags larger than 8 bit are expressed in a new attribute).

Anyway. Since in the kernel API this looks like separate flags, it is also right that they are treated this way in the libnl API. This approach requires us to add 5 new public API functions, when otherwise the existing API was already suitable to express 32bit flags.

include/netlink/route/neighbour.h Outdated Show resolved Hide resolved
lib/route/neigh.c Outdated Show resolved Hide resolved
@ronand-atl ronand-atl force-pushed the add-neigh-ext-flags-support branch 2 times, most recently from cc8cf42 to 039b25b Compare September 13, 2024 05:35
lib/route/neigh.c Outdated Show resolved Hide resolved
The amount of flags that could be stored in the ndm_flags field of ndmsg
was limited to 8, so the kernel introduced a new attribute so more flags
could be represented in netlink messages.

Add support for the extended neighbour flags.
@ronand-atl
Copy link
Contributor Author

Just fixed that small issue and squashed the commits. Let me know if there's any other changes you want me to make, otherwise it should be good to merge :)

thom311 pushed a commit that referenced this pull request Sep 16, 2024
The amount of flags that could be stored in the ndm_flags field of ndmsg
was limited to 8, so the kernel introduced a new attribute so more flags
could be represented in netlink messages.

Add support for the extended neighbour flags.

#405
@thom311
Copy link
Owner

thom311 commented Sep 16, 2024

lgtm. Merged as 014c33a

Thank you!

@thom311 thom311 closed this Sep 16, 2024
@ronand-atl ronand-atl deleted the add-neigh-ext-flags-support branch September 16, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants