From f0141773ac9f26f0d8b291006c6c1e01c29c0ef7 Mon Sep 17 00:00:00 2001 From: Darius Date: Thu, 27 Sep 2018 11:08:14 +0300 Subject: [PATCH] luci-app-firewall: remove unused code - unused requirements removed - unused variable and foreach loop removed Signed-off-by: Darius [slightly reword commit message] Signed-off-by: Jo-Philipp Wich --- .../model/cbi/firewall/rule-details.lua | 27 +++---------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua b/applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua index a4763d5dc..def01c669 100644 --- a/applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua +++ b/applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua @@ -1,15 +1,10 @@ -- Copyright 2008 Steven Barth -- Copyright 2010-2012 Jo-Philipp Wich -- Licensed to the public under the Apache License 2.0. - -local sys = require "luci.sys" -local utl = require "luci.util" local dsp = require "luci.dispatcher" -local nxo = require "nixio" - local ft = require "luci.tools.firewall" local nw = require "luci.model.network" -local m, s, o, k, v +local m, s, o, v, _ arg[1] = arg[1] or "" @@ -46,22 +41,6 @@ elseif rule_type == "redirect" then m.title = "%s - %s" %{ translate("Firewall - Traffic Rules"), name } - local wan_zone = nil - - m.uci:foreach("firewall", "zone", - function(s) - local n = s.network or s.name - if n then - local i - for i in utl.imatch(n) do - if i == "wan" then - wan_zone = s.name - return false - end - end - end - end) - s = m:section(NamedSection, arg[1], "redirect", "") s.anonymous = true s.addremove = false @@ -154,9 +133,9 @@ elseif rule_type == "redirect" then o.rmempty = false o.datatype = "ip4addr" - for k, v in ipairs(nw:get_interfaces()) do + for _, v in ipairs(nw:get_interfaces()) do local a - for k, a in ipairs(v:ipaddrs()) do + for _, a in ipairs(v:ipaddrs()) do o:value(a:host():string(), '%s (%s)' %{ a:host():string(), v:shortname() }) -- 2.25.1