ethnl_put_strz(9)
π ethnl_put_strz(9) β the Kernel API Manual
ok so bestie, we're in the Kernel API Manual today and this little function is genuinely iconic. it's ethnl_put_strz and it's giving "i put a string in a message" energy. yes it's a whole vibe. no cap.
β¨ SYNOPSIS β¨
int ethnl_put_strz (struct sk_buff *skb , u16 attrtype , const char *s );
that's it. three args, one int coming back. slay.
π ARGUMENTS π
skbβ theskbthat's holding the message π this is the whole context, ok, don't lose it.attrtypeβ the attribute type. literally just which attribute we're talking about π·οΈsβ a string that'sETH_GSTRING_LENsized. and bestie, heads up: it may not be null terminated π read that again. it's not guaranteed to have that little\0at the end.
π¦ DESCRIPTION π¦
it puts an attribute into the message β one with a null terminated string made from s. so like, the attribute you get out there is null terminated, even if s wasn't. that's the glow-up fr fr β¨
π₯ RETURN π₯
0on success β we ate π- a negative error code on failure β something went wrong, cry about it π
πΈ friendly reminder:sisETH_GSTRING_LENsized and may not be null terminated, so don't go assuming things about it. that's the whole point of this function existing, iykyk.
π SEE ALSO π
Kernel file ./net/ethtool/netlink.h plus the whole friend group:
ethnl_strz_size(9)ethnl_update_u32(9)ethnl_update_u8(9)ethnl_update_u8_u32(9)ethnl_update_bool32(9)ethnl_update_bool(9)ethnl_update_binary(9)ethnl_update_bitfield32(9)ethnl_reply_header_size(9)struct ethnl_req_info(9)ethnl_req_get_phydev(9)struct ethnl_reply_data(9)struct ethnl_request_ops(9)
ok that's the whole page, ily, go write some netlink attributes π
this masterpiece lives in ./net/ethtool, dated October 2026, and it's part of the Kernel API Manual β see u next time bestie π«Άπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms