Page MenuHomeVyOS Platform

Adding a BGP neighbor with an address on a local interface throws a vyos.frr.CommitError: Configuration FRR failed while committing code: ''
Closed, ResolvedPublicBUG

Description

When adding a BGP neighbor with an address on a local interface, running commit throws a vyos.frr.CommitError: Configuration FRR failed while committing code: ''

While this is of course not a valid BGP neighbor configuration, the error message is less than helpful.

Steps to reproduce:

set interfaces loopback lo address 192.0.2.1/32
set protocols bgp 65530 neighbor 192.0.2.1 remote-as 65531
commit

Details

Difficulty level
Normal (likely a few hours)
Version
VyOS 1.4-rolling-202101160747
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Stricter validation

Event Timeline

Viacheslav triaged this task as Normal priority.Mon, Feb 22, 9:37 AM
Viacheslav changed the task status from Open to Needs testing.Fri, Feb 26, 8:19 PM

Fail

set protocols bgp 64501 neighbor 203.0.113.1 remote-as 65001
set protocols bgp 64501 neighbor 203.0.113.1 peer-group FOO
set protocols bgp 64501 peer-group FOO

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/protocols_bgp.py", line 207, in <module>
    verify(c)
  File "/usr/libexec/vyos/conf_mode/protocols_bgp.py", line 112, in verify
    if is_addr_assigned(peer):
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 108, in is_addr_assigned
    tmp = is_intf_addr_assigned(intf, addr)
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 50, in is_intf_addr_assigned
    return _is_intf_addr_assigned(intf, addr)
  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

It seems it's trying to check no only neighbor IP address and also and peer-group name "is_addr_assigned".

The neighbor can contain a string

set protocols bgp 64501 neighbor eth1
set protocols bgp 64501 neighbor eth1 remote-as 65001

commit
Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/protocols_bgp.py", line 212, in <module>
    verify(c)
  File "/usr/libexec/vyos/conf_mode/protocols_bgp.py", line 121, in verify
    if is_addr_assigned(peer):
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 108, in is_addr_assigned
    tmp = is_intf_addr_assigned(intf, addr)
  File "/usr/lib/python3/dist-packages/vyos/validate.py", line 50, in is_intf_addr_assigned
    return _is_intf_addr_assigned(intf, addr)
  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

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

set interfaces ethernet eth1 address 192.0.2.1/24
set protocols bgp 64501 neighbor eth1 interface remote-as '64501'
set protocols bgp 64501 neighbor 192.0.2.1 remote-as 65002

vyos@r-roll01# commit
[ protocols bgp 64501 ]
Can't configure local address as neighbor "192.0.2.1"

[[protocols bgp 64501]] failed
Commit failed
[edit]
vyos@r-roll01#