mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2026-03-20 03:39:54 +00:00
Compare commits
4 Commits
next
...
staging-WI
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
961740e04a | ||
|
|
5a40495718 | ||
|
|
b1edbdd3ee | ||
|
|
083a6278a7 |
@@ -0,0 +1,65 @@
|
||||
From 3feceb6a9993aa91cfff1c369a12b0467aa104db Mon Sep 17 00:00:00 2001
|
||||
From: Venkat Chimata <venkat@nearhop.com>
|
||||
Date: Wed, 11 Feb 2026 09:51:57 +0530
|
||||
Subject: [PATCH] ubus: avoid banning clients before per-BSS ubus object is
|
||||
ready
|
||||
|
||||
There could be some scenarios where bss is created but
|
||||
ubus is not inited yet. If we try to access variables like
|
||||
ubus.banned, it would lead to hostapd crash.
|
||||
|
||||
This new check for the existence of ubus object prevents
|
||||
the hostapd crash.
|
||||
|
||||
Signed-off-by: Venkat Chimata <venkat@nearhop.com>
|
||||
---
|
||||
src/ap/ubus.c | 20 +++++++++++++++++++-
|
||||
1 file changed, 19 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ap/ubus.c b/src/ap/ubus.c
|
||||
index 76eee03..85c24ec 100644
|
||||
--- a/src/ap/ubus.c
|
||||
+++ b/src/ap/ubus.c
|
||||
@@ -520,12 +520,25 @@ static const struct blobmsg_policy del_policy[__DEL_CLIENT_MAX] = {
|
||||
[DEL_CLIENT_GLOBAL_BAN] = { "global_ban", BLOBMSG_TYPE_INT8 },
|
||||
};
|
||||
|
||||
+static bool is_ubus_object_inited(char *name)
|
||||
+{
|
||||
+ uint32_t id;
|
||||
+ int ret = ubus_lookup_id(ctx, name, &id);
|
||||
+
|
||||
+ if (ret == UBUS_STATUS_OK) {
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int
|
||||
hostapd_bss_del_client_cb(struct hostapd_iface *iface, void *ctx)
|
||||
{
|
||||
struct blob_attr **tb = ctx;
|
||||
u8 addr[ETH_ALEN];
|
||||
int i;
|
||||
+ char iface_name[32];
|
||||
|
||||
hwaddr_aton(blobmsg_data(tb[DEL_CLIENT_ADDR]), addr);
|
||||
|
||||
@@ -533,7 +546,12 @@ hostapd_bss_del_client_cb(struct hostapd_iface *iface, void *ctx)
|
||||
for (i = 0; i < iface->num_bss; i++) {
|
||||
struct hostapd_data *bss = iface->bss[i];
|
||||
|
||||
- hostapd_bss_ban_client(bss, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME]));
|
||||
+ memset(iface_name, 0, sizeof(iface_name));
|
||||
+ snprintf(iface_name, sizeof(iface_name), "hostapd.%s", bss->conf->iface);
|
||||
+
|
||||
+ if (is_ubus_object_inited(iface_name)) {
|
||||
+ hostapd_bss_ban_client(bss, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME]));
|
||||
+ }
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From 5d2f93353bbf240e3eff175322dd54f0f24154db Mon Sep 17 00:00:00 2001
|
||||
From: Venkat Chimata <venkat@nearhop.com>
|
||||
Date: Wed, 11 Feb 2026 09:57:54 +0530
|
||||
Subject: [PATCH] ieee80211: ban clients based on the return value from
|
||||
hostapd_ubus_handle_event
|
||||
|
||||
Signed-off-by: Venkat Chimata <venkat@nearhop.com>
|
||||
---
|
||||
src/ap/ieee802_11.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
|
||||
index ac6e8e4..d3cce33 100644
|
||||
--- a/src/ap/ieee802_11.c
|
||||
+++ b/src/ap/ieee802_11.c
|
||||
@@ -3034,7 +3034,7 @@ static void handle_auth(struct hostapd_data *hapd,
|
||||
goto fail;
|
||||
}
|
||||
ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||
- if (0 && ubus_resp) {
|
||||
+ if (ubus_resp) {
|
||||
wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n",
|
||||
MAC2STR(mgmt->sa));
|
||||
resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
@@ -5541,7 +5541,7 @@ static void handle_assoc(struct hostapd_data *hapd,
|
||||
#endif /* CONFIG_FILS */
|
||||
|
||||
ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||
- if (0 && ubus_resp) {
|
||||
+ if (ubus_resp) {
|
||||
wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
|
||||
MAC2STR(mgmt->sa));
|
||||
resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
From 91d881791574493beac9bcffc4cae9d2610be571 Mon Sep 17 00:00:00 2001
|
||||
From: Venkat Chimata <venkat@nearhop.com>
|
||||
Date: Wed, 11 Feb 2026 19:57:12 +0530
|
||||
Subject: [PATCH] hostapd / ieee80211: ban clients based on the return value
|
||||
from hostapd_ubus_handle_event
|
||||
|
||||
Signed-off-by: Venkat Chimata <venkat@nearhop.com>
|
||||
---
|
||||
...ients-based-on-the-return-value-from.patch | 36 +++++++++++++++++++
|
||||
1 file changed, 36 insertions(+)
|
||||
create mode 100644 package/network/services/hostapd/patches/zzzz-006-ieee80211-ban-clients-based-on-the-return-value-from.patch
|
||||
|
||||
diff --git a/package/network/services/hostapd/patches/zzzz-006-ieee80211-ban-clients-based-on-the-return-value-from.patch b/package/network/services/hostapd/patches/zzzz-006-ieee80211-ban-clients-based-on-the-return-value-from.patch
|
||||
new file mode 100644
|
||||
index 0000000000..6b8446ebda
|
||||
--- /dev/null
|
||||
+++ b/package/network/services/hostapd/patches/zzzz-006-ieee80211-ban-clients-based-on-the-return-value-from.patch
|
||||
@@ -0,0 +1,36 @@
|
||||
+From 5d2f93353bbf240e3eff175322dd54f0f24154db Mon Sep 17 00:00:00 2001
|
||||
+From: Venkat Chimata <venkat@nearhop.com>
|
||||
+Date: Wed, 11 Feb 2026 09:57:54 +0530
|
||||
+Subject: [PATCH] ieee80211: ban clients based on the return value from
|
||||
+ hostapd_ubus_handle_event
|
||||
+
|
||||
+Signed-off-by: Venkat Chimata <venkat@nearhop.com>
|
||||
+---
|
||||
+ src/ap/ieee802_11.c | 4 ++--
|
||||
+ 1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
+
|
||||
+diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
|
||||
+index ac6e8e4..d3cce33 100644
|
||||
+--- a/src/ap/ieee802_11.c
|
||||
++++ b/src/ap/ieee802_11.c
|
||||
+@@ -3034,7 +3034,7 @@ static void handle_auth(struct hostapd_data *hapd,
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||
+- if (0 && ubus_resp) {
|
||||
++ if (ubus_resp) {
|
||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
+@@ -5541,7 +5541,7 @@ static void handle_assoc(struct hostapd_data *hapd,
|
||||
+ #endif /* CONFIG_FILS */
|
||||
+
|
||||
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||
+- if (0 && ubus_resp) {
|
||||
++ if (ubus_resp) {
|
||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
+--
|
||||
+2.34.1
|
||||
+
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
From eaebc79cafe83a2a355f6123a94c74a02490077a Mon Sep 17 00:00:00 2001
|
||||
From: Venkat Chimata <venkat@nearhop.com>
|
||||
Date: Wed, 11 Feb 2026 19:56:37 +0530
|
||||
Subject: [PATCH] ubus: avoid banning clients before per-BSS ubus object is
|
||||
ready
|
||||
|
||||
There could be some scenarios where bss is created but
|
||||
ubus is not inited yet. If we try to access variables like
|
||||
ubus.banned, it would lead to hostapd crash.
|
||||
|
||||
This new check for the existence of ubus object prevents
|
||||
the hostapd crash.
|
||||
|
||||
Signed-off-by: Venkat Chimata <venkat@nearhop.com>
|
||||
---
|
||||
...ng-clients-before-per-BSS-ubus-objec.patch | 65 +++++++++++++++++++
|
||||
1 file changed, 65 insertions(+)
|
||||
create mode 100644 package/network/services/hostapd/patches/zzzz-005-ubus-avoid-banning-clients-before-per-BSS-ubus-objec.patch
|
||||
|
||||
diff --git a/package/network/services/hostapd/patches/zzzz-005-ubus-avoid-banning-clients-before-per-BSS-ubus-objec.patch b/package/network/services/hostapd/patches/zzzz-005-ubus-avoid-banning-clients-before-per-BSS-ubus-objec.patch
|
||||
new file mode 100644
|
||||
index 0000000000..03abe9199d
|
||||
--- /dev/null
|
||||
+++ b/package/network/services/hostapd/patches/zzzz-005-ubus-avoid-banning-clients-before-per-BSS-ubus-objec.patch
|
||||
@@ -0,0 +1,65 @@
|
||||
+From 3feceb6a9993aa91cfff1c369a12b0467aa104db Mon Sep 17 00:00:00 2001
|
||||
+From: Venkat Chimata <venkat@nearhop.com>
|
||||
+Date: Wed, 11 Feb 2026 09:51:57 +0530
|
||||
+Subject: [PATCH] ubus: avoid banning clients before per-BSS ubus object is
|
||||
+ ready
|
||||
+
|
||||
+There could be some scenarios where bss is created but
|
||||
+ubus is not inited yet. If we try to access variables like
|
||||
+ubus.banned, it would lead to hostapd crash.
|
||||
+
|
||||
+This new check for the existence of ubus object prevents
|
||||
+the hostapd crash.
|
||||
+
|
||||
+Signed-off-by: Venkat Chimata <venkat@nearhop.com>
|
||||
+---
|
||||
+ src/ap/ubus.c | 20 +++++++++++++++++++-
|
||||
+ 1 file changed, 19 insertions(+), 1 deletion(-)
|
||||
+
|
||||
+diff --git a/src/ap/ubus.c b/src/ap/ubus.c
|
||||
+index 76eee03..85c24ec 100644
|
||||
+--- a/src/ap/ubus.c
|
||||
++++ b/src/ap/ubus.c
|
||||
+@@ -520,12 +520,25 @@ static const struct blobmsg_policy del_policy[__DEL_CLIENT_MAX] = {
|
||||
+ [DEL_CLIENT_GLOBAL_BAN] = { "global_ban", BLOBMSG_TYPE_INT8 },
|
||||
+ };
|
||||
+
|
||||
++static bool is_ubus_object_inited(char *name)
|
||||
++{
|
||||
++ uint32_t id;
|
||||
++ int ret = ubus_lookup_id(ctx, name, &id);
|
||||
++
|
||||
++ if (ret == UBUS_STATUS_OK) {
|
||||
++ return true;
|
||||
++ } else {
|
||||
++ return false;
|
||||
++ }
|
||||
++}
|
||||
++
|
||||
+ static int
|
||||
+ hostapd_bss_del_client_cb(struct hostapd_iface *iface, void *ctx)
|
||||
+ {
|
||||
+ struct blob_attr **tb = ctx;
|
||||
+ u8 addr[ETH_ALEN];
|
||||
+ int i;
|
||||
++ char iface_name[32];
|
||||
+
|
||||
+ hwaddr_aton(blobmsg_data(tb[DEL_CLIENT_ADDR]), addr);
|
||||
+
|
||||
+@@ -533,7 +546,12 @@ hostapd_bss_del_client_cb(struct hostapd_iface *iface, void *ctx)
|
||||
+ for (i = 0; i < iface->num_bss; i++) {
|
||||
+ struct hostapd_data *bss = iface->bss[i];
|
||||
+
|
||||
+- hostapd_bss_ban_client(bss, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME]));
|
||||
++ memset(iface_name, 0, sizeof(iface_name));
|
||||
++ snprintf(iface_name, sizeof(iface_name), "hostapd.%s", bss->conf->iface);
|
||||
++
|
||||
++ if (is_ubus_object_inited(iface_name)) {
|
||||
++ hostapd_bss_ban_client(bss, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME]));
|
||||
++ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+--
|
||||
+2.34.1
|
||||
+
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Reference in New Issue
Block a user