aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ap/ap_config.c3
-rw-r--r--src/ap/ap_config.h3
-rw-r--r--src/p2p/p2p.h9
-rw-r--r--src/p2p/p2p_i.h7
-rw-r--r--src/p2p/p2p_sd.c24
-rw-r--r--wpa_supplicant/config.c6
-rw-r--r--wpa_supplicant/config.h3
-rw-r--r--wpa_supplicant/ctrl_iface.c4
-rw-r--r--wpa_supplicant/p2p_supplicant.c34
-rw-r--r--wpa_supplicant/p2p_supplicant.h4
10 files changed, 80 insertions, 17 deletions
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 811ffc1..2c633d9 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -474,9 +474,6 @@ static void hostapd_config_free_bss(struct hostapd_bss_config *conf)
}
#endif /* CONFIG_IEEE80211R */
-#ifdef ANDROID_P2P
- os_free(conf->prioritize);
-#endif
#ifdef CONFIG_WPS
os_free(conf->wps_pin_requests);
os_free(conf->device_name);
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 13d5549..ca4fe58 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -323,9 +323,6 @@ struct hostapd_bss_config {
u8 uuid[16];
char *wps_pin_requests;
char *device_name;
-#ifdef ANDROID_P2P
- char *prioritize;
-#endif
char *manufacturer;
char *model_name;
char *model_number;
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 7006707..8274d73 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -53,6 +53,10 @@ enum p2p_wps_method {
WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC
};
+enum p2p_sd_action {
+ SRV_UPDATE, SRV_ADD, SRV_DEL, SRV_FLUSH
+};
+
/**
* struct p2p_go_neg_results - P2P Group Owner Negotiation results
*/
@@ -131,6 +135,7 @@ struct p2p_data;
enum p2p_scan_type {
P2P_SCAN_SOCIAL,
P2P_SCAN_FULL,
+ P2P_SCAN_SPECIFIC,
P2P_SCAN_SOCIAL_PLUS_ONE
};
@@ -986,7 +991,11 @@ void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
* of the local services. This will increment the Service Update Indicator
* value which will be used in SD Request and Response frames.
*/
+#ifdef ANDROID_P2P
+void p2p_sd_service_update(struct p2p_data *p2p, int action);
+#else
void p2p_sd_service_update(struct p2p_data *p2p);
+#endif
enum p2p_invite_role {
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index 5e21249..b0abff0 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -344,7 +344,12 @@ struct p2p_data {
* srv_update_indic - Service Update Indicator for local services
*/
u16 srv_update_indic;
-
+#ifdef ANDROID_P2P
+ /**
+ * srv_count - Registered services count
+ */
+ u16 srv_count;
+#endif
struct wpabuf *sd_resp; /* Fragmented SD response */
u8 sd_resp_addr[ETH_ALEN];
u8 sd_resp_dialog_token;
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 0509767..7a59f10 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -907,9 +907,33 @@ void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,
}
+#ifdef ANDROID_P2P
+void p2p_sd_service_update(struct p2p_data *p2p, int action)
+#else
void p2p_sd_service_update(struct p2p_data *p2p)
+#endif
{
p2p->srv_update_indic++;
+#ifdef ANDROID_P2P
+ if(action == SRV_FLUSH)
+ p2p->srv_count = 0;
+ else if (action == SRV_DEL)
+ p2p->srv_count--;
+ else if (action == SRV_ADD)
+ p2p->srv_count++;
+
+ if(p2p->cfg->sd_request) {
+ if (p2p->srv_count == 1) {
+ /* First Service Registered. Enable SD capability */
+ p2p->dev_capab |= P2P_DEV_CAPAB_SERVICE_DISCOVERY;
+ } else if (p2p->srv_count == 0 && !p2p->sd_queries) {
+ /* No services remaining + No queries registered .
+ * Remove the SD Capability
+ */
+ p2p->dev_capab &= ~P2P_DEV_CAPAB_SERVICE_DISCOVERY;
+ }
+ }
+#endif
}
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index a795c41..b89732d 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1905,9 +1905,6 @@ void wpa_config_free(struct wpa_config *config)
wpabuf_free(config->wps_nfc_dh_pubkey);
wpabuf_free(config->wps_nfc_dh_privkey);
wpabuf_free(config->wps_nfc_dev_pw);
-#ifdef ANDROID_P2P
- os_free(config->prioritize);
-#endif
os_free(config);
}
@@ -2948,9 +2945,6 @@ static const struct global_parse_data global_fields[] = {
{ INT(p2p_group_idle), 0 },
{ FUNC(p2p_pref_chan), CFG_CHANGED_P2P_PREF_CHAN },
#endif /* CONFIG_P2P */
-#ifdef ANDROID_P2P
- { STR_RANGE(prioritize, 0, 32), CFG_CHANGED_IFACE_PRIORITY },
-#endif
{ FUNC(country), CFG_CHANGED_COUNTRY },
{ INT(bss_max_count), 0 },
{ INT(bss_expiration_age), 0 },
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 074e384..b43796f 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -165,9 +165,6 @@ struct wpa_cred {
#define CFG_CHANGED_P2P_LISTEN_CHANNEL BIT(11)
#define CFG_CHANGED_P2P_OPER_CHANNEL BIT(12)
#define CFG_CHANGED_P2P_PREF_CHAN BIT(13)
-#ifdef ANDROID_P2P
-#define CFG_CHANGED_IFACE_PRIORITY BIT(14)
-#endif
/**
* struct wpa_config - wpa_supplicant configuration data
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 1065ef9..849633a 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -4375,7 +4375,11 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
if (p2p_ctrl_serv_disc_resp(wpa_s, buf + 19) < 0)
reply_len = -1;
} else if (os_strcmp(buf, "P2P_SERVICE_UPDATE") == 0) {
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_UPDATE);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
} else if (os_strncmp(buf, "P2P_SERV_DISC_EXTERNAL ", 23) == 0) {
if (p2p_ctrl_serv_disc_external(wpa_s, buf + 23) < 0)
reply_len = -1;
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index e0c3580..fad8bd2 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -173,6 +173,11 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
break;
case P2P_SCAN_FULL:
break;
+ case P2P_SCAN_SPECIFIC:
+ social_channels[0] = freq;
+ social_channels[1] = 0;
+ params.freqs = social_channels;
+ break;
case P2P_SCAN_SOCIAL_PLUS_ONE:
social_channels[3] = freq;
params.freqs = social_channels;
@@ -1672,15 +1677,22 @@ void wpas_p2p_sd_response(struct wpa_supplicant *wpa_s, int freq,
resp_tlvs);
}
-
+#ifdef ANDROID_P2P
+void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s, int action)
+#else
void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s)
+#endif
{
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
wpa_drv_p2p_service_update(wpa_s);
return;
}
if (wpa_s->global->p2p)
+#ifdef ANDROID_P2P
+ p2p_sd_service_update(wpa_s->global->p2p, action);
+#else
p2p_sd_service_update(wpa_s->global->p2p);
+#endif
}
@@ -1714,7 +1726,11 @@ void wpas_p2p_service_flush(struct wpa_supplicant *wpa_s)
struct p2p_srv_upnp, list)
wpas_p2p_srv_upnp_free(usrv);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_FLUSH);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
}
@@ -1738,7 +1754,11 @@ int wpas_p2p_service_add_bonjour(struct wpa_supplicant *wpa_s,
bsrv->resp = resp;
dl_list_add(&wpa_s->global->p2p_srv_bonjour, &bsrv->list);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_ADD);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
return 0;
}
@@ -1752,7 +1772,11 @@ int wpas_p2p_service_del_bonjour(struct wpa_supplicant *wpa_s,
if (bsrv == NULL)
return -1;
wpas_p2p_srv_bonjour_free(bsrv);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_DEL);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
return 0;
}
@@ -1775,7 +1799,11 @@ int wpas_p2p_service_add_upnp(struct wpa_supplicant *wpa_s, u8 version,
}
dl_list_add(&wpa_s->global->p2p_srv_upnp, &usrv->list);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_ADD);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
return 0;
}
@@ -1789,7 +1817,11 @@ int wpas_p2p_service_del_upnp(struct wpa_supplicant *wpa_s, u8 version,
if (usrv == NULL)
return -1;
wpas_p2p_srv_upnp_free(usrv);
+#ifdef ANDROID_P2P
+ wpas_p2p_sd_service_update(wpa_s, SRV_DEL);
+#else
wpas_p2p_sd_service_update(wpa_s);
+#endif
return 0;
}
diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h
index 24fb81e..5af323f 100644
--- a/wpa_supplicant/p2p_supplicant.h
+++ b/wpa_supplicant/p2p_supplicant.h
@@ -94,7 +94,11 @@ 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);
+#ifdef ANDROID_P2P
+void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s, int action);
+#else
void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s);
+#endif
void wpas_p2p_service_flush(struct wpa_supplicant *wpa_s);
int wpas_p2p_service_add_bonjour(struct wpa_supplicant *wpa_s,
struct wpabuf *query, struct wpabuf *resp);