Skip to content

linux: add ifaddrmsg and rtattr#5234

Open
sbogomolov wants to merge 1 commit into
rust-lang:mainfrom
sbogomolov:linux-rtnetlink-structs
Open

linux: add ifaddrmsg and rtattr#5234
sbogomolov wants to merge 1 commit into
rust-lang:mainfrom
sbogomolov:linux-rtnetlink-structs

Conversation

@sbogomolov

@sbogomolov sbogomolov commented Jun 30, 2026

Copy link
Copy Markdown

Description

Add ifaddrmsg and rtattr, the rtnetlink message bodies, next to ifinfomsg. Used to parse RTM_*ADDR/RTM_*LINK dumps and walk rtattr attributes.

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are included
  • Tested locally (cd libc-test && cargo test --target mytarget)

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.
@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jun 30, 2026

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR template asks for header links, could you please include them?

View changes since this review

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,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

@sbogomolov sbogomolov Jun 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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?

@rustbot

rustbot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

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

Labels

S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants