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) int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr)
{ {
struct p2p_message msg; 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) void p2p_deinit(struct p2p_data *p2p)
{ {
struct p2ps_advertisement *adv, *prev;
#ifdef CONFIG_WIFI_DISPLAY #ifdef CONFIG_WIFI_DISPLAY
wpabuf_free(p2p->wfd_ie_beacon); wpabuf_free(p2p->wfd_ie_beacon);
wpabuf_free(p2p->wfd_ie_probe_req); wpabuf_free(p2p->wfd_ie_probe_req);
@ -2913,13 +2930,7 @@ void p2p_deinit(struct p2p_data *p2p)
os_free(p2p->after_scan_tx); os_free(p2p->after_scan_tx);
p2p_remove_wps_vendor_extensions(p2p); p2p_remove_wps_vendor_extensions(p2p);
os_free(p2p->no_go_freq.range); os_free(p2p->no_go_freq.range);
p2p_service_flush_asp(p2p);
adv = p2p->p2ps_adv_list;
while (adv) {
prev = adv;
adv = adv->next;
os_free(prev);
}
os_free(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, const char *adv_str, u8 svc_state,
u16 config_methods, const char *svc_info); u16 config_methods, const char *svc_info);
int p2p_service_del_asp(struct p2p_data *p2p, u32 adv_id); 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); struct p2ps_advertisement * p2p_get_p2ps_adv_list(struct p2p_data *p2p);
#endif /* P2P_H */ #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, u32 adv_id, const char *adv_str, u8 svc_state,
u16 config_methods, const char *svc_info); u16 config_methods, const char *svc_info);
int wpas_p2p_service_del_asp(struct wpa_supplicant *wpa_s, u32 adv_id); 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); 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, void wpas_sd_request(void *ctx, int freq, const u8 *sa, u8 dialog_token,
u16 update_indic, const u8 *tlvs, size_t tlvs_len); 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) struct p2p_srv_upnp, list)
wpas_p2p_srv_upnp_free(usrv); wpas_p2p_srv_upnp_free(usrv);
wpas_p2p_service_flush_asp(wpa_s);
wpas_p2p_sd_service_update(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, int wpas_p2p_service_add_bonjour(struct wpa_supplicant *wpa_s,
struct wpabuf *query, struct wpabuf *resp) struct wpabuf *query, struct wpabuf *resp)
{ {