Page MenuHomeVyOS Platform

Configuring invalid IPv6 EUI64 address results in "OSError: illegal IP address string passed to inet_pton"
Closed, ResolvedPublicBUG

Description

Initiallly reported via: https://forum.vyos.io/t/add-ipv6-address-fails-on-commit/6770

[email protected]# set interfaces ethernet eth0 ipv6 address eui64 2006:ab00:abe1::2/127
[edit]
[email protected]# commit
[ interfaces ethernet eth0 ]
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 stable version of VyOS
  the code is available at https://downloads.vyos.io/?dir=release/current
- Contact us using the online help desk
  https://support.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:      2021-03-16 21:50:30
Image Version:    VyOS 1.4-vrf-202103141559
Release Train:    sagitta

Built by:         [email protected]
Built on:         Sun 14 Mar 2021 15:59 UTC
Build UUID:       63c7a3e8-be9d-4dee-b66f-d3b8cc8787c8
Build Commit ID:  52008c095db540

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

Hardware vendor:  VMware, Inc.
Hardware model:   VMware Virtual Platform
Hardware S/N:     VMware-42 3f 67 73 77 df c4 80-42 c9 42 af ff 15 de 0b
Hardware UUID:    73673f42-df77-80c4-42c9-42afff15de0b

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 157, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 146, in apply
    e.update(ethernet)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/ethernet.py", line 355, in update
    super().update(config)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 1232, in update
    self.add_ipv6_eui64_address(addr)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 550, in add_ipv6_eui64_address
    self.add_addr(f'{eui64}/{prefixlen}')
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 808, in add_addr
    elif not is_intf_addr_assigned(self.ifname, addr):
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 49, in is_intf_addr_assigned
    return _is_intf_addr_assigned(intf, ip, mask)
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 84, in _is_intf_addr_assigned
    if not _are_same_ip(address, ip_addr):
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 44, in _are_same_ip
    return inet_pton(f_one, one) == inet_pton(f_one, two)
OSError: illegal IP address string passed to inet_pton

noteworthy:
cmd 'ethtool -K eth0 ufo off'
returned (out):

returned (err):
Cannot change udp-fragmentation-offload

[[interfaces ethernet eth0]] failed
Commit failed

Details

Difficulty level
Normal (likely a few hours)
Version
1.3.0-rc1
Why the issue appeared?
Design mistake
Is it a breaking change?
Stricter validation
Issue type
Bug (incorrect behavior)

Event Timeline

VyOS 1.2.7-rc1 reports:

[ interfaces ethernet eth0 ipv6 address eui64 2006:ab00:abe1::2/127 ]
Error: Prefix lenght is 127.  It must be 64.

On VyOS 1.3+ the eui64 node uses the ipv6-prefix validator, where /127 is a valid prefix - but we must only allow /64 prefixes.

Even worse, older systems allowed an eui64 prefix of eui64 2006:ab00:abe1::2/64 which is not a prefix but a host address.

Solutions

  • short term: Add a custom (ipv6-FOOBAR) validator which allows any kind of IPv4 /64 address
  • long-term: Add a custom validator which only allows /64 prefixes without host bits and write a migration script that collects all eui64 prefixes and migrates them to the /64 prefix which belongs to the host address.

Ok so I need to allocate a /127 to the eth interfaces.

Ummm this is a no go for now?
What can I do to move this forward?

Assign it with set interfaces ethernet eth0 address 2006:ab00:abe1::2/127

Ok so the IP assignment of the p2p on eth0 needs to be

2606:ab00:abe1:b::2/127

So how is this an invalid IP allocation?

I'm being told over and over that this is the IP I need to use.

@stepler
i tried the following command as it still failed with OSError

set interfaces ethernet eth0 ipv6 address eui64 2606:ab00:abe1::2/127

Is it something with the eui64 in the syntax ?

I guess I'm totally confused at how this works.

I got it to grab an ipv6 address with

set interfaces ethernet eth0 ipv6 address eui64 2606:ab00:ab1:b::/64

But instead of having the IP address, I want that interface to have 2606:ab00:ab1:b::2 it now has

2606:ab00:ab1:b:250:56ff:fe94:8d60/64

@juesor, please try my command; it doesn't have ipv6 or eui64 in it and I just double-checked that it works on 1.3.

@juesor there is a difference in an IPv6 address you explicitly mention as 2606:ab00:abe1::2/127 and an IPv6 EUI64 address.

EUI64 uses a bas /64 prefix - e.g. 2001:db8::/64 and then uses this base prefix to calculate the actual eui64 address upon it. See https://tools.ietf.org/html/rfc4291#section-2.5.1 for more information.

You need the command that @stepler suggested: set interfaces ethernet eth0 address 2006:ab00:abe1::2/127

Nevertheless you have discovered a bug and we are thankful for this.

c-po changed Why the issue appeared? from Will be filled on close to Design mistake.
SrividyaA set Issue type to Bug (incorrect behavior).Aug 31 2021, 2:55 PM