⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module nat

Module nat 

Source
Expand description

Network Address Translation (NAT) engine

Supports SNAT (source NAT), DNAT (destination NAT), and IP masquerading. Uses a port pool with bitmap allocation for ephemeral port assignment. Implements RFC 1624 incremental checksum updates to avoid full recalculation when translating addresses.

Structs§

NatEngine
The NAT engine managing translations and port allocation
NatMapping
A single NAT mapping recording original and translated addresses
PortPool
Bitmap-based ephemeral port allocator for NAT

Enums§

NatType
Type of NAT translation

Functions§

init
Initialize the NAT engine
update_checksum
Incrementally update a one’s complement checksum when a 16-bit value changes.
update_checksum_32
Update checksum for a 32-bit (IP address) change, processing two 16-bit halves
with_nat
Access the global NAT engine