skb_gso_size_check(9)
π skb_gso_size_check β the kernel API manual, but make it make sense
okay so bestie, welcome to skb_gso_size_check(9) β yes that's the whole manual section 9, kernel API manual vibes β¨ β and honestly? this little function is doing the most important quiet work and nobody's clapping for it. we're fixing that today. π«Ά
β¨ NAME β¨
skb_gso_size_check β check the skb size, considering GSO_BY_FRAGS π
like literally, that's the whole job. size check. but with spice (the GSO_BY_FRAGS kind of spice). π
πΈ SYNOPSIS πΈ
bool skb_gso_size_check (const struct sk_buff *skb , unsigned int
seg_len , unsigned int max_len );
she takes three things and gives you back a bool. no cap. π¦
π¦ ARGUMENTS π¦
skbβ a GSO skb. that's her. the packet in question. the main character, honestly πseg_lenβ the segmented length (as in, the thing you got fromskb_gso_*_seglen). and heads up: in theGSO_BY_FRAGScase this is gonna be[header sizes + GSO_BY_FRAGS]. yes, literally that. that's not a typo, that's the value. πmax_lenβ the maximum permissible length. the ceiling. the limit. the "you shall not pass" number. π₯
β DESCRIPTION β
So picture this: there are a couple of instances where we have a GSO skb, and we're sitting there likeβ¦ what size would this actually be after it gets segmented? π€ and that question has, like, two flavors of answer depending on what you're trying to check:
- L3+L4+payload size (e.g. IP forwarding) π¦
- L2+L3+L4+payload size (e.g. sanity check before passing to driver) π§
And this function? this function is the helper that does that correctly, considering GSO_BY_FRAGS. because doing it wrong is not the vibe. π
And the answer it gives you: returns true if the segmented length <= max length. periodt. that's the contract. π
π₯ SEE ALSO π₯
Kernel file ./net/core/gso.c β go read it, iykyk π and also the whole friend group:
skb_eth_gso_segment(9)skb_mac_gso_segment(9)__skb_gso_segment(9)skb_gso_transport_seglen(9)skb_gso_network_seglen(9)skb_gso_mac_seglen(9)skb_gso_validate_network_len(9)skb_gso_validate_mac_len(9)
they all ate. no crumbs. π
bestie reminder:seg_lenin theGSO_BY_FRAGScase really is[header sizes + GSO_BY_FRAGS]β don't come for me, that's just what it is π
okay that's the whole page, love u, go check your skb sizes responsibly π
β xoxo, sourced from ./net/core, dropped October 2026, and yes the page is literally called skb_gso_size_check(9) β bye 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