__skb_get_hash_net(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– __skb_get_hash_net β€” NAME πŸ’–

Okay so bestie, this is __skb_get_hash_net β€” the kernel function that literally calculates a flow hash. That's the whole vibe. ✨

It lives in the Kernel API Manual, section 9, iykyk.


🌸 SYNOPSIS 🌸

void __skb_get_hash_net (const struct net *net , struct sk_buff *skb );

That's it. Two args, returns nothing. Void. No notes, no receipts, just vibes and a hash. πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • net β€” the associated network namespace, and here's the cute part: if it's NULL, it gets derived from skb. So like, you can be lazy about it, no judgment. πŸ™ˆ
  • skb β€” the sk_buff we're calculating the flow hash from. This is the main character right here. πŸ‘‘

⭐ DESCRIPTION ⭐

So what does it actually do, you ask? 🫢

This function calculates a flow hash based on the src/dst addresses and the src/dst port numbers. Classic 4-tuple situation. It's giving very "know your traffic" energy.

On success it sets the hash in skb to a non-zero hash value β€” and heads up, zero means there's no valid hash, so if you see a zero, don't celebrate, that's the "nope" state. πŸ’€

It also sets l4_hash in skb if the hash is a canonical 4-tuple hash over transport ports. Which, like, is a whole specific situation, but when it applies it applies. ✨

Lowkey important: non-zero = success, zero = no valid hash. Fr fr, don't mix those up. πŸŽ€

πŸ”₯ SEE ALSO πŸ”₯

Go check these out, they're all in the same friend group:


🌈 CUTE SIGN-OFF 🌈

That's the page, bestie! 🧚 This one's from ./net/core, dated October 2026, sitting pretty in the Kernel API Manual β€” __skb_get_hash_net(9), periodt. πŸ’…πŸ’œ Go hash something iconic. πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from