From eb6e95f7600629d6c62914b6d108e860d5e30c57 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 31 Aug 2023 08:11:01 +0200 Subject: [PATCH] hostapd: add proxy-state to DAS frames Signed-off-by: John Crispin --- .../hostapd/patches/999-das-proxy-state.patch | 95 +++++++++++++++++++ .../hostapd/patches/999-das-proxy-state.patch | 95 +++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 feeds/ipq807x_v5.4/hostapd/patches/999-das-proxy-state.patch create mode 100644 feeds/wifi-ax/hostapd/patches/999-das-proxy-state.patch diff --git a/feeds/ipq807x_v5.4/hostapd/patches/999-das-proxy-state.patch b/feeds/ipq807x_v5.4/hostapd/patches/999-das-proxy-state.patch new file mode 100644 index 000000000..64b7aa4c0 --- /dev/null +++ b/feeds/ipq807x_v5.4/hostapd/patches/999-das-proxy-state.patch @@ -0,0 +1,95 @@ +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 +@@ -63,6 +63,7 @@ static struct radius_msg * radius_das_di + RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, + RADIUS_ATTR_VENDOR_SPECIFIC, + RADIUS_ATTR_CALLED_STATION_ID, ++ RADIUS_ATTR_PROXY_STATE, + #ifdef CONFIG_IPV6 + RADIUS_ATTR_NAS_IPV6_ADDRESS, + #endif /* CONFIG_IPV6 */ +@@ -159,6 +160,12 @@ static struct radius_msg * radius_das_di + attrs.cui_len = len; + } + ++ if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE, ++ &buf, &len, NULL) == 0) { ++ attrs.proxy = buf; ++ attrs.proxy_len = len; ++ } ++ + res = das->disconnect(das->ctx, &attrs); + switch (res) { + case RADIUS_DAS_NAS_MISMATCH: +@@ -167,10 +174,11 @@ static struct radius_msg * radius_das_di + error = 403; + break; + case RADIUS_DAS_SESSION_NOT_FOUND: +- wpa_printf(MSG_INFO, "DAS: Session not found for request from " +- "%s:%d", abuf, from_port); +- error = 503; +- break; ++ return NULL; ++// wpa_printf(MSG_INFO, "DAS: Session not found for request from " ++// "%s:%d", abuf, from_port); ++// error = 503; ++// break; + case RADIUS_DAS_MULTI_SESSION_MATCH: + wpa_printf(MSG_INFO, + "DAS: Multiple sessions match for request from %s:%d", +@@ -192,6 +200,9 @@ fail: + if (reply == NULL) + return NULL; + ++ if (attrs.proxy) ++ radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len); ++ + if (error) { + if (!radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, + error)) { +@@ -222,6 +233,7 @@ static struct radius_msg * radius_das_co + RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, + RADIUS_ATTR_VENDOR_SPECIFIC, + RADIUS_ATTR_CALLED_STATION_ID, ++ RADIUS_ATTR_PROXY_STATE, + #ifdef CONFIG_IPV6 + RADIUS_ATTR_NAS_IPV6_ADDRESS, + #endif /* CONFIG_IPV6 */ +@@ -347,6 +359,12 @@ static struct radius_msg * radius_das_co + } + #endif /* CONFIG_HS20 */ + ++ if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE, ++ &buf, &len, NULL) == 0) { ++ attrs.proxy = buf; ++ attrs.proxy_len = len; ++ } ++ + res = das->coa(das->ctx, &attrs); + switch (res) { + case RADIUS_DAS_NAS_MISMATCH: +@@ -382,6 +400,9 @@ fail: + if (!reply) + return NULL; + ++ if (attrs.proxy) ++ radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len); ++ + if (error && + !radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, error)) { + radius_msg_free(reply); +Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.h +=================================================================== +--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.h ++++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.h +@@ -36,6 +36,8 @@ struct radius_das_attrs { + size_t acct_multi_session_id_len; + const u8 *cui; + size_t cui_len; ++ const u8 *proxy; ++ size_t proxy_len; + + /* Authorization changes */ + const u8 *hs20_t_c_filtering; diff --git a/feeds/wifi-ax/hostapd/patches/999-das-proxy-state.patch b/feeds/wifi-ax/hostapd/patches/999-das-proxy-state.patch new file mode 100644 index 000000000..64b7aa4c0 --- /dev/null +++ b/feeds/wifi-ax/hostapd/patches/999-das-proxy-state.patch @@ -0,0 +1,95 @@ +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 +@@ -63,6 +63,7 @@ static struct radius_msg * radius_das_di + RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, + RADIUS_ATTR_VENDOR_SPECIFIC, + RADIUS_ATTR_CALLED_STATION_ID, ++ RADIUS_ATTR_PROXY_STATE, + #ifdef CONFIG_IPV6 + RADIUS_ATTR_NAS_IPV6_ADDRESS, + #endif /* CONFIG_IPV6 */ +@@ -159,6 +160,12 @@ static struct radius_msg * radius_das_di + attrs.cui_len = len; + } + ++ if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE, ++ &buf, &len, NULL) == 0) { ++ attrs.proxy = buf; ++ attrs.proxy_len = len; ++ } ++ + res = das->disconnect(das->ctx, &attrs); + switch (res) { + case RADIUS_DAS_NAS_MISMATCH: +@@ -167,10 +174,11 @@ static struct radius_msg * radius_das_di + error = 403; + break; + case RADIUS_DAS_SESSION_NOT_FOUND: +- wpa_printf(MSG_INFO, "DAS: Session not found for request from " +- "%s:%d", abuf, from_port); +- error = 503; +- break; ++ return NULL; ++// wpa_printf(MSG_INFO, "DAS: Session not found for request from " ++// "%s:%d", abuf, from_port); ++// error = 503; ++// break; + case RADIUS_DAS_MULTI_SESSION_MATCH: + wpa_printf(MSG_INFO, + "DAS: Multiple sessions match for request from %s:%d", +@@ -192,6 +200,9 @@ fail: + if (reply == NULL) + return NULL; + ++ if (attrs.proxy) ++ radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len); ++ + if (error) { + if (!radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, + error)) { +@@ -222,6 +233,7 @@ static struct radius_msg * radius_das_co + RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, + RADIUS_ATTR_VENDOR_SPECIFIC, + RADIUS_ATTR_CALLED_STATION_ID, ++ RADIUS_ATTR_PROXY_STATE, + #ifdef CONFIG_IPV6 + RADIUS_ATTR_NAS_IPV6_ADDRESS, + #endif /* CONFIG_IPV6 */ +@@ -347,6 +359,12 @@ static struct radius_msg * radius_das_co + } + #endif /* CONFIG_HS20 */ + ++ if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE, ++ &buf, &len, NULL) == 0) { ++ attrs.proxy = buf; ++ attrs.proxy_len = len; ++ } ++ + res = das->coa(das->ctx, &attrs); + switch (res) { + case RADIUS_DAS_NAS_MISMATCH: +@@ -382,6 +400,9 @@ fail: + if (!reply) + return NULL; + ++ if (attrs.proxy) ++ radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len); ++ + if (error && + !radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, error)) { + radius_msg_free(reply); +Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.h +=================================================================== +--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.h ++++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.h +@@ -36,6 +36,8 @@ struct radius_das_attrs { + size_t acct_multi_session_id_len; + const u8 *cui; + size_t cui_len; ++ const u8 *proxy; ++ size_t proxy_len; + + /* Authorization changes */ + const u8 *hs20_t_c_filtering;