From bfedcd4c79650414b123fad8158c30fb42ad8fb0 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 10 Sep 2018 22:10:56 +0200 Subject: snmp.py: proper creation of non network bound SNMP communities --- src/conf_mode/snmp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py index 051b58cc4..f3406bb5b 100755 --- a/src/conf_mode/snmp.py +++ b/src/conf_mode/snmp.py @@ -138,15 +138,18 @@ agentaddress unix:/run/snmpd.socket{% if listen_on %}{% for li in listen_on %},{ # SNMP communities {%- for c in communities %} -{%- if c.authorization %} +{%- if c.network_v4 %} {%- for network in c.network_v4 %} {{ c.authorization }}community {{ c.name }} {{ network }} {%- endfor %} +{%- else %} +{{ c.authorization }}community {{ c.name }} +{%- endif %} +{%- if c.network_v6 %} {%- for network in c.network_v6 %} {{ c.authorization }}community6 {{ c.name }} {{ network }} {%- endfor %} {%- else %} -{{ c.authorization }}community {{ c.name }} {{ c.authorization }}community6 {{ c.name }} {%- endif %} {%- endfor %} -- cgit v1.2.3