tnat64 icon indicating copy to clipboard operation
tnat64 copied to clipboard

Add support for NAT64 prefix sizes other than /96 (RFC6052)

Open Leseratte10 opened this issue 1 year ago • 5 comments

This PR fixes a couple small bugs I've noticed:

  • The IPv4 subnet in the config file - which previously had to be entered like 192.168.0.0/255.255.0.0 can now also just be entered as 192.168.0.0/16.
  • Previously, the code assumed that the NAT64 prefix size was always /96 and that the IPv4 address was always stored in the last four bytes of the IPv6 address. With RFC6052, other prefix sizes larger than /96 can also be used, which have the IPv4 address stored at another position in the IPv6 address. The remaining unused bits at the end are the so-called suffix which can now be set using the config option nat64_suffix, if needed. If not set, these bits are set to 0.

Right now I haven't yet been able to fully test this, so I'm making it a draft PR in case you already want to look at the code. I'm going to try to do a bunch of testing in the next couple days to make sure that's all working as intended.

Leseratte10 avatar Jan 01 '23 14:01 Leseratte10