Stop processing if STA VLAN bind fails

This commit is contained in:
Jouni Malinen 2010-04-15 23:44:10 +03:00
parent 91faf6b948
commit 4254100d6c
3 changed files with 14 additions and 4 deletions

View File

@ -1620,10 +1620,12 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
* so bind it to the selected VLAN interface now, since the
* interface selection is not going to change anymore.
*/
ap_sta_bind_vlan(hapd, sta, 0);
if (ap_sta_bind_vlan(hapd, sta, 0) < 0)
goto fail;
} else if (sta->vlan_id) {
/* VLAN ID already set (e.g., by PMKSA caching), so bind STA */
ap_sta_bind_vlan(hapd, sta, 0);
if (ap_sta_bind_vlan(hapd, sta, 0) < 0)
goto fail;
}
hapd->drv.set_sta_flags(hapd, sta);

View File

@ -1282,7 +1282,8 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
}
#endif /* CONFIG_NO_VLAN */
ap_sta_bind_vlan(hapd, sta, old_vlanid);
if (ap_sta_bind_vlan(hapd, sta, old_vlanid) < 0)
break;
/* RFC 3580, Ch. 3.17 */
if (session_timeout_set && termination_action ==

View File

@ -540,6 +540,7 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
#ifndef CONFIG_NO_VLAN
const char *iface;
struct hostapd_vlan *vlan = NULL;
int ret;
/*
* Do not proceed furthur if the vlan id remains same. We do not want
@ -635,7 +636,13 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0)
wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
return hapd->drv.set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
ret = hapd->drv.set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
if (ret < 0) {
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_DEBUG, "could not bind the STA "
"entry to vlan_id=%d", sta->vlan_id);
}
return ret;
#else /* CONFIG_NO_VLAN */
return 0;
#endif /* CONFIG_NO_VLAN */