mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
Endianness fixes for IP header length, need to also rewrite Ethernet protocol. Also use direct packet access instead of skb_store_bytes(). Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
NAT64 BPF implementation
This directory contains a BPF implementation of a stateless NAT64 implementation, like that performed by Tayga, but entirely in BPF.
Design:
- Global v6 /96 prefix defined as NAT64 prefix
-
Each interface is assigned a v4 prefix for mapping v6 addresses
- Install onlink v4 route for that prefix to make sure traffic goes out the interface
-
Attach ingress and egress BPF programs to each interface
- On ingress: match v6 packets with a NAT64 prefix destination; remap to v4
- On egress: lookup v4 destination address; if it's in the configured NAT64 prefix, remap back to v6
- Some logic to dynamically assign v4 addresses each time a new v6 source is seen