Files
wlan-ap/patches/wifi/0016-hostapd-add-multi-coa-support.patch
John Crispin 0603953d9f hostapd: add multi CoA support
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-19 08:17:00 +02:00

97 lines
3.1 KiB
Diff

From 20f641bcaec51f0c02963668c22912657e370b3f Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 17 Aug 2022 14:47:23 +0200
Subject: [PATCH 01/62] hostapd: add multi-coa support
Signed-off-by: John Crispin <john@phrozen.org>
---
.../hostapd/patches/900-coa_multi.patch | 76 +++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 package/network/services/hostapd/patches/900-coa_multi.patch
diff --git a/package/network/services/hostapd/patches/900-coa_multi.patch b/package/network/services/hostapd/patches/900-coa_multi.patch
new file mode 100644
index 0000000000..2b0131de0d
--- /dev/null
+++ b/package/network/services/hostapd/patches/900-coa_multi.patch
@@ -0,0 +1,76 @@
+Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/ap/hostapd.c
++++ hostapd-2021-02-20-59e9794c/src/ap/hostapd.c
+@@ -862,7 +862,6 @@ static int hostapd_das_nas_mismatch(stru
+ return 0;
+ }
+
+-
+ static struct sta_info * hostapd_das_find_sta(struct hostapd_data *hapd,
+ struct radius_das_attrs *attr,
+ int *multi)
+@@ -1050,6 +1049,24 @@ static int hostapd_das_disconnect_pmksa(
+ }
+
+
++static struct hostapd_data * ap_get_hapd(struct hostapd_data *hapd, struct radius_das_attrs *attr)
++{
++ size_t i;
++ int multi;
++
++ for (i = 0; i < hapd->iface->num_bss; i++) {
++ if (!hapd->iface->bss[i]->iface->bss[i]->radius_das)
++ continue;
++ if (hapd->conf->radius_das_port !=hapd->iface->bss[i]->iface->bss[i]->conf->radius_das_port)
++ continue;
++ if (hostapd_das_find_sta(hapd, attr, &multi))
++ return hapd->iface->bss[i];
++ }
++ return hapd;
++}
++
++
++
+ static enum radius_das_res
+ hostapd_das_disconnect(void *ctx, struct radius_das_attrs *attr)
+ {
+@@ -1057,6 +1074,10 @@ hostapd_das_disconnect(void *ctx, struct
+ struct sta_info *sta;
+ int multi;
+
++ hapd = ap_get_hapd(hapd, attr);
++ if (!hapd)
++ return RADIUS_DAS_SESSION_NOT_FOUND;
++
+ if (hostapd_das_nas_mismatch(hapd, attr))
+ return RADIUS_DAS_NAS_MISMATCH;
+
+@@ -1096,6 +1117,10 @@ hostapd_das_coa(void *ctx, struct radius
+ struct sta_info *sta;
+ int multi;
+
++ hapd = ap_get_hapd(hapd, attr);
++ if (!hapd)
++ return RADIUS_DAS_SESSION_NOT_FOUND;
++
+ if (hostapd_das_nas_mismatch(hapd, attr))
+ return RADIUS_DAS_NAS_MISMATCH;
+
+Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.c
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.c
++++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.c
+@@ -568,10 +568,9 @@ radius_das_init(struct radius_das_conf *
+
+ das->sock = radius_das_open_socket(conf->port);
+ if (das->sock < 0) {
+- wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS "
++ wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS - reusing existing port "
+ "DAS");
+- radius_das_deinit(das);
+- return NULL;
++ return das;
+ }
+
+ if (eloop_register_read_sock(das->sock, radius_das_receive, das, NULL))
--
2.25.1