Skip to content
Snippets Groups Projects
Unverified Commit b2413736 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-luci-private-wifi: set MAC address if the driver provides one

parent 279a4091
No related branches found
No related tags found
No related merge requests found
local f, s, o, ssid
local uci = luci.model.uci.cursor()
local util = require 'gluon.util'
local f, s, o, ssid
local config = 'wireless'
-- where to read the configuration from
......@@ -33,19 +35,24 @@ function f.handle(self, state, data)
if state == FORM_VALID then
uci:foreach(config, "wifi-device",
function(s)
local device = s['.name']
local name = "wan_" .. device
local radio = s['.name']
local name = "wan_" .. radio
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
uci:section(config, "wifi-iface", name,
{
device = device,
device = radio,
network = "wan",
mode = 'ap',
encryption = 'psk2',
ssid = data.ssid,
key = data.key,
macaddr = macaddr,
disabled = 0,
}
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment