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

nat64: T6403: validate source prefix for RFC compliance #3572

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

talmakion
Copy link
Contributor

Change Summary

Simplest fix is to comply with RFC6052. The code change is just masking out the relevant bits and ensuring they're zeroed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

  • nat64

Proposed changes

This just ensures the configured source prefix will be accepted by Jool.

It may be preferable to --force the config for maximum flexibility, but I've opted for standards compliance here (and it's a bit less work).

How to test

vyos@TEST-VYOS-LEFT# compare
+ nat64 {
+     source {
+         rule 10 {
+             source {
+                 prefix "64:2001:db8:101:101::/96"
+             }
+             translation {
+                 pool 10 {
+                     address "192.0.2.1"
+                     port "1-65535"
+                 }
+             }
+         }
+     }
+ }

[edit]
vyos@TEST-VYOS-LEFT# commit
[ nat64 ]
Source NAT64 rule 10 source prefix is not RFC6052-compliant: bits 64 to
71 (9th octet) must be zeroed

[[nat64]] failed
Commit failed
[edit]
vyos@TEST-VYOS-LEFT# set nat64 source rule 10 source prefix 64:2001:db8:101:1::/96
[edit]
vyos@TEST-VYOS-LEFT# commit
[edit]
vyos@TEST-VYOS-LEFT# 

Smoketest result

$ python3 /usr/libexec/vyos/tests/smoke/cli/test_nat64.py
test_snat64 (main.TestNAT64.test_snat64) ... ok


Ran 1 test in 12.396s

OK

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Simplest fix is to comply with RFC6052. The code change is just masking
out the relevant bits and ensuring they're zeroed.
@talmakion
Copy link
Contributor Author

I did consider using --force with Jool to just allow it, but this may have other undesirable impacts. The Jool issue goes over how it's probably an oversight of the RFC creators but they'll only accept it with --force.

@dmbaturin dmbaturin merged commit e74970c into vyos:current Jun 3, 2024
7 of 8 checks passed
@talmakion talmakion deleted the bugfix/T6403 branch June 11, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants