X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_network%2Fvlan.lua;h=155722669a024a7648e505f44df1fc6269b8f87d;hb=c9f7282d982f10e54fbc083c20e45e03052598fe;hp=0fa2696e8a0f7352afa868aa8acdb67b5ab29134;hpb=7b7030629c4d55557b368a292d7f3e3d14b1923b;p=project%2Fluci.git 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 0fa2696e8..155722669 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua @@ -14,6 +14,7 @@ You may obtain a copy of the License at m = Map("network", translate("Switch"), translate("The network ports on this device can be combined to several VLANs in which computers can communicate directly with each other. VLANs are often used to separate different network segments. Often there is by default one Uplink port for a connection to the next greater network like the internet and other ports for a local network.")) +local fs = require "nixio.fs" local switches = { } m.uci:foreach("network", "switch", @@ -27,8 +28,8 @@ m.uci:foreach("network", "switch", local min_vid = 0 local max_vid = 16 local num_vlans = 16 - local num_ports = 6 - local cpu_port = 5 + local cpu_port = tonumber(fs.readfile("/proc/switch/eth0/cpuport") or 5) + local num_ports = cpu_port + 1 local switch_title local enable_vlan4k = false @@ -202,7 +203,7 @@ m.uci:foreach("network", "switch", local vid = s:option(Value, has_vlan4k or "vlan", "VLAN ID", "
" % switch_name) - local mx_vid = has_vlan4k and 4094 or (num_vlans - 1) + local mx_vid = has_vlan4k and 4094 or (num_vlans - 1) vid.rmempty = false vid.forcewrite = true