gluon-luci-private-wifi: set MAC address if the driver provides one
This commit is contained in:
parent
279a409198
commit
b241373640
@ -1,5 +1,7 @@
|
|||||||
local f, s, o, ssid
|
|
||||||
local uci = luci.model.uci.cursor()
|
local uci = luci.model.uci.cursor()
|
||||||
|
local util = require 'gluon.util'
|
||||||
|
|
||||||
|
local f, s, o, ssid
|
||||||
local config = 'wireless'
|
local config = 'wireless'
|
||||||
|
|
||||||
-- where to read the configuration from
|
-- where to read the configuration from
|
||||||
@ -33,19 +35,24 @@ function f.handle(self, state, data)
|
|||||||
if state == FORM_VALID then
|
if state == FORM_VALID then
|
||||||
uci:foreach(config, "wifi-device",
|
uci:foreach(config, "wifi-device",
|
||||||
function(s)
|
function(s)
|
||||||
local device = s['.name']
|
local radio = s['.name']
|
||||||
local name = "wan_" .. device
|
local name = "wan_" .. radio
|
||||||
|
|
||||||
if data.enabled == '1' then
|
if data.enabled == '1' then
|
||||||
|
-- get_wlan_mac_from_driver will return nil (and thus leave the
|
||||||
|
-- MAC address unset) if the driver doesn't provide enough addresses
|
||||||
|
local macaddr = util.get_wlan_mac_from_driver(radio, 4)
|
||||||
|
|
||||||
-- set up WAN wifi-iface
|
-- set up WAN wifi-iface
|
||||||
uci:section(config, "wifi-iface", name,
|
uci:section(config, "wifi-iface", name,
|
||||||
{
|
{
|
||||||
device = device,
|
device = radio,
|
||||||
network = "wan",
|
network = "wan",
|
||||||
mode = 'ap',
|
mode = 'ap',
|
||||||
encryption = 'psk2',
|
encryption = 'psk2',
|
||||||
ssid = data.ssid,
|
ssid = data.ssid,
|
||||||
key = data.key,
|
key = data.key,
|
||||||
|
macaddr = macaddr,
|
||||||
disabled = 0,
|
disabled = 0,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user