Merge pull request #2177 from blocktrron/pr-wan-radio-ifname
gluon-web-private-wifi: define ifname for WAN radio
This commit is contained in:
commit
9e09d08cf6
13
package/gluon-private-wifi/Makefile
Normal file
13
package/gluon-private-wifi/Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gluon-private-wifi
|
||||
PKG_VERSION:=1
|
||||
|
||||
include ../gluon.mk
|
||||
|
||||
define Package/gluon-private-wifi
|
||||
TITLE:=Provides a virtual access point for the nodes WAN network
|
||||
DEPENDS:=+gluon-core
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackageGluon,gluon-private-wifi))
|
18
package/gluon-private-wifi/luasrc/lib/gluon/upgrade/325-gluon-private-wifi
Executable file
18
package/gluon-private-wifi/luasrc/lib/gluon/upgrade/325-gluon-private-wifi
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local uci = require("simple-uci").cursor()
|
||||
local wireless = require 'gluon.wireless'
|
||||
|
||||
wireless.foreach_radio(uci, function(radio)
|
||||
local radio_name = radio['.name']
|
||||
local suffix = radio_name:match('^radio(%d+)$')
|
||||
local name = "wan_" .. radio_name
|
||||
|
||||
if not uci:get('wireless', name, 'device') then
|
||||
return
|
||||
end
|
||||
|
||||
uci:set('wireless', name, 'ifname', suffix and 'wan' .. suffix)
|
||||
end)
|
||||
|
||||
uci:save('wireless')
|
@ -7,7 +7,7 @@ PKG_RELEASE:=1
|
||||
include ../gluon.mk
|
||||
|
||||
define Package/gluon-web-private-wifi
|
||||
DEPENDS:=+gluon-web-admin
|
||||
DEPENDS:=+gluon-web-admin +gluon-private-wifi
|
||||
TITLE:=UI for activating a private WLAN
|
||||
endef
|
||||
|
||||
|
@ -49,6 +49,7 @@ mfp.default = uci:get('wireless', primary_iface, 'ieee80211w') or "0"
|
||||
function f:write()
|
||||
wireless.foreach_radio(uci, function(radio, index)
|
||||
local radio_name = radio['.name']
|
||||
local suffix = radio_name:match('^radio(%d+)$')
|
||||
local name = "wan_" .. radio_name
|
||||
|
||||
if enabled.data then
|
||||
@ -62,6 +63,7 @@ function f:write()
|
||||
ssid = ssid.data,
|
||||
key = key.data,
|
||||
macaddr = macaddr,
|
||||
ifname = suffix and 'wan' .. suffix,
|
||||
disabled = false,
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user