diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/interfaces-openvpn.py | 10 | ||||
-rwxr-xr-x | src/conf_mode/snmp.py | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 9313e339b..155101f1d 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -264,7 +264,9 @@ compat-names client_tmpl = """ ### Autogenerated by interfaces-openvpn.py ### +{% if ip -%} ifconfig-push {{ ip }} {{ remote_netmask }} +{% endif -%} {% for route in push_route -%} push "route {{ route }}" {% endfor -%} @@ -273,9 +275,9 @@ push "route {{ route }}" iroute {{ net }} {% endfor -%} -{%- if disable %} +{% if disable -%} disable -{% endif %} +{% endif -%} """ default_config_data = { @@ -886,11 +888,9 @@ def verify(openvpn): # subnet = openvpn['server_subnet'].replace(' ', '/') for client in openvpn['client']: - if not ip_address(client['ip']) in ip_network(subnet): + if client['ip'] and not ip_address(client['ip']) in ip_network(subnet): raise ConfigError('Client IP "{}" not in server subnet "{}'.format(client['ip'], subnet)) - - return None def generate(openvpn): 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 |