From 4701c066f116f25c9dc784047c23113d37631e72 Mon Sep 17 00:00:00 2001 From: sever-sever Date: Fri, 26 Feb 2021 19:30:55 +0000 Subject: bgp: T3225: Checks if neighbor configured as system address --- src/conf_mode/protocols_bgp.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py index 1f93ceb54..185e5d42f 100755 --- a/src/conf_mode/protocols_bgp.py +++ b/src/conf_mode/protocols_bgp.py @@ -23,6 +23,7 @@ from vyos.configdict import dict_merge from vyos.template import render_to_string from vyos.util import call from vyos.util import dict_search +from vyos.validate import is_addr_assigned from vyos import ConfigError from vyos import frr from vyos import airbag @@ -107,6 +108,10 @@ def verify(bgp): if 'password' in peer_config and ' ' in peer_config['password']: raise ConfigError('You can\'t use spaces in the password') + # Check if neighbor address is assigned as system interface address + if is_addr_assigned(peer): + raise ConfigError(f'Can\'t configure local address as neighbor "{peer}"') + # Some checks can/must only be done on a neighbor and not a peer-group if neighbor == 'neighbor': # remote-as must be either set explicitly for the neighbor -- cgit v1.2.3