Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Leseratte10
Copy link
Contributor

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 Leseratte10 force-pushed the patch-allow-prefix-size branch 2 times, most recently from 3a1548f to e2d6aae Compare January 1, 2023 15:50
@Leseratte10 Leseratte10 force-pushed the patch-allow-prefix-size branch from fe11a8b to 50bec7c Compare January 1, 2023 17:12
@Leseratte10 Leseratte10 force-pushed the patch-allow-prefix-size branch 7 times, most recently from 53a7c0f to 5362596 Compare January 22, 2023 11:12
@andrewshadura
Copy link
Owner

You probably wanted to rebase instead :)

@Leseratte10 Leseratte10 force-pushed the patch-allow-prefix-size branch from dfd3aa1 to 2b71280 Compare May 4, 2023 12:26
@Leseratte10
Copy link
Contributor Author

Yeah, I did. Stupid git. Fixed.

@Leseratte10 Leseratte10 force-pushed the patch-allow-prefix-size branch from 2b71280 to ead05d1 Compare May 4, 2023 13:55
Validate some more stuff, add useful return code.
@Leseratte10 Leseratte10 force-pushed the patch-allow-prefix-size branch 5 times, most recently from 88632b2 to 284e496 Compare May 5, 2023 13:52
@Leseratte10
Copy link
Contributor Author

Leseratte10 commented May 5, 2023

Okay, I think this PR should now be somewhat ready for review as well if you want to take a look.

Once my other PR (#8) is merged I'm going to add a test or two for this PR as well (so the other PR should probably be reviewed and merged first), I don't want to do that now so I don't get merge conflicts again that I need to fix.

@Leseratte10 Leseratte10 marked this pull request as ready for review May 5, 2023 14:41
@andrewshadura
Copy link
Owner

Thanks!

I saw you added a test based on Python — since the main implementation of Meson is written in Python (and I want to add Meson build files), yeah, maybe it’s reasonable after all to require Python for tests. Then we probably don’t need to try and find dig, netcat, telnet and other networking tools 🙂

@Leseratte10
Copy link
Contributor Author

The python test was in the other PR (netlink), but yeah, that's what I thought. Python is not that uncommon, and I don't think writing a netlink test in Bash or plain SH is going to be easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants