ethnl_update_u8_u32(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ethnl_update_u8_u32

okay bestie so real quick, this one lives in the Kernel API Manual β€” like, kernel-core, netlink-adjacent, the whole vibe. it's a tiny little helper for pulling a u8 out of an NLA_U32 attribute, and honestly? it's giving "small function, big responsibility." πŸŽ€


✨ NAME ✨

ethnl_update_u8_u32 β€” update a u8 value from an NLA_U32 attribute, slay πŸ’…


🌸 SYNOPSIS 🌸

void ethnl_update_u8_u32 (u8 *dst , const struct nlattr *attr , bool *mod );

that's it, that's the whole signature, look at her go πŸ¦‹


🫢 ARGUMENTS 🫢

  • dst β€” the value you're updating. this is the baby that gets written to, ok so be nice to her.
  • attr β€” the netlink attribute carrying the new value, or null. yes, null is allowed, we'll get to that. πŸ™ˆ
  • mod β€” pointer to a bool for modification tracking. she's the receipts. she remembers if anything actually changed. πŸ’€

🧚 DESCRIPTION 🧚

okay so picture this: some attributes are NLA_U32 on the wire but they're stored in a u8 in memory. mismatch city. not a vibe. that's literally the entire reason this function exists. πŸ”₯

so what she does: she reads that full 32-bit value from the NLA_U32 netlink attribute attr and narrows it down into the u8 pointed to by dst. narrowing, but make it cute. and if attr is null? she does nothing. absolute queen behavior, knows when to not act. ✨

meanwhile the bool pointed to by mod gets set to true if this function changed the value of *dst β€” and if it didn't change anything, mod is just left as is. not touched, not judged, left alone. πŸŽ€

no cap: the narrowing is real, so lowkey keep that in mind. she's not preserving all 32 bits, that's the whole point of the u8. πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group fr fr, go say hi 🌈


mwah, that's a wrap πŸ“ β€” brought to you by ./net/ethtool, October 2026, main character energy only. see you in the next one, bestie πŸ’œ

πŸ“¦ where this page comes from