diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-05-19 12:22:18 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-05-19 12:22:18 +0000 |
commit | f8ef4ff722377e41a6a8f57caed287c25846bf8d (patch) | |
tree | 209f6b2b87e7d9b1b1202e45b92be46a76861a9d /modules/admin-full | |
parent | 3086947b6706b75f2c1270deaecfe8d110847b28 (diff) |
modules/admin-full: allow vlan 0 for /proc/switch interface
Diffstat (limited to 'modules/admin-full')
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua | 9 |
1 files changed, 7 insertions, 2 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 2a45e60022..e58ac9e991 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua @@ -21,6 +21,7 @@ m.uci:foreach("network", "switch", local has_vlan4k = nil local has_ptpvid = nil local has_jumbo3 = nil + local min_vid = 1 local max_vid = 16 local num_vlans = 16 local num_ports = 5 @@ -67,6 +68,10 @@ m.uci:foreach("network", "switch", end swc:close() + + -- We have no swconfig, assume /proc/switch + else + min_vid = 0 end @@ -219,11 +224,11 @@ m.uci:foreach("network", "switch", vid.validate = function(self, value, section) local v = tonumber(value) local m = has_vlan4k and 4094 or (num_vlans - 1) - if v ~= nil and v > 0 and v <= m then + if v ~= nil and v >= min_vid and v <= m then return value else return nil, - translatef("Invalid VLAN ID given! Only IDs between %d and %d are allowed.", 1, m) + translatef("Invalid VLAN ID given! Only IDs between %d and %d are allowed.", min_vid, m) end end |