Commit 6ea5f75e authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(proxy) fix subnet computation using netaddr.IPNetwork, closes...

(proxy) fix subnet computation using netaddr.IPNetwork, closes https://github.com/opnsense/core/issues/1309

(cherry picked from commit 15657d87)
(cherry picked from commit c726dc39)
parent 9ceb4860
......@@ -29,6 +29,7 @@
"""
from operator import itemgetter
import netaddr
# noinspection PyPep8Naming
......@@ -105,3 +106,11 @@ class Helpers(object):
return self._template_in_data['__uuid__'][uuid]
else:
return {}
@staticmethod
def getIPNetwork(network):
""" generate network object using netaddr
:param network: network
:return: IPNetwork
"""
return netaddr.IPNetwork(network)
......@@ -101,7 +101,7 @@ ftp_port {{intf_item.subnet}}:{{ OPNsense.proxy.forward.ftpPort }} accel ftp-tra
{% for interface in OPNsense.proxy.forward.interfaces.split(",") %}
{% for intf_key,intf_item in interfaces.iteritems() %}
{% if intf_key == interface and intf_item.ipaddr != 'dhcp' %}
acl localnet src {{intf_item.ipaddr.split(".")[0:3]|join(".")}}.0/{{intf_item.subnet}} # Possible internal network
acl localnet src {{ helpers.getIPNetwork(intf_item.ipaddr+'/'+intf_item.subnet)[0].format() }}/{{intf_item.subnet}} # Possible internal network
{% endif %}
{% endfor %}
{% if helpers.exists('virtualip') %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment