skb_gso_size_check(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 from skb_gso_*_seglen). and heads up: in the GSO_BY_FRAGS case 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:

they all ate. no crumbs. 🌈


bestie reminder: seg_len in the GSO_BY_FRAGS case 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