Fix hostapd wpa_msg() calls ctx for wpa_supplicant AP mode

Need to use wpa_s pointer, not hapd pointer, for these calls.
This commit is contained in:
Jouni Malinen 2009-09-29 21:25:14 +03:00 committed by Jouni Malinen
parent acfbf1f5d7
commit 4f760fcc7c
4 changed files with 10 additions and 5 deletions

View file

@ -464,6 +464,7 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
hapd->ctrl_sock = s; hapd->ctrl_sock = s;
eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd, eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
NULL); NULL);
hapd->msg_ctx = hapd;
wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
return 0; return 0;

View file

@ -62,6 +62,8 @@ struct hostapd_data {
const struct wpa_driver_ops *driver; const struct wpa_driver_ops *driver;
void *drv_priv; void *drv_priv;
void *msg_ctx; /* ctx for wpa_msg() calls */
struct radius_client_data *radius; struct radius_client_data *radius;
int radius_client_reconfigured; int radius_client_reconfigured;
u32 acct_session_id_hi, acct_session_id_lo; u32 acct_session_id_hi, acct_session_id_lo;

View file

@ -147,7 +147,7 @@ static void hostapd_wps_pin_needed_cb(void *ctx, const u8 *uuid_e,
dev->model_number, dev->serial_number, dev->model_number, dev->serial_number,
dev->categ, dev->oui, dev->sub_categ); dev->categ, dev->oui, dev->sub_categ);
if (len > 0 && len < (int) sizeof(txt)) if (len > 0 && len < (int) sizeof(txt))
wpa_msg(hapd, MSG_INFO, "%s", txt); wpa_msg(hapd->msg_ctx, MSG_INFO, "%s", txt);
if (hapd->conf->wps_pin_requests) { if (hapd->conf->wps_pin_requests) {
FILE *f; FILE *f;
@ -174,7 +174,7 @@ static void hostapd_wps_reg_success_cb(void *ctx, const u8 *mac_addr,
char uuid[40]; char uuid[40];
if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) if (uuid_bin2str(uuid_e, uuid, sizeof(uuid)))
return; return;
wpa_msg(hapd, MSG_INFO, WPS_EVENT_REG_SUCCESS MACSTR " %s", wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_REG_SUCCESS MACSTR " %s",
MAC2STR(mac_addr), uuid); MAC2STR(mac_addr), uuid);
} }
@ -228,12 +228,12 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
if (_buf) { if (_buf) {
wpa_snprintf_hex(_buf, blen, wpa_snprintf_hex(_buf, blen,
cred->cred_attr, cred->cred_attr_len); cred->cred_attr, cred->cred_attr_len);
wpa_msg(hapd, MSG_INFO, "%s%s", wpa_msg(hapd->msg_ctx, MSG_INFO, "%s%s",
WPS_EVENT_NEW_AP_SETTINGS, _buf); WPS_EVENT_NEW_AP_SETTINGS, _buf);
os_free(_buf); os_free(_buf);
} }
} else } else
wpa_msg(hapd, MSG_INFO, WPS_EVENT_NEW_AP_SETTINGS); wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_NEW_AP_SETTINGS);
if (hapd->conf->wps_cred_processing == 1) if (hapd->conf->wps_cred_processing == 1)
return 0; return 0;
@ -435,7 +435,7 @@ static void hostapd_pwd_auth_fail(struct hostapd_data *hapd,
if (hapd->ap_pin_failures < 4) if (hapd->ap_pin_failures < 4)
return; return;
wpa_msg(hapd, MSG_INFO, WPS_EVENT_AP_SETUP_LOCKED); wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_SETUP_LOCKED);
hapd->wps->ap_setup_locked = 1; hapd->wps->ap_setup_locked = 1;
wps_registrar_update_ie(hapd->wps->registrar); wps_registrar_update_ie(hapd->wps->registrar);

View file

@ -462,6 +462,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
wpa_supplicant_ap_deinit(wpa_s); wpa_supplicant_ap_deinit(wpa_s);
return -1; return -1;
} }
hapd_iface->bss[i]->msg_ctx = wpa_s;
} }
if (hostapd_setup_interface(wpa_s->ap_iface)) { if (hostapd_setup_interface(wpa_s->ap_iface)) {