Skip to main content

run_tun_reader

Function run_tun_reader 

Source
pub fn run_tun_reader(
    device: TunDevice,
    mtu: u16,
    our_addr: FipsAddress,
    tun_tx: TunTx,
    outbound_tx: TunOutboundTx,
    transport_mtu: u16,
    path_mtu_lookup: PathMtuLookup,
)
Expand description

TUN packet reader loop (Linux).

Reads IPv6 packets from the TUN device. Packets destined for FIPS addresses (fd::/8) are forwarded to the Node via the outbound channel for session encapsulation and routing. Non-FIPS packets receive ICMPv6 Destination Unreachable responses.

Also performs TCP MSS clamping on SYN packets to prevent oversized segments.

This is designed to run in a dedicated thread since TUN reads are blocking. The loop exits when the TUN interface is deleted (EFAULT) or an unrecoverable error occurs.