Page MenuHomeVyOS Platform

Failure to commit an IPv6 address on a tunnel interface
Closed, ResolvedPublicBUG

Description

This was reported by @kroy on slack

vyos@vyos# commit
[ interfaces tunnel tun0 ]
Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-tunnel.py", line 489, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-tunnel.py", line 478, in apply
    tunnel.add_addr(addr)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 657, in add_addr
    return self._cmd(cmd)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 44, in _cmd
    raise OSError(code, f'{command}\nreturned: {decoded}')
FileNotFoundError: [Errno 2] ip addr add "2a01:04f9:002b:f800::2/64" dev "tun0"
returned: RTNETLINK answers: File exists

VyOS attempted to add an IP address to an interface which already had it set up. This problem was previously harmless as the return code of the ip addr add command was not checked for success. This changed during the 1.3 dev cycle, and errors to run ip commands are now systematically reported to the user.

The code is already checking the IP address, and will only add IPs if not already present.
Unfortunately, IPv6 addresses are not sufficiently normalised when compared, which can lead to issues if users have added the IP themselves using ip addr add and not used the same IPv6 format.

In

def is_intf_addr_assigned(intf, addr)

Here we can see that trailing zero present the IP differently, but expending :: would lead to the same issue.

-> if addr == tmp:
(Pdb) addr
'2a01:04f9:002b:f800::2/64'
(Pdb) tmp
'2a01:4f9:2b:f800::2/64'

Details

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

Event Timeline

@kroy could you please confirm that we can close this issue :-)

erkin set Issue type to Bug (incorrect behavior).Aug 30 2021, 7:53 AM
erkin removed a subscriber: Active contributors.