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

T4907: op-mode nat add missing option verbose #1736

Merged
merged 1 commit into from
Jan 3, 2023
Merged

Conversation

sever-sever
Copy link
Member

Change Summary

Add missing option "verbose" for op-mode NAT

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)

Component(s) name

nat

Proposed changes

How to test

VyOS configuration:

set nat source rule 100 outbound-interface 'eth0'
set nat source rule 100 source address '192.0.2.0/24'
set nat source rule 100 translation address 'masquerade'

Before fix:

vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/nat.py show_translations --direction source --family inet --raw
{
    "conntrack": {
        "error": true,
        "reason": "entries not found"
    }
}
vyos@r14:~$ 
vyos@r14:~$ 
vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/nat.py show_translations --direction source --family inet 
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/nat.py", line 331, in <module>
    res = vyos.opmode.run(sys.modules[__name__])
  File "/usr/lib/python3/dist-packages/vyos/opmode.py", line 212, in run
    res = func(**args)
  File "/usr/libexec/vyos/op_mode/nat.py", line 296, in _wrapper
    return func(*args, **kwargs)
  File "/usr/libexec/vyos/op_mode/nat.py", line 326, in show_translations
    return _get_formatted_translation(nat_translation, direction, family, verbose)
NameError: name 'verbose' is not defined
vyos@r14:~$

After fix:

vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/nat.py show_translations --direction source --family inet 
Entries not found
vyos@r14:~$ 
vyos@r14:~$ ping 1.1.1.1 source-address 192.0.2.1
PING 1.1.1.1 (1.1.1.1) from 192.0.2.1 : 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=56 time=38.4 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=56 time=38.3 ms
^C
--- 1.1.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 38.326/38.343/38.361/0.017 ms


vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/nat.py show_translations --direction source --family inet 
Pre-NAT    Post-NAT        Proto    Timeout    Mark    Zone
---------  --------------  -------  ---------  ------  ------
192.0.2.1  192.168.122.14  icmp     26
vyos@r14:~$ 

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

Add missing option "verbose" for op-mode NAT
@c-po c-po requested review from a team, dmbaturin, sarthurdev, zdc, jestabro and c-po and removed request for a team January 3, 2023 11:40
@c-po c-po merged commit 457761d into vyos:current Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants