inet_lookup_reuseport(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… inet_lookup_reuseport(9) πŸ’…

Okay so bestie, welcome to the inet_lookup_reuseport page from the Kernel API Manual β€” this is the one that handles the reuseport logic on an AF_INET socket if it's necessary. Like, only if it needs to. Not out here doing extra work for no reason. ✨


🌸 SYNOPSIS 🌸

struct sock * inet_lookup_reuseport (const struct net *net , struct sock
*sk , struct sk_buff *skb , int doff , __be32 saddr , __be16 sport ,
__be32 daddr , unsigned short hnum , inet_ehashfn_t *ehashfn );

Yeah, it's a whole long signature. Nine arguments. She's got a lot going on but she's iconic for it. πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • net β€” the network namespace. the whole vibe container basically.
  • sk β€” the AF_INET socket. Heads up though: it must be in TCP_LISTEN state for TCP, or TCP_CLOSE for UDP. Non-negotiable, bestie. πŸ‘‘
  • skb β€” the context for a potential SK_REUSEPORT program.
  • doff β€” the header offset.
  • saddr β€” source address.
  • sport β€” source port.
  • daddr β€” destination address.
  • hnum β€” destination port, but in host byte order. yes that matters. πŸ™ˆ
  • ehashfn β€” the hash function used to generate the fallback hash. the backup plan, the understudy, the fallback queen. πŸ’œ

⭐ RETURN ⭐

So what does she give you back?

  • NULL β€” if sk doesn't have SO_REUSEPORT set. like, no reuseport, no results, sorry babe 😭
  • otherwise β€” a pointer to the selected sock, or an error. that's the range. that's the answer. πŸ”₯

ngl this one's short but she's important, so don't sleep on the state requirements for sk. that TCP_LISTEN / TCP_CLOSE thing is a real vibe check. πŸ’€

🧚 SEE ALSO 🧚

Kernel file ./net/ipv4/inet_hashtables.c β€” go read her, she's serving the actual source realness. 🫢


kisses and good vibes from ./net/ipv4 β€” that's the source directory, and the date stamp says October 2026 πŸ’– mwah, go slay your socket lookups πŸ¦‹βœ¨

πŸ“¦ where this page comes from