HS 2.0: CoA-Request processing for Terms and Conditions filtering
Extend RADIUS DAS to support CoA-Request packets for the case where the HS 2.0 Terms And Conditions filtering VSA is used to remove filtering. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
d239ab3962
commit
f456940ef3
7 changed files with 276 additions and 21 deletions
|
@ -49,6 +49,7 @@
|
|||
#include "rrm.h"
|
||||
#include "fils_hlp.h"
|
||||
#include "acs.h"
|
||||
#include "hs20.h"
|
||||
|
||||
|
||||
static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
|
||||
|
@ -900,6 +901,48 @@ hostapd_das_disconnect(void *ctx, struct radius_das_attrs *attr)
|
|||
return RADIUS_DAS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_HS20
|
||||
static enum radius_das_res
|
||||
hostapd_das_coa(void *ctx, struct radius_das_attrs *attr)
|
||||
{
|
||||
struct hostapd_data *hapd = ctx;
|
||||
struct sta_info *sta;
|
||||
int multi;
|
||||
|
||||
if (hostapd_das_nas_mismatch(hapd, attr))
|
||||
return RADIUS_DAS_NAS_MISMATCH;
|
||||
|
||||
sta = hostapd_das_find_sta(hapd, attr, &multi);
|
||||
if (!sta) {
|
||||
if (multi) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"RADIUS DAS: Multiple sessions match - not supported");
|
||||
return RADIUS_DAS_MULTI_SESSION_MATCH;
|
||||
}
|
||||
wpa_printf(MSG_DEBUG, "RADIUS DAS: No matching session found");
|
||||
return RADIUS_DAS_SESSION_NOT_FOUND;
|
||||
}
|
||||
|
||||
wpa_printf(MSG_DEBUG, "RADIUS DAS: Found a matching session " MACSTR
|
||||
" - CoA", MAC2STR(sta->addr));
|
||||
|
||||
if (attr->hs20_t_c_filtering) {
|
||||
if (attr->hs20_t_c_filtering[0] & BIT(0)) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"HS 2.0: Unexpected Terms and Conditions filtering required in CoA-Request");
|
||||
return RADIUS_DAS_COA_FAILED;
|
||||
}
|
||||
|
||||
hs20_t_c_filtering(hapd, sta, 0);
|
||||
}
|
||||
|
||||
return RADIUS_DAS_SUCCESS;
|
||||
}
|
||||
#else /* CONFIG_HS20 */
|
||||
#define hostapd_das_coa NULL
|
||||
#endif /* CONFIG_HS20 */
|
||||
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
|
||||
|
@ -1074,6 +1117,7 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
|
|||
conf->radius_das_require_message_authenticator;
|
||||
das_conf.ctx = hapd;
|
||||
das_conf.disconnect = hostapd_das_disconnect;
|
||||
das_conf.coa = hostapd_das_coa;
|
||||
hapd->radius_das = radius_das_init(&das_conf);
|
||||
if (hapd->radius_das == NULL) {
|
||||
wpa_printf(MSG_ERROR, "RADIUS DAS initialization "
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
#include "common/wpa_ctrl.h"
|
||||
#include "hostapd.h"
|
||||
#include "ap_config.h"
|
||||
#include "ap_drv_ops.h"
|
||||
#include "sta_info.h"
|
||||
#include "hs20.h"
|
||||
|
||||
|
||||
|
@ -218,3 +220,26 @@ int hs20_send_wnm_notification_t_c(struct hostapd_data *hapd,
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void hs20_t_c_filtering(struct hostapd_data *hapd, struct sta_info *sta,
|
||||
int enabled)
|
||||
{
|
||||
if (enabled) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"HS 2.0: Terms and Conditions filtering required for "
|
||||
MACSTR, MAC2STR(sta->addr));
|
||||
sta->hs20_t_c_filtering = 1;
|
||||
/* TODO: Enable firewall filtering for the STA */
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, HS20_T_C_FILTERING_ADD MACSTR,
|
||||
MAC2STR(sta->addr));
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"HS 2.0: Terms and Conditions filtering not required for "
|
||||
MACSTR, MAC2STR(sta->addr));
|
||||
sta->hs20_t_c_filtering = 0;
|
||||
/* TODO: Disable firewall filtering for the STA */
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO,
|
||||
HS20_T_C_FILTERING_REMOVE MACSTR, MAC2STR(sta->addr));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,5 +20,7 @@ int hs20_send_wnm_notification_deauth_req(struct hostapd_data *hapd,
|
|||
const struct wpabuf *payload);
|
||||
int hs20_send_wnm_notification_t_c(struct hostapd_data *hapd,
|
||||
const u8 *addr);
|
||||
void hs20_t_c_filtering(struct hostapd_data *hapd, struct sta_info *sta,
|
||||
int enabled);
|
||||
|
||||
#endif /* HS20_H */
|
||||
|
|
|
@ -1632,14 +1632,7 @@ static void ieee802_1x_hs20_t_c_filtering(struct hostapd_data *hapd,
|
|||
wpa_printf(MSG_DEBUG,
|
||||
"HS 2.0: Terms and Conditions filtering %02x %02x %02x %02x",
|
||||
pos[0], pos[1], pos[2], pos[3]);
|
||||
if (pos[0] & BIT(0)) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"HS 2.0: Terms and Conditions filtering required");
|
||||
sta->hs20_t_c_filtering = 1;
|
||||
/* TODO: Enable firewall filtering for the STA */
|
||||
} else {
|
||||
sta->hs20_t_c_filtering = 0;
|
||||
}
|
||||
hs20_t_c_filtering(hapd, sta, pos[0] & BIT(0));
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HS20 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue