|
|
|
@ -334,9 +334,10 @@ static const u8 * hostapd_wpa_auth_get_psk(void *ctx, const u8 *addr,
|
|
|
|
|
{
|
|
|
|
|
struct hostapd_data *hapd = ctx;
|
|
|
|
|
struct sta_info *sta = ap_get_sta(hapd, addr);
|
|
|
|
|
struct vlan_description *vlan = NULL;
|
|
|
|
|
const u8 *psk;
|
|
|
|
|
|
|
|
|
|
if (vlan_desc)
|
|
|
|
|
os_memset(vlan_desc, 0, sizeof(*vlan_desc));
|
|
|
|
|
if (psk_len)
|
|
|
|
|
*psk_len = PMK_LEN;
|
|
|
|
|
|
|
|
|
@ -383,9 +384,8 @@ static const u8 * hostapd_wpa_auth_get_psk(void *ctx, const u8 *addr,
|
|
|
|
|
struct hostapd_sta_wpa_psk_short *pos;
|
|
|
|
|
|
|
|
|
|
if (vlan_desc)
|
|
|
|
|
vlan_desc->notempty = 0;
|
|
|
|
|
os_memset(vlan_desc, 0, sizeof(*vlan_desc));
|
|
|
|
|
psk = sta->psk->psk;
|
|
|
|
|
vlan = &sta->psk->vlan;
|
|
|
|
|
for (pos = sta->psk; pos; pos = pos->next) {
|
|
|
|
|
if (pos->is_passphrase) {
|
|
|
|
|
pbkdf2_sha1(pos->passphrase,
|
|
|
|
@ -395,19 +395,14 @@ static const u8 * hostapd_wpa_auth_get_psk(void *ctx, const u8 *addr,
|
|
|
|
|
pos->is_passphrase = 0;
|
|
|
|
|
}
|
|
|
|
|
if (pos->psk == prev_psk) {
|
|
|
|
|
if (vlan_desc) {
|
|
|
|
|
*vlan_desc = pos->vlan;
|
|
|
|
|
}
|
|
|
|
|
psk = pos->next ? pos->next->psk : NULL;
|
|
|
|
|
vlan = pos->next ? &pos->next->vlan : NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vlan && vlan_desc) {
|
|
|
|
|
if (vlan && vlan->notempty)
|
|
|
|
|
*vlan_desc = *vlan;
|
|
|
|
|
else if (sta->default_radius_vlan.notempty)
|
|
|
|
|
*vlan_desc = sta->default_radius_vlan;
|
|
|
|
|
}
|
|
|
|
|
return psk;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -948,39 +943,39 @@ static void hostapd_clear_ptksa(void *ctx, const u8 *addr, int cipher)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int hostapd_wpa_auth_update_vlan(void *ctx, const u8 *addr,
|
|
|
|
|
struct vlan_description *vlan_desc)
|
|
|
|
|
struct vlan_description *vlan_desc)
|
|
|
|
|
{
|
|
|
|
|
#ifndef CONFIG_NO_VLAN
|
|
|
|
|
struct hostapd_data *hapd = ctx;
|
|
|
|
|
struct sta_info *sta;
|
|
|
|
|
int vlan_id = 0;
|
|
|
|
|
|
|
|
|
|
if (vlan_desc)
|
|
|
|
|
vlan_id = vlan_desc->untagged;
|
|
|
|
|
if (!hostapd_vlan_valid(hapd->conf->vlan, vlan_desc)) {
|
|
|
|
|
wpa_printf(MSG_INFO,
|
|
|
|
|
"Invalid VLAN ID %d",
|
|
|
|
|
vlan_desc->untagged);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sta = ap_get_sta(hapd, addr);
|
|
|
|
|
if (!sta)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_VLAN_OFFLOAD)) {
|
|
|
|
|
if (!hostapd_vlan_valid(hapd->conf->vlan, vlan_desc)) {
|
|
|
|
|
wpa_printf(MSG_INFO, "Invalid VLAN ID %d", vlan_id);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ap_sta_set_vlan(hapd, sta, vlan_desc) < 0) {
|
|
|
|
|
wpa_printf(MSG_INFO,
|
|
|
|
|
"Failed to assign VLAN ID %d to " MACSTR,
|
|
|
|
|
vlan_id, MAC2STR(sta->addr));
|
|
|
|
|
"Failed to assign VLAN ID %d to "
|
|
|
|
|
MACSTR, vlan_desc->untagged,
|
|
|
|
|
MAC2STR(sta->addr));
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
sta->vlan_id = vlan_id;
|
|
|
|
|
/* TODO: tagged? */
|
|
|
|
|
sta->vlan_id = vlan_desc->untagged;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wpa_printf(MSG_INFO,
|
|
|
|
|
"Assigned VLAN ID %d from to " MACSTR,
|
|
|
|
|
vlan_id, MAC2STR(sta->addr));
|
|
|
|
|
"Assigned VLAN ID %d to " MACSTR,
|
|
|
|
|
vlan_desc->untagged, MAC2STR(sta->addr));
|
|
|
|
|
if ((sta->flags & WLAN_STA_ASSOC) &&
|
|
|
|
|
ap_sta_bind_vlan(hapd, sta) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|