Skip to content

linux: add ifaddrmsg and rtattr#5234

Merged
tgross35 merged 2 commits into
rust-lang:mainfrom
sbogomolov:linux-rtnetlink-structs
Jul 1, 2026
Merged

linux: add ifaddrmsg and rtattr#5234
tgross35 merged 2 commits into
rust-lang:mainfrom
sbogomolov:linux-rtnetlink-structs

Conversation

@sbogomolov

@sbogomolov sbogomolov commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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)

@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 thread src/unix/linux_like/linux/mod.rs Outdated
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
Contributor 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?

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.

No need to worry about it for anything where there's already a comment with the header path, for the sake of keeping things together. I'm just trying to nudge any new sections to use src/new instead.

@rustbot

rustbot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

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

rtnetlink message bodies from linux/if_addr.h and linux/rtnetlink.h.
@sbogomolov
sbogomolov force-pushed the linux-rtnetlink-structs branch from 9858b37 to af0a570 Compare July 1, 2026 08:47

@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.

@tgross35
tgross35 enabled auto-merge July 1, 2026 08:55
@tgross35
tgross35 added this pull request to the merge queue Jul 1, 2026
Merged via the queue into rust-lang:main with commit 2ffa363 Jul 1, 2026
56 checks passed
@sbogomolov
sbogomolov deleted the linux-rtnetlink-structs branch July 9, 2026 18:53
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
rtnetlink message bodies from linux/if_addr.h and linux/rtnetlink.h.

(backport <rust-lang#5234>)
(cherry picked from commit cf94474)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
(backport <rust-lang#5234>)
(cherry picked from commit 2ffa363)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
rtnetlink message bodies from linux/if_addr.h and linux/rtnetlink.h.

(backport <rust-lang#5234>)
(cherry picked from commit cf94474)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
(backport <rust-lang#5234>)
(cherry picked from commit 2ffa363)
This was referenced Jul 20, 2026
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
rtnetlink message bodies from linux/if_addr.h and linux/rtnetlink.h.

(backport <rust-lang#5234>)
(cherry picked from commit cf94474)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
(backport <rust-lang#5234>)
(cherry picked from commit 2ffa363)
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author stable-applied This PR has been cherry-picked to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants