summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-26 21:08:11 +0100
committerGitHub <noreply@github.com>2021-02-26 21:08:11 +0100
commitdcd4ae3fbf45169ca062df439a36f911e1bcfb8f (patch)
tree813da486bb8902c8f2feed9a64efa78d4d7b6643 /src/conf_mode
parent2c798f7b9064bc9833935eae534a885b97d34738 (diff)
parent4701c066f116f25c9dc784047c23113d37631e72 (diff)
downloadvyos-1x-dcd4ae3fbf45169ca062df439a36f911e1bcfb8f.tar.gz
vyos-1x-dcd4ae3fbf45169ca062df439a36f911e1bcfb8f.zip
Merge pull request #748 from sever-sever/T3225
bgp: T3225: Checks if neighbor configured as system address
Diffstat (limited to 'src/conf_mode')
-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