diff options
| author | Stijn Tintel | 2022-01-06 17:52:40 +0000 |
|---|---|---|
| committer | Stijn Tintel | 2022-01-09 13:22:34 +0000 |
| commit | 07579df54f38d75afea44b2a3b41a6d9af9497a1 (patch) | |
| tree | a15ed7ecbd0f404e1635fa47752eae8ef575dc9a | |
| parent | 69a89d60cae16fe128a547ac27d2498938effbf9 (diff) | |
| download | firewall4-07579df54f38d75afea44b2a3b41a6d9af9497a1.tar.gz | |
fw4.uc: handle interface zone option
With firewall3 it is possible to specify the firewall zone in interface
sections in /etc/config/network. Handle this in firewall4 as well.
Suggested-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
| -rw-r--r-- | root/usr/share/ucode/fw4.uc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc index bfc568e..b55ad79 100644 --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -378,7 +378,8 @@ return { for (let ifc in ifaces.interface) { let net = { up: ifc.up, - device: ifc.l3_device + device: ifc.l3_device, + zone: ifc.data?.zone }; if (type(ifc["ipv4-address"]) == "array") { @@ -1718,9 +1719,15 @@ return { let match_devices = []; let related_subnets = []; + let related_ubus_networks = []; let match_subnets, masq_src_subnets, masq_dest_subnets; - for (let e in to_array(zone.network)) { + for (let name, net in this.state.networks) { + if (net.zone === zone.name) + push(related_ubus_networks, { invert: false, device: name }); + } + + for (let e in [ ...to_array(zone.network), ...related_ubus_networks ]) { if (exists(this.state.networks, e.device)) { let net = this.state.networks[e.device]; |