mirror of https://github.com/aredn/aredn.git
Make sure switching wifi modes forces a reboot. (#1027)
Because some hardware doesnt handle this well.
This commit is contained in:
parent
14494a477f
commit
cc5c7cafd0
|
@ -1058,11 +1058,13 @@ end
|
|||
--- Make it official
|
||||
---
|
||||
|
||||
-- Handle /etc/config/aredn specially because only some changes require a restart/reboot
|
||||
local config_aredn = {
|
||||
-- Handle special cases
|
||||
local config_special = {
|
||||
lqm_enable = c:get("aredn", "@lqm[0]", "enable"),
|
||||
tunnel_weight = c:get("aredn", "@tunnel[0]", "weight"),
|
||||
supernode_enable = c:get("aredn", "@supernode[0]", "enable")
|
||||
supernode_enable = c:get("aredn", "@supernode[0]", "enable"),
|
||||
wifi_mode_0 = c:get("wireless", "@wifi-iface[0]", "mode"),
|
||||
wifi_mode_1 = c:get("wireless", "@wifi-iface[1]", "mode")
|
||||
}
|
||||
local nfiles = {}
|
||||
for file in nixio.fs.glob("/tmp/new_config/*")
|
||||
|
@ -1086,13 +1088,13 @@ do
|
|||
changes.system = true
|
||||
elseif file == "aredn" then
|
||||
local oc = uci:cursor()
|
||||
if oc:get("aredn", "@lqm[0]", "enable") ~= config_aredn.lqm_enable then
|
||||
if oc:get("aredn", "@lqm[0]", "enable") ~= config_special.lqm_enable then
|
||||
changes.manager = true
|
||||
end
|
||||
if oc:get("aredn", "@tunnel[0]", "weight") ~= config_aredn.tunnel_weight then
|
||||
if oc:get("aredn", "@tunnel[0]", "weight") ~= config_special.tunnel_weight then
|
||||
changes.olsrd = true
|
||||
end
|
||||
if oc:get("aredn", "@supernode[0]", "enable") ~= config_aredn.supernode_enable then
|
||||
if oc:get("aredn", "@supernode[0]", "enable") ~= config_special.supernode_enable then
|
||||
changes.reboot = true
|
||||
end
|
||||
elseif file == "network" then
|
||||
|
@ -1104,7 +1106,12 @@ do
|
|||
elseif file == "firewall" then
|
||||
changes.firewall = true
|
||||
elseif file == "wireless" then
|
||||
changes.wireless = true
|
||||
local oc = uci:cursor()
|
||||
if oc:get("wireless", "@wifi-iface[0]", "mode") ~= config_special.wifi_mode_0 or oc:get("wireless", "@wifi-iface[1]", "mode") ~= config_special.wifi_mode_1 then
|
||||
changes.reboot = true
|
||||
else
|
||||
changes.wireless = true
|
||||
end
|
||||
elseif file == "vtun" then
|
||||
changes.tunnels = true
|
||||
else
|
||||
|
|
|
@ -41,6 +41,17 @@ if [ ! -d $ROOT ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
ignore=0
|
||||
if [ "$1" = "--ignore-reboot" ]; then
|
||||
shift
|
||||
ignore=1
|
||||
fi
|
||||
|
||||
# If we have to reboot, do nothing (unless ignored)
|
||||
if [ -f $ROOT/reboot -a $ignore = 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Override services to restart
|
||||
if [ "$*" != "" ]; then
|
||||
SERVICES="$*"
|
||||
|
|
|
@ -1316,6 +1316,10 @@ if APokay and ((phycount > 1 and (wifi_enable ~= "1" or wifi3_enable ~= "1")) or
|
|||
if wifi_enable == "1" then
|
||||
local alt_wifi = (not phy or phy == "phy0") and "wlan1" or "wlan0"
|
||||
chan = aredn.hardware.get_rfchannels(alt_wifi)
|
||||
if #chan == 0 then
|
||||
-- Hardware device can crash after switching - so at least make the page render until a reboot
|
||||
chan[1] = { frequency = 2412, number = 1, label = nil }
|
||||
end
|
||||
if chan[1].frequency < 3000 then
|
||||
wifi2_hwmode = "11g"
|
||||
if wifi2_channel > 14 then
|
||||
|
|
Loading…
Reference in New Issue