linux: add ifaddrmsg and rtattr#5234
Open
sbogomolov wants to merge 1 commit into
Open
Conversation
Add the rtnetlink message bodies `struct ifaddrmsg` (<linux/if_addr.h>) and `struct rtattr` (<linux/rtnetlink.h>), beside the existing `ifinfomsg`. They're needed to build/parse RTM_*ADDR and RTM_*LINK dumps and to walk rtattr TLVs.
tgross35
requested changes
Jun 30, 2026
Comment on lines
+1006
to
+1013
| // include/uapi/linux/if_addr.h | ||
| pub struct ifaddrmsg { | ||
| pub ifa_family: c_uchar, | ||
| pub ifa_prefixlen: c_uchar, | ||
| pub ifa_flags: c_uchar, | ||
| pub ifa_scope: c_uchar, | ||
| pub ifa_index: c_uint, | ||
| } |
Contributor
There was a problem hiding this comment.
Please place this in a new file at src/new/linux_uapi/linux/if_addr.rs, and export that new module at src/new/mod.rs. We're nudging new code to the organized new module.
(The existing if_addr.h constants can move there too if you want, or I can do it in a followup)
Author
There was a problem hiding this comment.
Should I do the same for rtnetlink.h? Create a new module and move existing constants and structs?
And for the other two PRs as well?
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
ifaddrmsgandrtattr, the rtnetlink message bodies, next toifinfomsg. Used to parse RTM_*ADDR/RTM_*LINK dumps and walk rtattr attributes.Sources
ifaddrmsg(linux/if_addr.h): https://github.com/torvalds/linux/blob/dc59e4fea9d83f03bad6bddf3fa2e52491777482/include/uapi/linux/if_addr.h#L8rtattr(linux/rtnetlink.h): https://github.com/torvalds/linux/blob/dc59e4fea9d83f03bad6bddf3fa2e52491777482/include/uapi/linux/rtnetlink.h#L219Checklist
libc-test/semverhave been updated*LASTor*MAXare includedcd libc-test && cargo test --target mytarget)