Expand description
Ethernet frame parsing, construction, and ARP handling.
Provides minimal L2 utilities for the custom network datapath:
- Ethernet header parse/construct
- ARP responder (gateway only)
- UDP/IP/Ethernet packet builder for DHCP and DNS responses
Structs§
- ArpResponder
- Responds to ARP requests targeting the gateway IP.
- Ethernet
Header - Parsed Ethernet header fields.
- SynAck
Params - Parameters for constructing a TCP SYN-ACK frame.
- SynParams
- Parameters for constructing a TCP SYN frame (active open).
- TcpFrame
Params - Parameters for constructing TCP frames on the fast path.
- TcpSyn
Options - Peer TCP options observed on an incoming SYN or SYN-ACK frame.
Enums§
- Ether
Type - EtherType values.
Constants§
- ETH_
HEADER_ LEN - Ethernet header size in bytes.
- MAX_
UDP_ PAYLOAD - Largest UDP payload an IPv4 datagram can carry: the 16-bit IP total-length field (65535) minus the IPv4 header (20) and the UDP header (8).
Functions§
- build_
tcp_ ack_ frame - Builds a TCP ACK frame (no payload) to acknowledge data from the guest.
- build_
tcp_ data_ frame - Builds a TCP data frame carrying payload from the host to the guest.
- build_
tcp_ data_ frame_ partial_ csum - Builds a TCP data frame with only a pseudo-header checksum (for GSO).
- build_
tcp_ fin_ frame - Builds a TCP FIN+ACK frame for connection teardown.
- build_
tcp_ rst_ frame - Builds a TCP RST frame for connection abort.
- build_
tcp_ syn_ ack_ frame - Builds a TCP SYN-ACK frame that accepts a guest SYN.
- build_
tcp_ syn_ frame - Builds a TCP SYN frame for active open toward the guest.
- build_
udp_ ip_ ethernet - Builds a guest-bound UDP/IPv4 datagram as one or more Ethernet frames.
- ipv4_
header_ checksum - Computes the IPv4 header checksum (RFC 1071).
- parse_
tcp_ syn_ options - Parses the TCP options field of a SYN (or SYN-ACK) segment.
- prepend_
ethernet_ header - Prepends a 14-byte Ethernet header (IPv4 EtherType) to an IP packet.
- strip_
ethernet_ header - Returns the payload slice after the 14-byte Ethernet header.
- tcp_
checksum - Computes the TCP checksum over the pseudo-header + TCP segment.
- tcp_
pseudo_ header_ checksum - Computes the TCP pseudo-header checksum only (for GSO offload).