Moved association check from driver_*.c into ieee802_1x_receive()

This commit is contained in:
Jouni Malinen 2009-01-09 16:17:20 +02:00 committed by Jouni Malinen
parent 602996f8db
commit 940a0ce970
3 changed files with 3 additions and 18 deletions

View file

@ -697,15 +697,7 @@ handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len)
{ {
struct bsd_driver_data *drv = ctx; struct bsd_driver_data *drv = ctx;
struct hostapd_data *hapd = drv->hapd; struct hostapd_data *hapd = drv->hapd;
struct sta_info *sta;
sta = ap_get_sta(hapd, src_addr);
if (!sta || !(sta->flags & WLAN_STA_ASSOC)) {
printf("Data frame from not associated STA %s\n",
ether_sprintf(src_addr));
/* XXX cannot happen */
return;
}
ieee802_1x_receive(hapd, src_addr, buf + sizeof(struct l2_ethhdr), ieee802_1x_receive(hapd, src_addr, buf + sizeof(struct l2_ethhdr),
len - sizeof(struct l2_ethhdr)); len - sizeof(struct l2_ethhdr));
} }

View file

@ -1241,15 +1241,7 @@ handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len)
{ {
struct madwifi_driver_data *drv = ctx; struct madwifi_driver_data *drv = ctx;
struct hostapd_data *hapd = drv->hapd; struct hostapd_data *hapd = drv->hapd;
struct sta_info *sta;
sta = ap_get_sta(hapd, src_addr);
if (!sta || !(sta->flags & WLAN_STA_ASSOC)) {
printf("Data frame from not associated STA %s\n",
ether_sprintf(src_addr));
/* XXX cannot happen */
return;
}
ieee802_1x_receive(hapd, src_addr, buf + sizeof(struct l2_ethhdr), ieee802_1x_receive(hapd, src_addr, buf + sizeof(struct l2_ethhdr),
len - sizeof(struct l2_ethhdr)); len - sizeof(struct l2_ethhdr));
} }

View file

@ -674,8 +674,9 @@ void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
wpa_printf(MSG_DEBUG, "IEEE 802.1X: %lu bytes from " MACSTR, wpa_printf(MSG_DEBUG, "IEEE 802.1X: %lu bytes from " MACSTR,
(unsigned long) len, MAC2STR(sa)); (unsigned long) len, MAC2STR(sa));
sta = ap_get_sta(hapd, sa); sta = ap_get_sta(hapd, sa);
if (!sta) { if (!sta || !(sta->flags & WLAN_STA_ASSOC)) {
printf(" no station information available\n"); wpa_printf(MSG_DEBUG, "IEEE 802.1X data frame from not "
"associated STA");
return; return;
} }