Skip to content

Replace all IFLA_ parsing code with netlink-packet-route parsed data#13

Merged
cathay4t merged 2 commits intorust-netlink:mainfrom
cathay4t:main
Apr 6, 2026
Merged

Replace all IFLA_ parsing code with netlink-packet-route parsed data#13
cathay4t merged 2 commits intorust-netlink:mainfrom
cathay4t:main

Conversation

@cathay4t
Copy link
Copy Markdown
Member

@cathay4t cathay4t commented Apr 6, 2026

All IFLA_ in this project is parsed by netlink-packet-route now.
Remove unused code.

All `IFLA_` in this project is parsed by netlink-packet-route now.
Remove unused code.

Signed-off-by: Gris Ge <fge@redhat.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the link attribute parsing logic in src/ip/link/detail.rs by removing manual constant definitions and custom parsing functions in favor of using native variants from the rtnetlink crate. A compilation error was identified regarding the variant name for the all-multicast attribute, which should be corrected to use 'Allmulti' instead of 'AllMulticast'.

for nl_attr in nl_attrs {
match nl_attr {
LinkAttribute::Promiscuity(p) => promiscuity = *p,
LinkAttribute::AllMulticast(a) => allmulti = *a,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The variant name in netlink-packet-route (and re-exported by rtnetlink) for IFLA_ALLMULTI is Allmulti, not AllMulticast. Using AllMulticast will result in a compilation error.

Suggested change
LinkAttribute::AllMulticast(a) => allmulti = *a,
LinkAttribute::Allmulti(a) => allmulti = *a,

Signed-off-by: Gris Ge <fge@redhat.com>
@cathay4t cathay4t merged commit 7ebc05f into rust-netlink:main Apr 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant