P2PS: Delete ASP advertisements on wpas_p2p_service_flush

Delete all ASP serice advertisement on wpas_p2p_service_flush similarly
to Bonjour and UPnP services.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
This commit is contained in:
Max Stepanov 2015-03-16 01:16:57 -04:00 committed by Jouni Malinen
parent 2dc422e2b3
commit c40a8918ec
4 changed files with 29 additions and 9 deletions

View file

@ -2730,6 +2730,25 @@ inserted:
}
void p2p_service_flush_asp(struct p2p_data *p2p)
{
struct p2ps_advertisement *adv, *prev;
if (!p2p)
return;
adv = p2p->p2ps_adv_list;
while (adv) {
prev = adv;
adv = adv->next;
os_free(prev);
}
p2p->p2ps_adv_list = NULL;
p2p_dbg(p2p, "All ASP advertisements flushed");
}
int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr)
{
struct p2p_message msg;
@ -2878,8 +2897,6 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg)
void p2p_deinit(struct p2p_data *p2p)
{
struct p2ps_advertisement *adv, *prev;
#ifdef CONFIG_WIFI_DISPLAY
wpabuf_free(p2p->wfd_ie_beacon);
wpabuf_free(p2p->wfd_ie_probe_req);
@ -2913,13 +2930,7 @@ void p2p_deinit(struct p2p_data *p2p)
os_free(p2p->after_scan_tx);
p2p_remove_wps_vendor_extensions(p2p);
os_free(p2p->no_go_freq.range);
adv = p2p->p2ps_adv_list;
while (adv) {
prev = adv;
adv = adv->next;
os_free(prev);
}
p2p_service_flush_asp(p2p);
os_free(p2p);
}

View file

@ -2242,6 +2242,7 @@ int p2p_service_add_asp(struct p2p_data *p2p, int auto_accept, u32 adv_id,
const char *adv_str, u8 svc_state,
u16 config_methods, const char *svc_info);
int p2p_service_del_asp(struct p2p_data *p2p, u32 adv_id);
void p2p_service_flush_asp(struct p2p_data *p2p);
struct p2ps_advertisement * p2p_get_p2ps_adv_list(struct p2p_data *p2p);
#endif /* P2P_H */

View file

@ -93,6 +93,7 @@ int wpas_p2p_service_add_asp(struct wpa_supplicant *wpa_s, int auto_accept,
u32 adv_id, const char *adv_str, u8 svc_state,
u16 config_methods, const char *svc_info);
int wpas_p2p_service_del_asp(struct wpa_supplicant *wpa_s, u32 adv_id);
void wpas_p2p_service_flush_asp(struct wpa_supplicant *wpa_s);
int wpas_p2p_service_p2ps_id_exists(struct wpa_supplicant *wpa_s, u32 adv_id);
void wpas_sd_request(void *ctx, int freq, const u8 *sa, u8 dialog_token,
u16 update_indic, const u8 *tlvs, size_t tlvs_len);

View file

@ -1136,6 +1136,7 @@ void wpas_p2p_service_flush(struct wpa_supplicant *wpa_s)
struct p2p_srv_upnp, list)
wpas_p2p_srv_upnp_free(usrv);
wpas_p2p_service_flush_asp(wpa_s);
wpas_p2p_sd_service_update(wpa_s);
}
@ -1179,6 +1180,12 @@ int wpas_p2p_service_add_asp(struct wpa_supplicant *wpa_s,
}
void wpas_p2p_service_flush_asp(struct wpa_supplicant *wpa_s)
{
p2p_service_flush_asp(wpa_s->global->p2p);
}
int wpas_p2p_service_add_bonjour(struct wpa_supplicant *wpa_s,
struct wpabuf *query, struct wpabuf *resp)
{