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

nat: T6365: remove warnings for negated interface selections by name #3482

Merged
merged 3 commits into from
May 22, 2024

Conversation

alryaz
Copy link
Contributor

@alryaz alryaz commented May 18, 2024

Change Summary

Avoids spam of invalid warnings when a negated interface name is used.

...
WARNING: NAT interface "!bond0.2" for destination NAT rule "430" does
not exist!
WARNING: NAT interface "!bond0.2" for destination NAT rule "450" does
not exist!
WARNING: NAT interface "!bond0.2" for destination NAT rule "470" does
not exist!
WARNING: NAT interface "!bond0.2" for destination NAT rule "490" does
not exist!
WARNING: NAT interface "!bond0.2" for destination NAT rule "510" does
not exist!
...

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)

https://vyos.dev/T6365

Related PR(s)

none

Component(s) name

  • nat source
  • nat destination

Proposed changes

Added code to parse negation (in a similar manner groups are used).

How to test

set nat destination rule 10 description 'DNS'
set nat destination rule 10 destination address 10.0.0.1
set nat destination rule 10 destination port 53
set nat destination rule 10 inbound-interface name '!eth0'
set nat destination rule 10 protocol 'tcp_udp'
set nat destination rule 10 translation address 172.16.0.1

And perform a commit.

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

@alryaz alryaz changed the title [WIP] fix: remove warnings for negated interface selections by name [WIP] T6365: fix: remove warnings for negated interface selections by name May 18, 2024
@sever-sever
Copy link
Member

Read please contributing; you used an incorrect commit message
https://github.com/vyos/vyos-1x/blob/current/CONTRIBUTING.md#prepare-patchcommit

You can change it with git commit --amend and force push option, to overwrite

@sever-sever sever-sever requested review from a team, dmbaturin, sarthurdev, zdc, jestabro, sever-sever and c-po and removed request for a team May 18, 2024 14:27
src/conf_mode/nat.py Outdated Show resolved Hide resolved
src/conf_mode/nat.py Outdated Show resolved Hide resolved
@c-po c-po added the current label May 22, 2024
@c-po c-po requested a review from a team as a code owner May 22, 2024 17:53
@c-po c-po self-requested a review May 22, 2024 17:53
@c-po c-po changed the title [WIP] T6365: fix: remove warnings for negated interface selections by name nat: T6365: remove warnings for negated interface selections by name May 22, 2024
@c-po
Copy link
Member

c-po commented May 22, 2024

[email protected]:~$ /usr/libexec/vyos/tests/smoke/cli/test_nat.py
test_dnat (__main__.TestNAT.test_dnat) ... ok
test_dnat_negated_addresses (__main__.TestNAT.test_dnat_negated_addresses) ... ok
test_dnat_redirect (__main__.TestNAT.test_dnat_redirect) ... ok
test_dnat_without_translation_address (__main__.TestNAT.test_dnat_without_translation_address) ... ok
test_nat_balance (__main__.TestNAT.test_nat_balance) ... ok
test_nat_no_rules (__main__.TestNAT.test_nat_no_rules) ... ok
test_snat (__main__.TestNAT.test_snat) ... ok
test_snat_groups (__main__.TestNAT.test_snat_groups) ... ok
test_snat_net_port_map (__main__.TestNAT.test_snat_net_port_map) ... ok
test_snat_required_translation_address (__main__.TestNAT.test_snat_required_translation_address) ... ok
test_static_nat (__main__.TestNAT.test_static_nat) ... ok

----------------------------------------------------------------------
Ran 11 tests in 38.363s

OK

@c-po
Copy link
Member

c-po commented May 22, 2024

@Mergifyio backport sagitta

@c-po c-po merged commit 252ae4b into vyos:current May 22, 2024
6 checks passed
Copy link
Contributor

mergify bot commented May 22, 2024

backport sagitta

✅ Backports have been created

dmbaturin added a commit that referenced this pull request May 23, 2024
nat: T6365: remove warnings for negated interface selections by name (backport #3482)
@alryaz alryaz deleted the patch-1 branch May 25, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants