eth_type_trans(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… eth_type_trans(9) β€” the Kernel API Manual page, bestie edition πŸŽ€

okay so this is a page from the Kernel API Manual, and it's literally about one little function that figures out what protocol a packet is speaking. short page, iconic function, let's go ✨


🌸 NAME 🌸

eth_type_trans β€” determine the packet's protocol ID. that's it. that's the whole job. it looks at a packet and is like "bestie, what even ARE you" and then tells you πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

__be16 eth_type_trans (struct sk_buff *skb , struct net_device *dev );

it gives you back a __be16 (that's the protocol ID, big-endian, no cap) and it takes two things. we'll get to those πŸ‘‡


πŸ’œ ARGUMENTS πŸ’œ

  • skb β€” received socket data. the actual packet that showed up, in all its struct sk_buff glory 🫢
  • dev β€” receiving network device. the NIC (or whatever) that this packet came in on 🌈

⭐ DESCRIPTION ⭐

the rule here is lowkey simple and highkey important: we assume 802.3 if the type field is short enough to be a length. like, if that field is smol enough that it could plausibly be a length instead of a type, we go with 802.3. that's the vibe check 🧚

and this is normal practice!! it works for any 'now in use' protocol. so like, no stress, this is the standard move and it slays πŸ’…

heads up: the whole thing hinges on that "short enough to be a length" rule, so don't go assuming it's magic. it's a rule, it's deliberate, that's the tea πŸ“

πŸ”₯ SEE ALSO πŸ”₯

all of these live in the kernel file ./net/ethernet/eth.c and honestly they're all giving ethernet main character energy πŸ‘‘

like, go read them, they're all part of the same friend group 🫢✨


and that's the page, bestie!! this one comes straight out of ./net/ethernet, dated October 2026, and it's eth_type_trans(9) β€” mwah πŸ’‹ periodt πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from