eth_type_trans(9)
π 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 itsstruct sk_buffglory π«Ά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 π
eth_header(9)eth_get_headlen(9)eth_header_cache(9)eth_header_cache_update(9)eth_header_parse_protocol(9)eth_prepare_mac_addr_change(9)eth_commit_mac_addr_change(9)eth_mac_addr(9)ether_setup(9)alloc_etherdev_mqs(9)platform_get_ethdev_address(9)nvmem_get_mac_address(9)fwnode_get_mac_address(9)device_get_mac_address(9)device_get_ethdev_address(9)
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
- 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