hostapd: allow using psk2-radius in combination with enhanced MPSK

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2024-09-09 15:47:42 +02:00
parent 17a97e5060
commit c235143c16
3 changed files with 12 additions and 36 deletions

View File

@@ -234,7 +234,7 @@ function sta_auth_psk(ifname, addr) {
return ssid_psk(ssid, addr); return ssid_psk(ssid, addr);
} }
function sta_auth_cache(ifname, addr, idx) { function sta_auth_cache(ifname, addr, idx, phrase) {
let ssid = iface_ssid(ifname); let ssid = iface_ssid(ifname);
if (!ssid) if (!ssid)
return; return;
@@ -248,6 +248,9 @@ function sta_auth_cache(ifname, addr, idx) {
return; return;
psk = psk[idx]; psk = psk[idx];
if (!psk)
psk = phrase;
if (!psk) if (!psk)
return; return;
@@ -297,7 +300,7 @@ function auth_cb(msg) {
case 'sta_connected': case 'sta_connected':
if (data.psk_idx == null) if (data.psk_idx == null)
return; return;
return sta_auth_cache(data.iface, data.sta, data.psk_idx); return sta_auth_cache(data.iface, data.sta, data.psk_idx, data.psk);
case 'reload': case 'reload':
netifd_reload(); netifd_reload();
reload_timer.set(5000); reload_timer.set(5000);

View File

@@ -585,40 +585,6 @@
.send_mlme = driver_nl80211_send_mlme, .send_mlme = driver_nl80211_send_mlme,
.get_hw_feature_data = nl80211_get_hw_feature_data, .get_hw_feature_data = nl80211_get_hw_feature_data,
.sta_add = wpa_driver_nl80211_sta_add, .sta_add = wpa_driver_nl80211_sta_add,
--- a/src/ap/ucode.c
+++ b/src/ap/ucode.c
@@ -256,6 +256,7 @@ uc_hostapd_bss_set_config(uc_vm_t *vm, s
hostapd_setup_bss(hapd, hapd == iface->bss[0], true);
hostapd_ucode_update_interfaces();
+ hostapd_owe_update_trans(iface);
done:
ret = 0;
@@ -376,6 +377,7 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, si
conf->bss[idx] = NULL;
ret = hostapd_ucode_bss_get_uval(hapd);
hostapd_ucode_update_interfaces();
+ hostapd_owe_update_trans(iface);
goto out;
deinit_ctrl:
@@ -603,6 +605,7 @@ out:
ieee802_11_set_beacon(hapd);
}
+ hostapd_owe_update_trans(iface);
return ucv_boolean_new(true);
}
@@ -694,6 +697,7 @@ uc_hostapd_bss_rename(uc_vm_t *vm, size_
hostapd_ubus_add_bss(hapd);
hostapd_ucode_update_interfaces();
+ hostapd_owe_update_trans(hapd->iface);
out:
if (interfaces->ctrl_iface_init)
interfaces->ctrl_iface_init(hapd);
--- a/src/ap/ieee802_11.c --- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c
@@ -494,11 +494,17 @@ static const char * sae_get_password(str @@ -494,11 +494,17 @@ static const char * sae_get_password(str

View File

@@ -256,6 +256,7 @@ uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs)
hostapd_setup_bss(hapd, hapd == iface->bss[0], true); hostapd_setup_bss(hapd, hapd == iface->bss[0], true);
hostapd_ucode_update_interfaces(); hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(iface);
done: done:
ret = 0; ret = 0;
@@ -376,6 +377,7 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs)
conf->bss[idx] = NULL; conf->bss[idx] = NULL;
ret = hostapd_ucode_bss_get_uval(hapd); ret = hostapd_ucode_bss_get_uval(hapd);
hostapd_ucode_update_interfaces(); hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(iface);
goto out; goto out;
deinit_ctrl: deinit_ctrl:
@@ -603,6 +605,7 @@ out:
ieee802_11_set_beacon(hapd); ieee802_11_set_beacon(hapd);
} }
hostapd_owe_update_trans(iface);
return ucv_boolean_new(true); return ucv_boolean_new(true);
} }
@@ -694,6 +697,7 @@ uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs)
hostapd_ubus_add_bss(hapd); hostapd_ubus_add_bss(hapd);
hostapd_ucode_update_interfaces(); hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(hapd->iface);
out: out:
if (interfaces->ctrl_iface_init) if (interfaces->ctrl_iface_init)
interfaces->ctrl_iface_init(hapd); interfaces->ctrl_iface_init(hapd);
@@ -769,6 +773,7 @@ int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta)
void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta) void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta)
{ {
struct hostapd_sta_wpa_psk_short *psk = sta->psk;
char addr[sizeof(MACSTR)]; char addr[sizeof(MACSTR)];
uc_value_t *val, *cur; uc_value_t *val, *cur;
int ret = 0; int ret = 0;
@@ -785,6 +790,8 @@ void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta
val = ucv_object_new(vm); val = ucv_object_new(vm);
if (sta->psk_idx) if (sta->psk_idx)
ucv_object_add(val, "psk_idx", ucv_int64_new(sta->psk_idx - 1)); ucv_object_add(val, "psk_idx", ucv_int64_new(sta->psk_idx - 1));
if (sta->psk)
ucv_object_add(val, "psk", ucv_string_new(sta->psk->passphrase));
uc_value_push(ucv_get(val)); uc_value_push(ucv_get(val));
val = wpa_ucode_call(3); val = wpa_ucode_call(3);