Skip to main content

strip_ethernet

Function strip_ethernet 

Source
pub fn strip_ethernet(input: &[u8]) -> Option<&[u8]>
Expand description

Strips the Ethernet header (and any VLAN tags) from a raw frame, returning the IPv4 payload.

Handles untagged frames, single 802.1Q tags, and double-tagged 802.1ad “Q-in-Q” frames (outer 0x88a8 tag followed by an inner 0x8100 tag). Only IPv4 (ETHERTYPE_IP) payloads are recognized; IPv6 and other ethertypes return None.