__skb_get_hash_net(9)
π __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'sNULL, it gets derived fromskb. So like, you can be lazy about it, no judgment. πskbβ thesk_buffwe'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:
- Kernel file
./net/core/flow_dissector.c skb_flow_get_ports(9)skb_flow_get_icmp_tci(9)__skb_flow_dissect_batadv(9)__skb_flow_dissect(9)skb_get_poff(9)
π 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
- 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