Changeset 8782

Show
Ignore:
Timestamp:
06/26/12 22:49:18 (11 months ago)
Author:
jow
Message:

modules/admin-full: extend wifi model to allow assigning multiple networks

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua

    r8708 r8782  
    1515local wa = require "luci.tools.webadmin" 
    1616local nw = require "luci.model.network" 
     17local ut = require "luci.util" 
    1718local fs = require "nixio.fs" 
    1819 
     
    416417network.rmempty = true 
    417418network.template = "cbi/network_netlist" 
    418 network.widget = "radio" 
     419network.widget = "checkbox" 
     420network.novirtual = true 
    419421 
    420422function network.write(self, section, value) 
     
    431433            end 
    432434        else 
    433             local n = nw:get_network(value) 
    434             if n then 
    435                 n:set("type", "bridge") 
    436                 n:add_interface(i) 
     435            local v 
     436            for _, v in ipairs(i:get_networks()) do 
     437                v:del_interface(i) 
     438            end 
     439            for v in ut.imatch(value) do 
     440                local n = nw:get_network(v) 
     441                if n then 
     442                    if not n:is_empty() then 
     443                        n:set("type", "bridge") 
     444                    end 
     445                    n:add_interface(i) 
     446                end 
    437447            end 
    438448        end 
     
    719729    local hostapd = fs.access("/usr/sbin/hostapd") 
    720730 
    721     -- Probe EAP support                                                                                                 
    722     local has_ap_eap  = (os.execute("hostapd -veap >/dev/null 2>/dev/null") == 0)                                                         
     731    -- Probe EAP support 
     732    local has_ap_eap  = (os.execute("hostapd -veap >/dev/null 2>/dev/null") == 0) 
    723733    local has_sta_eap = (os.execute("wpa_supplicant -veap >/dev/null 2>/dev/null") == 0) 
    724734