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: T4499: Fix NAT not showing a single flow entry #1405

Merged
merged 1 commit into from Jul 9, 2022

Conversation

sever-sever
Copy link
Member

@sever-sever sever-sever commented Jul 9, 2022

Change Summary

We must change the dictionary if we get only one flow entry. Op-mode
I.e one NAT record
With single entry we get:

    OrderedDict([('meta', xxx]))

We expect:

    [OrderedDict([('meta', xxx]))]

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

Get only one NAT flow:

vyos@r14:~$ sudo conntrack -L --src-nat
icmp     1 29 src=192.0.2.10 dst=1.1.1.1 type=8 code=0 id=2156 src=1.1.1.1 dst=192.168.122.14 type=0 code=0 id=2156 mark=0 use=1
conntrack v1.4.6 (conntrack-tools): 1 flow entries have been shown.
vyos@r14:~$ 

Before fix we don't see any data:

vyos@r14:~$ show nat source translations
Pre-NAT              Post-NAT             Prot  Timeout  
vyos@r14:~$ 
vyos@r14:~$ show nat source translations detail 
Pre-NAT src          Pre-NAT dst        Post-NAT src         Post-NAT dst      
vyos@r14:~$ 

After fix:

vyos@r14:~$ show nat source translations 
Pre-NAT              Post-NAT             Prot  Timeout  
192.0.2.10           192.168.122.14       icmp  29       
vyos@r14:~$ 
vyos@r14:~$ 
vyos@r14:~$ show nat source translations detail 
Pre-NAT src          Pre-NAT dst        Post-NAT src         Post-NAT dst      
192.0.2.10           1.1.1.1            192.168.122.14       1.1.1.1           
  icmp: 192.0.2.10 ==> 192.168.122.14 timeout: 29 use: 1 
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

We must change dictionary if we get only onle flow entry
I.e one NAT record
With single entry we get:
    OrderedDict([('meta', xxx]))
We expect:
    [OrderedDict([('meta', xxx]))]
@dmbaturin dmbaturin merged commit 9e2fa82 into vyos:current Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants