Files
xdp-project-bpf-examples/nat64-bpf
Toke Høiland-Jørgensen b6a3775b6a nat64: Fix header rewrites
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>
2021-09-30 22:35:59 +02:00
..
2021-09-29 01:46:09 +02:00
2021-09-29 01:46:09 +02:00
2021-09-30 22:35:59 +02:00
2021-09-30 22:35:59 +02:00
2021-09-30 22:35:59 +02:00
2021-09-29 01:46:09 +02:00

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