Page MenuHomeVyOS Platform

Issues with parsing ip range for source nat translation address
Open, Requires assessmentPublicBUG

Description

Hi,
when configure translation address range for source NAT e.g.

set nat source rule 1000 translation address 10.0.0.1-10.0.0.4

following error occurs:

[ nat ]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Make sure you are running the latest version of the code available at
  https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso
- Consult the forum to see how to handle this issue
  https://forum.vyos.io
- Join our community on slack where our users exchange help and advice
  https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your
  business policy requires it)
- and include all the information presented below

Report Time:      2020-06-02 16:48:33
Image Version:    VyOS 1.3-rolling-202006010117
Release Train:    equuleus

Built by:         autobuild@vyos.net
Built on:         Mon 01 Jun 2020 01:17 UTC
Build UUID:       3b4adee9-8c72-4412-9f67-69814c1cf922
Build Commit ID:  be5b71edd77b3a

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

Hardware vendor:  QEMU
Hardware model:   Standard PC (i440FX + PIIX, 1996)
Hardware S/N:
Hardware UUID:    2c727cc1-d960-4984-b342-205b93580b2e

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/nat.py", line 266, in <module>
    verify(c)
  File "/usr/libexec/vyos/conf_mode/nat.py", line 229, in verify
    if addr != 'masquerade' and not is_addr_assigned(addr):
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 132, in is_addr_assigned
    tmp = is_intf_addr_assigned(intf, addr)
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 78, in is_intf_addr_assigned
    return _is_intf_addr_assigned(intf, addr)
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 108, in _is_intf_addr_assigned
    if not _are_same_ip(address, ip_addr):
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 72, in _are_same_ip
    return socket.inet_pton(f_one, one) == socket.inet_pton(f_one, two)
OSError: illegal IP address string passed to inet_pton



[[nat]] failed
Commit failed

Details

Difficulty level
Normal (likely a few hours)
Version
1.3-rolling-202006010117
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

yurij185 created this task.Jun 2 2020, 6:55 AM
pasik added a subscriber: pasik.Jun 2 2020, 11:48 AM

Thank you for reporting this issue, it looks like that parser allows ranges of IP address (IP hyphen IP) but the parser does not. You could get around using CIDR notation but this indeed need looking into.

tux added a subscriber: tux.Aug 14 2020, 6:25 PM
ronie added a subscriber: ronie.Aug 20 2020, 6:04 AM