summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-07-06 17:59:36 +0200
committerGitHub <noreply@github.com>2023-07-06 17:59:36 +0200
commit67cb7e4f48595d6e0e33aac8e1934cc93f68a5d7 (patch)
tree3bb954dce73f21e67fd60b60bd6a21c0c0942b49 /src
parent0586941f7bc3bcd55721d7c44164ef7a2de9423d (diff)
parent572f79cdf0b13e8160f6a4ef4044f02851d30a1b (diff)
downloadvyos-1x-67cb7e4f48595d6e0e33aac8e1934cc93f68a5d7.tar.gz
vyos-1x-67cb7e4f48595d6e0e33aac8e1934cc93f68a5d7.zip
Merge pull request #2072 from nicolas-fort/T5340
T5340: snmp: add checks while configuring snmp listen-address with an…
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/snmp.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py
index 9b7c04eb0..f4611e15e 100755
--- a/src/conf_mode/snmp.py
+++ b/src/conf_mode/snmp.py
@@ -161,8 +161,12 @@ def verify(snmp):
for address in snmp['listen_address']:
# We only wan't to configure addresses that exist on the system.
# Hint the user if they don't exist
- if not is_addr_assigned(address):
- Warning(f'SNMP listen address "{address}" not configured!')
+ if 'vrf' in snmp:
+ vrf_name = snmp['vrf']
+ if not is_addr_assigned(address, vrf_name) and address not in ['::1','127.0.0.1']:
+ raise ConfigError(f'SNMP listen address "{address}" not configured in vrf "{vrf_name}"!')
+ elif not is_addr_assigned(address):
+ raise ConfigError(f'SNMP listen address "{address}" not configured in default vrf!')
if 'trap_target' in snmp:
for trap, trap_config in snmp['trap_target'].items():