Page MenuHomeVyOS Platform

CGNAT add check if external and internal pools exists
Closed, ResolvedPublicBUG

Description

To reproduce the bug use non exists pool for the translation rules

set nat cgnat pool external ext-01 external-port-range '1024-65535'
set nat cgnat pool external ext-01 per-user-limit port '2000'
set nat cgnat pool external ext-01 range 192.168.122.222/32

set nat cgnat pool internal int-01 range '100.64.0.0/28'

set nat cgnat rule 10 source pool 'fake-pool'
set nat cgnat rule 10 translation pool 'ext-01'

commit:

vyos@r4# commit
[ nat cgnat ]
VyOS had an issue completing a command.

Report time:      2024-05-16 15:23:29
Image version:    VyOS 1.5-rolling-202405140019
Release train:    current

Built by:         [email protected]
Built on:         Tue 14 May 2024 02:55 UTC
Build UUID:       c30a637d-f3c1-473e-8af6-03c9bfaf0729
Build commit ID:  3463386246a9ac

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (Q35 + ICH9, 2009)
Hardware S/N:     
Hardware UUID:    166cfd25-7d3a-4eca-9ef6-0b655c9acf0f

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/nat_cgnat.py", line 284, in <module>
    generate(c)
  File "/usr/libexec/vyos/conf_mode/nat_cgnat.py", line 240, in generate
    i_count = IPOperations(int_range).get_ips_count()
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/conf_mode/nat_cgnat.py", line 39, in __init__
    self.ip_network = ipaddress.ip_network(ip_prefix) if '/' in ip_prefix else None
                                                         ^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable



[[nat cgnat]] failed
Commit failed
[edit]
vyos@r4#

Details

Difficulty level
Easy (less than an hour)
Version
VyOS 1.5-rolling-202405140019
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Related Objects

StatusSubtypeAssignedTask
Needs testingFEATURE REQUESTNone
ResolvedBUGViacheslav

Event Timeline

PR https://github.com/vyos/vyos-1x/pull/3464

set nat cgnat pool external ext1 external-port-range '1024-65535'
set nat cgnat pool external ext1 per-user-limit port '2000'
set nat cgnat pool external ext1 range 192.168.122.222/32
set nat cgnat pool internal int1 range '100.64.0.0/28'
set nat cgnat rule 10 source pool 'fake-pool'
set nat cgnat rule 10 translation pool 'ext1'


vyos@r4# commit
[ nat cgnat ]
Internal pool "fake-pool" does not exist!

[[nat cgnat]] failed
Commit failed
[edit]
vyos@r4#
Viacheslav changed the task status from Open to In progress.May 16 2024, 4:34 PM
Viacheslav triaged this task as Low priority.
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.5 Circinus board.