summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/model
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-10-10 15:56:42 +0200
committerJo-Philipp Wich <jow@openwrt.org>2014-10-10 15:56:42 +0200
commitbb388f0873b5f9b88c45af5c7d35e9eb9f4ac8ac (patch)
treefe3dd62fbe4a73e838ebeeb39453dfaf6d52e12a /modules/admin-full/luasrc/model
parent0726313815653ffc812c9f87d45cab40bdf24cf6 (diff)
modules/admin-full: add support for configuring mirror port
This adds the LuCI support for setting a mirror port on AR8327 switches. Patch provided by Colin Leitner <colin.leitner@gmail.com> Ref: https://dev.openwrt.org/attachment/ticket/10202 Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/admin-full/luasrc/model')
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua b/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua
index 155722669..fbea03af9 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua
@@ -25,6 +25,7 @@ m.uci:foreach("network", "switch",
local has_learn = nil
local has_vlan4k = nil
local has_jumbo3 = nil
+ local has_mirror = nil
local min_vid = 0
local max_vid = 16
local num_vlans = 16
@@ -74,6 +75,9 @@ m.uci:foreach("network", "switch",
elseif line:match(": enable_learning") then
has_learn = "enable_learning"
+ elseif line:match(": enable_mirror_rx") then
+ has_mirror = "enable_mirror_rx"
+
elseif line:match(": max_length") then
has_jumbo3 = "max_length"
end
@@ -105,6 +109,24 @@ m.uci:foreach("network", "switch",
x.rmempty = true
end
+ -- Does this switch support port mirroring?
+ if has_mirror then
+ s:option(Flag, "enable_mirror_rx", translate("Enable mirroring of incoming packets"))
+ s:option(Flag, "enable_mirror_tx", translate("Enable mirroring of outgoing packets"))
+
+ local sp = s:option(ListValue, "mirror_source_port", translate("Mirror source port"))
+ local mp = s:option(ListValue, "mirror_monitor_port", translate("Mirror monitor port"))
+
+ local pt
+ for pt = 0, num_ports - 1 do
+ local name
+
+ name = (pt == cpu_port) and translate("CPU") or translatef("Port %d", pt)
+
+ sp:value(pt, name)
+ mp:value(pt, name)
+ end
+ end
-- VLAN table
s = m:section(TypedSection, "switch_vlan",