Skip to content

Add source_ipv6_prefixes parametr to nat64stateful - #332

Open
glumpo wants to merge 2 commits into
yanet-platform:mainfrom
glumpo:src_nat64stateful
Open

Add source_ipv6_prefixes parametr to nat64stateful#332
glumpo wants to merge 2 commits into
yanet-platform:mainfrom
glumpo:src_nat64stateful

Conversation

@glumpo

@glumpo glumpo commented Jul 23, 2026

Copy link
Copy Markdown

Adds optional source_ipv6_prefixes field support to nat64stateful modules.

The control plane now:

  • Selects a NAT64 module using both source and destination IPv6 prefixes.
  • Preserves existing behavior with ::/0 as the default source prefix.
  • Exposes source prefixes in the nat64stateful CLI output.

@glumpo
glumpo requested a review from GeorgyKirichenko as a code owner July 23, 2026 14:17
@ezhk

ezhk commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

There is a source-prefix parsing issue to fix before merge.

source_ipv6_prefixes validates the mask with std::stoul(mask_string) (decimal), but then constructs ipv6_prefix_t from the original string. That constructor parses the mask with base 0, so leading-zero masks are interpreted as octal: for example, 2001:db8::/064 passes validation but becomes /52, while ::/08 becomes /0. This can make the generated ACL select the NAT64 module for a much broader source range than configured.

Please construct the prefix using the already-parsed decimal mask (or reject noncanonical leading-zero masks).

The added autotest currently checks only the default ::/0 CLI output. It would also be valuable to configure a non-default source prefix and verify packets from both matching and non-matching source ranges.

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