summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_bgp.py
diff options
context:
space:
mode:
authorsever-sever <v.gletenko@vyos.io>2021-02-26 19:30:55 +0000
committersever-sever <v.gletenko@vyos.io>2021-02-26 19:30:55 +0000
commit4701c066f116f25c9dc784047c23113d37631e72 (patch)
tree813da486bb8902c8f2feed9a64efa78d4d7b6643 /src/conf_mode/protocols_bgp.py
parent2c798f7b9064bc9833935eae534a885b97d34738 (diff)
downloadvyos-1x-4701c066f116f25c9dc784047c23113d37631e72.tar.gz
vyos-1x-4701c066f116f25c9dc784047c23113d37631e72.zip
bgp: T3225: Checks if neighbor configured as system address
Diffstat (limited to 'src/conf_mode/protocols_bgp.py')
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py5
1 files changed, 5 insertions, 0 deletions
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