nla_put_net16(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… nla_put_net16 β€” from the Kernel API Manual ✨

okay so bestie, picture this: you're deep in kernel land, you've got a struct sk_buff in your hand, and you need to shove a lil 16-bit value in there in network byte order as a netlink attribute. That's it. That's the whole function. This page in your Kernel API Manual is literally about nla_put_net16, and it is lowkey iconic for how small it is πŸŽ€


✨ NAME ✨

nla_put_net16 β€” add a 16-bit network byte order netlink attribute to a socket buffer πŸ¦‹

No cap, that's the whole job description. She adds, she doesn't read, she doesn't validate, she just puts πŸ’…


🌸 SYNOPSIS 🌸

int nla_put_net16 (struct sk_buff *skb , int attrtype , __be16 value );

Three things in, an int out. Look at her go 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • skb β€” the socket buffer you're adding the attribute to. Your canvas. Your group chat. Add your attribute to it πŸ’–
  • attrtype β€” the attribute type. The little label so everyone knows what this value is. iykyk 🏷️
  • value β€” the numeric value itself. Here's the key part bestie: it's a __be16, so it's network byte order. That's literally the net in the name, don't come for her 🌈

πŸ‘‘ SEE ALSO πŸ‘‘

okay this list is long β€” like, unhinged long β€” but I promised to keep every single one so here we go, no skips, periodt. First up, the file and the structs/enums:

  • Kernel file ./include/net/netlink.h
  • struct nla_policy(9)
  • struct nl_info(9)
  • enum netlink_validation(9)

Then the nlmsg_* message-level crew:

Then sizing/type helpers β€” the little utilities that keep everything aligned and pretty:

Now the nla_put_* family β€” yes, nla_put_net16's siblings, the whole nepo baby lineup πŸ”₯:

And the nla_get_* girlies β€” the read side of the story πŸ’œ:

Finally the nesting / iteration / 64-bit-alignment crowd β€” the ones who make everything fit together 🧚:

ok and that's genuinely all of them, I counted, we do not skip aunties in this house 😭

πŸ’– cute sign-off πŸ’–

and that's the page bestie!! straight out of ./include/net, dated October 2026, page name nla_put_net16(9), Kernel API Manual energy all the way through 🌟 go forth and put your 16 bits, in network byte order, respectfully πŸ’…βœ¨

πŸ“¦ where this page comes from