summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2016-08-18 09:23:28 +0200
committerJo-Philipp Wich <jo@mein.io>2016-08-18 09:23:32 +0200
commitc390a09cea580ddb0a400c844751f0b65b69d3aa (patch)
tree194a75cf166d0f46710ebd78039cb24ab04ff4de /modules/luci-mod-admin-full
parent4a5635cafa04b4cdf47c0fd9d97d6d1b7595a8bd (diff)
luci-mod-admin-full: fallback to generic switch topology
Use a generic default topology if we cannot infer switch information from board.json and display an error message in this case. Should fix #779 and similar issues. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-admin-full')
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
index 20715f0ed..902767c90 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
@@ -30,9 +30,23 @@ m.uci:foreach("network", "switch",
local topo = topologies[switch_name]
+ if not topo then
+ m.message = translatef("Switch %q has an unknown topology - the VLAN settings might not be accurate.", switch_name)
+ topo = {
+ ports = {
+ { num = 0, label = "Port 1" },
+ { num = 1, label = "Port 2" },
+ { num = 2, label = "Port 3" },
+ { num = 3, label = "Port 4" },
+ { num = 4, label = "Port 5" },
+ { num = 5, label = "CPU (eth0)", tagged = false }
+ }
+ }
+ end
+
-- Parse some common switch properties from swconfig help output.
local swc = io.popen("swconfig dev %q help 2>/dev/null" % switch_name)
- if swc and topo then
+ if swc then
local is_port_attr = false
local is_vlan_attr = false