summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-25 15:08:04 +0100
committerGitHub <noreply@github.com>2020-03-25 15:08:04 +0100
commit11f5d7c3669e6f20b61470c439929ef410e62ff5 (patch)
tree4937123b593198f557c25f4d3367084422b166ec /src/conf_mode
parent6e7739e0b69e1d3371ebe36218604cbb1aca18b1 (diff)
parentda3bc26bf94efc04d9e92ff37392e621f6e1a742 (diff)
downloadvyos-1x-11f5d7c3669e6f20b61470c439929ef410e62ff5.tar.gz
vyos-1x-11f5d7c3669e6f20b61470c439929ef410e62ff5.zip
Merge pull request #268 from Elbandi/fixsnmp
T2161: Skip ipv6 listen, if it is disabled
Diffstat (limited to 'src/conf_mode')
-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 812819c59..34832aac1 100755
--- a/src/conf_mode/snmp.py
+++ b/src/conf_mode/snmp.py
@@ -121,7 +121,7 @@ SysDescr {{ description }}
{%- endif %}
# Listen
-agentaddress unix:/run/snmpd.socket{% if listen_on %}{% for li in listen_on %},{{ li }}{% endfor %}{% else %},udp:161,udp6:161{% endif %}
+agentaddress unix:/run/snmpd.socket{% if listen_on %}{% for li in listen_on %},{{ li }}{% endfor %}{% else %},udp:161{% if ipv6_enabled %},udp6:161{% endif %}{% endif %}
# SNMP communities
{%- for c in communities %}
@@ -207,6 +207,7 @@ extend {{ ext.name }} {{ ext.script }}
default_config_data = {
'listen_on': [],
'listen_address': [],
+ 'ipv6_enabled': 'True',
'communities': [],
'smux_peers': [],
'location' : '',
@@ -236,6 +237,9 @@ def get_config():
if not conf.exists('service snmp'):
return None
else:
+ if conf.exists('system ipv6 disable'):
+ snmp['ipv6_enabled'] = False
+
conf.set_level('service snmp')
version_data = get_version_data()
@@ -556,7 +560,7 @@ def verify(snmp):
if is_ipv4(addr):
# example: udp:127.0.0.1:161
listen = 'udp:' + addr + ':' + port
- else:
+ elif snmp['ipv6_enabled']:
# example: udp6:[::1]:161
listen = 'udp6:' + '[' + addr + ']' + ':' + port