OSDN Git Service

wpa_supplicant: Update to BRCM version 0.8.0-34
authorDmitry Shmidt <dimitrysh@google.com>
Wed, 8 Aug 2012 17:56:33 +0000 (10:56 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Wed, 8 Aug 2012 17:56:33 +0000 (10:56 -0700)
- Remove interface priority
- Add action parameter to service discovery functionality

Change-Id: Ibc74c4053996e91f2f577b57695c68c86b5603c2
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
src/ap/ap_config.c
src/ap/ap_config.h
src/p2p/p2p.h
src/p2p/p2p_i.h
src/p2p/p2p_sd.c
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h

index 811ffc1..2c633d9 100644 (file)
@@ -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);
index 13d5549..ca4fe58 100644 (file)
@@ -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;
index 7006707..8274d73 100644 (file)
@@ -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 {
index 5e21249..b0abff0 100644 (file)
@@ -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;
index 0509767..7a59f10 100644 (file)
@@ -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
 }
 
 
index a795c41..b89732d 100644 (file)
@@ -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 },
index 074e384..b43796f 100644 (file)
@@ -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
index 1065ef9..849633a 100644 (file)
@@ -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;
index e0c3580..fad8bd2 100644 (file)
@@ -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;
 }
 
index 24fb81e..5af323f 100644 (file)
@@ -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);