diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 4092fe076..b9ec347bf 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2610,8 +2610,7 @@ static int p2p_ctrl_serv_disc_req(struct wpa_supplicant *wpa_s, char *cmd, if (*pos != ' ') return -1; pos++; - ref = (unsigned long) wpas_p2p_sd_request_upnp(wpa_s, dst, - version, pos); + ref = wpas_p2p_sd_request_upnp(wpa_s, dst, version, pos); } else { len = os_strlen(pos); if (len & 1) @@ -2625,9 +2624,11 @@ static int p2p_ctrl_serv_disc_req(struct wpa_supplicant *wpa_s, char *cmd, return -1; } - ref = (unsigned long) wpas_p2p_sd_request(wpa_s, dst, tlvs); + ref = wpas_p2p_sd_request(wpa_s, dst, tlvs); wpabuf_free(tlvs); } + if (ref == 0) + return -1; res = os_snprintf(buf, buflen, "%llx", (long long unsigned) ref); if (res < 0 || (unsigned) res >= buflen) return -1; @@ -2643,7 +2644,7 @@ static int p2p_ctrl_serv_disc_cancel_req(struct wpa_supplicant *wpa_s, if (sscanf(cmd, "%llx", &val) != 1) return -1; req = val; - return wpas_p2p_sd_cancel_request(wpa_s, (void *) (unsigned long) req); + return wpas_p2p_sd_cancel_request(wpa_s, req); } diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index 5b62b947e..de0caad6c 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -2020,13 +2020,11 @@ DBusMessage * wpas_dbus_handler_p2p_service_sd_req( if (version <= 0 || service == NULL) goto error; - ref = (unsigned long) wpas_p2p_sd_request_upnp(wpa_s, addr, - version, - service); + ref = wpas_p2p_sd_request_upnp(wpa_s, addr, version, service); } else { if (tlv == NULL) goto error; - ref = (unsigned long)wpas_p2p_sd_request(wpa_s, addr, tlv); + ref = wpas_p2p_sd_request(wpa_s, addr, tlv); wpabuf_free(tlv); } @@ -2127,7 +2125,7 @@ DBusMessage * wpas_dbus_handler_p2p_service_sd_cancel_req( if (req == 0) goto error; - if (!wpas_p2p_sd_cancel_request(wpa_s, (void *)(unsigned long) req)) + if (!wpas_p2p_sd_cancel_request(wpa_s, req)) goto error; return NULL; diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index b3c20f70e..494d74a4f 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -1490,26 +1490,26 @@ void wpas_sd_response(void *ctx, const u8 *sa, u16 update_indic, } -void * wpas_p2p_sd_request(struct wpa_supplicant *wpa_s, const u8 *dst, - const struct wpabuf *tlvs) +u64 wpas_p2p_sd_request(struct wpa_supplicant *wpa_s, const u8 *dst, + const struct wpabuf *tlvs) { if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) - return (void *) wpa_drv_p2p_sd_request(wpa_s, dst, tlvs); + return wpa_drv_p2p_sd_request(wpa_s, dst, tlvs); if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) - return NULL; - return p2p_sd_request(wpa_s->global->p2p, dst, tlvs); + return 0; + return (uintptr_t) p2p_sd_request(wpa_s->global->p2p, dst, tlvs); } -void * wpas_p2p_sd_request_upnp(struct wpa_supplicant *wpa_s, const u8 *dst, - u8 version, const char *query) +u64 wpas_p2p_sd_request_upnp(struct wpa_supplicant *wpa_s, const u8 *dst, + u8 version, const char *query) { struct wpabuf *tlvs; - void *ret; + u64 ret; tlvs = wpabuf_alloc(2 + 1 + 1 + 1 + os_strlen(query)); if (tlvs == NULL) - return NULL; + return 0; wpabuf_put_le16(tlvs, 1 + 1 + 1 + os_strlen(query)); wpabuf_put_u8(tlvs, P2P_SERV_UPNP); /* Service Protocol Type */ wpabuf_put_u8(tlvs, 1); /* Service Transaction ID */ @@ -1521,13 +1521,14 @@ void * wpas_p2p_sd_request_upnp(struct wpa_supplicant *wpa_s, const u8 *dst, } -int wpas_p2p_sd_cancel_request(struct wpa_supplicant *wpa_s, void *req) +int wpas_p2p_sd_cancel_request(struct wpa_supplicant *wpa_s, u64 req) { if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) - return wpa_drv_p2p_sd_cancel_request(wpa_s, (u64) req); + return wpa_drv_p2p_sd_cancel_request(wpa_s, req); if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) return -1; - return p2p_sd_cancel_request(wpa_s->global->p2p, req); + return p2p_sd_cancel_request(wpa_s->global->p2p, + (void *) (uintptr_t) req); } diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 91400a620..9a0af1fa5 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -80,11 +80,11 @@ void wpas_sd_request(void *ctx, int freq, const u8 *sa, u8 dialog_token, u16 update_indic, const u8 *tlvs, size_t tlvs_len); void wpas_sd_response(void *ctx, const u8 *sa, u16 update_indic, const u8 *tlvs, size_t tlvs_len); -void * wpas_p2p_sd_request(struct wpa_supplicant *wpa_s, const u8 *dst, - const struct wpabuf *tlvs); -void * wpas_p2p_sd_request_upnp(struct wpa_supplicant *wpa_s, const u8 *dst, - u8 version, const char *query); -int wpas_p2p_sd_cancel_request(struct wpa_supplicant *wpa_s, void *req); +u64 wpas_p2p_sd_request(struct wpa_supplicant *wpa_s, const u8 *dst, + const struct wpabuf *tlvs); +u64 wpas_p2p_sd_request_upnp(struct wpa_supplicant *wpa_s, const u8 *dst, + u8 version, const char *query); +int wpas_p2p_sd_cancel_request(struct wpa_supplicant *wpa_s, u64 req); void wpas_p2p_sd_response(struct wpa_supplicant *wpa_s, int freq, const u8 *dst, u8 dialog_token, const struct wpabuf *resp_tlvs);