hostapd: backport 2 hot-reload fixes

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-08-07 14:19:23 +02:00
parent ca4a4365d6
commit fbee159481
3 changed files with 16 additions and 10 deletions

View File

@@ -34,7 +34,7 @@ function find_reusable_wdev(phyidx)
if (!__phy_is_fullmac(phyidx))
return null;
data = nl80211.request(
let data = nl80211.request(
nl80211.const.NL80211_CMD_GET_INTERFACE,
nl80211.const.NLM_F_DUMP,
{ wiphy: phyidx });

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env ucode
'use strict';
import { vlist_new, is_equal, wdev_create, wdev_remove } from "/usr/share/hostap/common.uc";
import { readfile, writefile, basename, glob } from "fs";
import { readfile, writefile, basename, readlink, glob } from "fs";
let keep_devices = {};
let phy = shift(ARGV);
@@ -106,6 +106,9 @@ function add_existing(phy, config)
if (config[wdev])
continue;
if (basename(readlink(`/sys/class/net/${wdev}/phy80211`)) != phy)
continue;
if (trim(readfile(`/sys/class/net/${wdev}/operstate`)) == "down")
config[wdev] = {};
}

View File

@@ -1,4 +1,4 @@
From 4f17c6e2ca90130f86783e87927019525af719ba Mon Sep 17 00:00:00 2001
From 87450a717bf0e9e82566c89debb60e6ba7d4fe4a Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 6 Jul 2023 08:33:25 +0000
Subject: [PATCH] backport hostapd ucode / wifi reload support
@@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
.../services/hostapd/files/radius.config | 9 +
.../services/hostapd/files/radius.init | 42 +
.../services/hostapd/files/radius.users | 14 +
.../network/services/hostapd/files/wdev.uc | 153 +
.../network/services/hostapd/files/wdev.uc | 156 +
.../hostapd/files/wpa_supplicant-basic.config | 4 +-
.../hostapd/files/wpa_supplicant-full.config | 4 +-
.../hostapd/files/wpa_supplicant-mini.config | 2 +-
@@ -103,7 +103,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
.../hostapd/src/wpa_supplicant/ubus.h | 11 -
.../hostapd/src/wpa_supplicant/ucode.c | 177 +
.../hostapd/src/wpa_supplicant/ucode.h | 38 +
98 files changed, 15512 insertions(+), 2535 deletions(-)
98 files changed, 15515 insertions(+), 2535 deletions(-)
create mode 100644 package/network/services/hostapd/README.md
create mode 100644 package/network/services/hostapd/files/common.uc
create mode 100644 package/network/services/hostapd/files/hostapd.uc
@@ -2208,7 +2208,7 @@ index 0000000000..2150863306
+`ubus call hostapd.wl5-fb wps_start`
diff --git a/package/network/services/hostapd/files/common.uc b/package/network/services/hostapd/files/common.uc
new file mode 100644
index 0000000000..2002572cf1
index 0000000000..9ece3b1af2
--- /dev/null
+++ b/package/network/services/hostapd/files/common.uc
@@ -0,0 +1,168 @@
@@ -2248,7 +2248,7 @@ index 0000000000..2002572cf1
+ if (!__phy_is_fullmac(phyidx))
+ return null;
+
+ data = nl80211.request(
+ let data = nl80211.request(
+ nl80211.const.NL80211_CMD_GET_INTERFACE,
+ nl80211.const.NLM_F_DUMP,
+ { wiphy: phyidx });
@@ -2964,14 +2964,14 @@ index 0000000000..03e2fc8fae
+}
diff --git a/package/network/services/hostapd/files/wdev.uc b/package/network/services/hostapd/files/wdev.uc
new file mode 100644
index 0000000000..9701af125a
index 0000000000..896f5261fb
--- /dev/null
+++ b/package/network/services/hostapd/files/wdev.uc
@@ -0,0 +1,153 @@
@@ -0,0 +1,156 @@
+#!/usr/bin/env ucode
+'use strict';
+import { vlist_new, is_equal, wdev_create, wdev_remove } from "/usr/share/hostap/common.uc";
+import { readfile, writefile, basename, glob } from "fs";
+import { readfile, writefile, basename, readlink, glob } from "fs";
+
+let keep_devices = {};
+let phy = shift(ARGV);
@@ -3076,6 +3076,9 @@ index 0000000000..9701af125a
+ if (config[wdev])
+ continue;
+
+ if (basename(readlink(`/sys/class/net/${wdev}/phy80211`)) != phy)
+ continue;
+
+ if (trim(readfile(`/sys/class/net/${wdev}/operstate`)) == "down")
+ config[wdev] = {};
+ }