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

T6100: Added NAT migration from IP/Netmask to Network/Netmask (backport #3291) #3304

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 12, 2024

Change Summary

Added NAT migration from IP/Netmask to Network/Netmask.
In 1.3 allowed using IP/Netmask in Nat rules.
In 1.4 and 1.5 it is prohibited. Allowed Network/Netmask.

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

nat

Proposed changes

Added NAT migration from IP/Netmask to Network/Netmask.
In 1.3 allowed using IP/Netmask in Nat rules.
In 1.4 and 1.5 it is prohibited. Allowed Network/Netmask.

How to test

For example:
VyOS 1.3.6 configuration:

set nat destination rule 2060 destination port '5060,10000-20000'
set nat destination rule 2060 inbound-interface 'eth4'
set nat destination rule 2060 protocol 'udp'
set nat destination rule 2060 source address '!192.0.2.226/27'
set nat destination rule 2060 translation address '10.250.1.3'

Netfilter config in 1.3.6

table ip nat {
        chain PREROUTING {
                type nat hook prerouting priority dstnat; policy accept;
                counter packets 411 bytes 72404 jump VYATTA_PRE_DNAT_HOOK
                iifname "eth4" meta l4proto udp ip saddr != 192.0.2.224/27 udp dport { 5060,10000-20000} counter packets 0 bytes 0 dnat to 10.250.1.3 comment "DST-NAT-2060"
        }

Migration to 1.4 or 1.5 fails, because

vyos@vyos# set nat destination rule 2060 source address '!192.0.2.226/27'

  Error: 192.0.2.226/27 is not a valid IPv4 address range

  Error: 192.0.2.226/27 is not a valid IPv4 prefix

  Error: 192.0.2.226/27 is not a valid IPv4 address

  Error: !192.0.2.226/27 is not a valid IPv4 address range

  Error: !192.0.2.226/27 is not a valid IPv4 prefix

  Error: !192.0.2.226/27 is not a valid IPv4 address



  Invalid value
  Value validation failed
  Set failed

[edit]

After changes:
After migration from 1.3 to 1.4 or 1.5. VyOS config looks

set nat destination rule 2060 destination port '5060,10000-20000'
set nat destination rule 2060 inbound-interface name 'eth4'
set nat destination rule 2060 protocol 'udp'
set nat destination rule 2060 source address '!192.0.2.224/27'
set nat destination rule 2060 translation address '10.250.1.3'

Smoketest result

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

This is an automatic backport of pull request #3291 done by [Mergify](https://mergify.com).

Added NAT migration from IP/Netmask to Network/Netmask.
In 1.3 allowed using IP/Netmask in Nat rules.
In 1.4 and 1.5 it is prohibited. Allowed Network/Netmask.

(cherry picked from commit 52c02ad)
@github-actions github-actions bot added the sagitta VyOS 1.4 LTS label Apr 12, 2024
@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro, sever-sever and c-po and removed request for a team April 12, 2024 18:32
@c-po c-po merged commit 31f281b into sagitta Apr 12, 2024
5 checks passed
@mergify mergify bot deleted the mergify/bp/sagitta/pr-3291 branch April 12, 2024 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sagitta VyOS 1.4 LTS
Development

Successfully merging this pull request may close these issues.

3 participants