Fix some recent wpa_msg() calls in hostapd use correct context

wpa_msg() has to use hapd->msg_ctx instead of hapd as the context
pointer to work properly in wpa_supplicant AP mode.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2011-11-03 22:04:17 +02:00
parent 6caaae1e48
commit 3ec1e9020f
2 changed files with 14 additions and 12 deletions

View file

@ -1144,19 +1144,19 @@ static void handle_deauth(struct hostapd_data *hapd,
struct sta_info *sta; struct sta_info *sta;
if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.deauth)) { if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.deauth)) {
wpa_msg(hapd, MSG_DEBUG, "handle_deauth - too short payload " wpa_msg(hapd->msg_ctx, MSG_DEBUG, "handle_deauth - too short "
"(len=%lu)", (unsigned long) len); "payload (len=%lu)", (unsigned long) len);
return; return;
} }
wpa_msg(hapd, MSG_DEBUG, "deauthentication: STA=" MACSTR wpa_msg(hapd->msg_ctx, MSG_DEBUG, "deauthentication: STA=" MACSTR
" reason_code=%d", " reason_code=%d",
MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code)); MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code));
sta = ap_get_sta(hapd, mgmt->sa); sta = ap_get_sta(hapd, mgmt->sa);
if (sta == NULL) { if (sta == NULL) {
wpa_msg(hapd, MSG_DEBUG, "Station " MACSTR " trying to " wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying "
"deauthenticate, but it is not authenticated", "to deauthenticate, but it is not authenticated",
MAC2STR(mgmt->sa)); MAC2STR(mgmt->sa));
return; return;
} }
@ -1405,7 +1405,7 @@ void ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
handle_disassoc(hapd, mgmt, len); handle_disassoc(hapd, mgmt, len);
break; break;
case WLAN_FC_STYPE_DEAUTH: case WLAN_FC_STYPE_DEAUTH:
wpa_msg(hapd, MSG_DEBUG, "mgmt::deauth"); wpa_msg(hapd->msg_ctx, MSG_DEBUG, "mgmt::deauth");
handle_deauth(hapd, mgmt, len); handle_deauth(hapd, mgmt, len);
break; break;
case WLAN_FC_STYPE_ACTION: case WLAN_FC_STYPE_ACTION:

View file

@ -281,20 +281,22 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
int inactive_sec; int inactive_sec;
inactive_sec = hostapd_drv_get_inact_sec(hapd, sta->addr); inactive_sec = hostapd_drv_get_inact_sec(hapd, sta->addr);
if (inactive_sec == -1) { if (inactive_sec == -1) {
wpa_msg(hapd, MSG_DEBUG, "Check inactivity: Could not " wpa_msg(hapd->msg_ctx, MSG_DEBUG,
"Check inactivity: Could not "
"get station info rom kernel driver for " "get station info rom kernel driver for "
MACSTR, MAC2STR(sta->addr)); MACSTR, MAC2STR(sta->addr));
} else if (inactive_sec < hapd->conf->ap_max_inactivity && } else if (inactive_sec < hapd->conf->ap_max_inactivity &&
sta->flags & WLAN_STA_ASSOC) { sta->flags & WLAN_STA_ASSOC) {
/* station activity detected; reset timeout state */ /* station activity detected; reset timeout state */
wpa_msg(hapd, MSG_DEBUG, "Station " MACSTR " has been " wpa_msg(hapd->msg_ctx, MSG_DEBUG,
"active %is ago", "Station " MACSTR " has been active %is ago",
MAC2STR(sta->addr), inactive_sec); MAC2STR(sta->addr), inactive_sec);
sta->timeout_next = STA_NULLFUNC; sta->timeout_next = STA_NULLFUNC;
next_time = hapd->conf->ap_max_inactivity - next_time = hapd->conf->ap_max_inactivity -
inactive_sec; inactive_sec;
} else { } else {
wpa_msg(hapd, MSG_DEBUG, "Station " MACSTR " has been " wpa_msg(hapd->msg_ctx, MSG_DEBUG,
"Station " MACSTR " has been "
"inactive too long: %d sec, max allowed: %d", "inactive too long: %d sec, max allowed: %d",
MAC2STR(sta->addr), inactive_sec, MAC2STR(sta->addr), inactive_sec,
hapd->conf->ap_max_inactivity); hapd->conf->ap_max_inactivity);
@ -304,8 +306,8 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
if ((sta->flags & WLAN_STA_ASSOC) && if ((sta->flags & WLAN_STA_ASSOC) &&
sta->timeout_next == STA_DISASSOC && sta->timeout_next == STA_DISASSOC &&
!(sta->flags & WLAN_STA_PENDING_POLL)) { !(sta->flags & WLAN_STA_PENDING_POLL)) {
wpa_msg(hapd, MSG_DEBUG, "Station " MACSTR " has ACKed data " wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR
"poll", MAC2STR(sta->addr)); " has ACKed data poll", MAC2STR(sta->addr));
/* data nullfunc frame poll did not produce TX errors; assume /* data nullfunc frame poll did not produce TX errors; assume
* station ACKed it */ * station ACKed it */
sta->timeout_next = STA_NULLFUNC; sta->timeout_next = STA_NULLFUNC;