net-mgmt/net-snmp: add listen field (#717)

This commit is contained in:
Michael
2018-06-26 07:18:15 +02:00
committed by Franco Fichtner
parent a1c8b9f8ef
commit 4368fa910a
4 changed files with 24 additions and 3 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= net-snmp
PLUGIN_VERSION= 0.1
PLUGIN_VERSION= 0.2
PLUGIN_COMMENT= Net-SNMP is a daemon for the SNMP protocol
PLUGIN_DEPENDS= net-snmp
PLUGIN_MAINTAINER= m.muenz@gmail.com
@@ -23,4 +23,12 @@
<type>text</type>
<help>Set the contact address to use.</help>
</field>
<field>
<id>general.listen</id>
<label>Listen IPs</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>Set the IP addresses the service should listen to.</help>
</field>
</form>
@@ -19,5 +19,9 @@
<default></default>
<Required>N</Required>
</syscontact>
<listen type="NetworkField">
<FieldSeparator>,</FieldSeparator>
<Required>N</Required>
</listen>
</items>
</model>
@@ -1,8 +1,17 @@
{% if helpers.exists('OPNsense.netsnmp.general.enabled') and OPNsense.netsnmp.general.enabled == '1' %}
{% from 'OPNsense/Macros/interface.macro' import physical_interface %}
{% if helpers.exists('OPNsense.netsnmp.general.listen') and OPNsense.netsnmp.general.listen != '' %}
{% for network in OPNsense.netsnmp.general.listen.split(',') %}
{% if ':' not in network %}
agentAddress udp:{{ network }}:161
{% else %}
agentAddress udp6:[{{ network }}]:161
{% endif %}
{% endfor %}
{% else %}
agentAddress udp:161,udp6:[::1]:161
{% endif %}
{% if helpers.exists('OPNsense.netsnmp.general.community') and OPNsense.netsnmp.general.community != '' %}
rocommunity {{ OPNsense.netsnmp.general.community }}