diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index ff739f2a9..e8bb87232 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -464,6 +464,7 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd) hapd->ctrl_sock = s; eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd, NULL); + hapd->msg_ctx = hapd; wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); return 0; diff --git a/hostapd/hostapd.h b/hostapd/hostapd.h index 386889edc..d0cec3992 100644 --- a/hostapd/hostapd.h +++ b/hostapd/hostapd.h @@ -62,6 +62,8 @@ struct hostapd_data { const struct wpa_driver_ops *driver; void *drv_priv; + void *msg_ctx; /* ctx for wpa_msg() calls */ + struct radius_client_data *radius; int radius_client_reconfigured; u32 acct_session_id_hi, acct_session_id_lo; diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c index 42568cd30..fd2e65a23 100644 --- a/hostapd/wps_hostapd.c +++ b/hostapd/wps_hostapd.c @@ -147,7 +147,7 @@ static void hostapd_wps_pin_needed_cb(void *ctx, const u8 *uuid_e, dev->model_number, dev->serial_number, dev->categ, dev->oui, dev->sub_categ); 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) { FILE *f; @@ -174,7 +174,7 @@ static void hostapd_wps_reg_success_cb(void *ctx, const u8 *mac_addr, char uuid[40]; if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) 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); } @@ -228,12 +228,12 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred) if (_buf) { wpa_snprintf_hex(_buf, blen, 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); os_free(_buf); } } 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) return 0; @@ -435,7 +435,7 @@ static void hostapd_pwd_auth_fail(struct hostapd_data *hapd, if (hapd->ap_pin_failures < 4) 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; wps_registrar_update_ie(hapd->wps->registrar); diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 7886ee0ba..d94f099e0 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -462,6 +462,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, wpa_supplicant_ap_deinit(wpa_s); return -1; } + + hapd_iface->bss[i]->msg_ctx = wpa_s; } if (hostapd_setup_interface(wpa_s->ap_iface)) {