BRCM P2P update
- IFNAME for monitor interface is changed to m. from mon. This will
give extra space for incrementing X in IFNAME (p2p-wlan0-X). Also, we
have synced the reset of IFNAME w.r.t. monitor interface name.
- Fixed continuous P2P_DEV_FOUND events coming from GO. Removed the
BRCM specific change for this.
- Fixed STATUS command for p2p interface.
Change-Id: I04210dd0b2bdba06b0192c0a61edfa0e5b47ab72
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 64ec284..1ee2d15 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -351,7 +351,7 @@
char *pin;
int ret;
-#if defined ANDROID_BRCM_P2P_PATCH && defined CONFIG_AP
+#if defined(ANDROID_BRCM_P2P_PATCH) && defined(CONFIG_AP)
struct wpa_supplicant *iface;
#endif
@@ -367,7 +367,7 @@
return -1;
}
-#if defined ANDROID_BRCM_P2P_PATCH && defined CONFIG_AP
+#if defined(ANDROID_BRCM_P2P_PATCH) && defined(CONFIG_AP)
for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
if (iface->ap_iface){
wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PIN: iface 0x%08x wpa_s->ap_iface %p", iface, iface->ap_iface);
@@ -790,6 +790,19 @@
char *pos, *end, tmp[30];
int res, verbose, ret;
+#if defined(ANDROID_BRCM_P2P_PATCH) && defined(CONFIG_P2P)
+ /* We have to send status command to p2p interface if p2p_interface is started
+ * otherwise we can send it to primary interface
+ */
+ struct wpa_supplicant* ifs;
+ for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) {
+ if ( (ifs->p2p_group_interface == P2P_GROUP_INTERFACE_GO ) ||(ifs->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT )) {
+ wpa_s = ifs;
+ break;
+ }
+ }
+#endif /* defined ANDROID_BRCM_P2P_PATCH && defined CONFIG_P2P */
+
verbose = os_strcmp(params, "-VERBOSE") == 0;
pos = buf;
end = buf + buflen;
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 26e355e..2765aef 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -700,8 +700,11 @@
wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);
}
-
+#ifdef ANDROID_BRCM_P2P_PATCH
+int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
+#else
void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
+#endif /* ANDROID_BRCM_P2P_PATCH */
struct wpa_bss *selected,
struct wpa_ssid *ssid)
{
@@ -709,14 +712,23 @@
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
"PBC session overlap");
#ifdef CONFIG_P2P
- if (wpas_p2p_notif_pbc_overlap(wpa_s) == 1)
+ if (wpas_p2p_notif_pbc_overlap(wpa_s) == 1) {
+#ifdef ANDROID_BRCM_P2P_PATCH
+ return -1;
+#else
return;
+#endif
+ }
#endif /* CONFIG_P2P */
#ifdef CONFIG_WPS
wpas_wps_cancel(wpa_s);
#endif /* CONFIG_WPS */
+#ifdef ANDROID_BRCM_P2P_PATCH
+ return -1;
+#else
return;
+#endif /* ANDROID_BRCM_P2P_PATCH */
}
/*
@@ -737,7 +749,11 @@
0))) {
if (wpa_supplicant_scard_init(wpa_s, ssid)) {
wpa_supplicant_req_new_scan(wpa_s, 10, 0);
+#ifdef ANDROID_BRCM_P2P_PATCH
+ return 0;
+#else
return;
+#endif
}
wpa_msg(wpa_s, MSG_DEBUG, "Request association: "
"reassociate: %d selected: "MACSTR " bssid: " MACSTR
@@ -750,6 +766,9 @@
wpa_dbg(wpa_s, MSG_DEBUG, "Already associated with the "
"selected AP");
}
+#ifdef ANDROID_BRCM_P2P_PATCH
+ return 0;
+#endif
}
@@ -975,7 +994,14 @@
wpa_scan_results_free(scan_res);
if (skip)
return 0;
+#ifdef ANDROID_BRCM_P2P_PATCH
+ if (wpa_supplicant_connect(wpa_s, selected, ssid) < 0) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "Connect Failed");
+ return -1;
+ }
+#else
wpa_supplicant_connect(wpa_s, selected, ssid);
+#endif
wpa_supplicant_rsn_preauth_scan_results(wpa_s);
} else {
wpa_scan_results_free(scan_res);
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index a0995fe..d8b2e16 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -1017,7 +1017,16 @@
os_snprintf(ifname, sizeof(ifname), "p2p-%s-%d", wpa_s->ifname,
wpa_s->p2p_group_idx);
- if (os_strlen(ifname) >= IFNAMSIZ &&
+
+#ifdef ANDROID_BRCM_P2P_PATCH
+ /**
+ * Monitor interface name is derived from p2p interface name
+ * We need to reset p2p interface name early to take care of extra character in monitor interface name
+ */
+ if (os_strlen(ifname) + os_strlen(WPA_MONITOR_IFNAME_PREFIX) >= IFNAMSIZ &&
+#else
+ if (os_strlen(ifname) >= IFNAMSIZ &&
+#endif
os_strlen(wpa_s->ifname) < IFNAMSIZ) {
/* Try to avoid going over the IFNAMSIZ length limit */
os_snprintf(ifname, sizeof(ifname), "p2p-%d",
@@ -3677,7 +3686,7 @@
return -1;
p2p_ie = wpa_bss_get_vendor_ie_multi(bss, P2P_IE_VENDOR_TYPE);
-#ifdef ANDROID_BRCM_P2P_PATCH
+#ifdef ANDROID_BRCM_P2P_PATCH
if (p2p_ie == NULL) return -1;
#endif
ret = p2p_assoc_req_ie(wpa_s->global->p2p, bss->bssid, buf, len,
@@ -4015,7 +4024,8 @@
wpa_printf(MSG_DEBUG, "P2P: [EVENT_DEAUTH] Removing P2P_CLIENT virtual intf.");
wpa_supplicant_cancel_scan(wpa_s);
- wpas_p2p_interface_unavailable(wpa_s);
+ wpa_s->removal_reason = P2P_GROUP_REMOVAL_UNAVAILABLE;
+ wpas_p2p_group_delete(wpa_s);
}
}
#endif
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 3b7f215..3810ee0 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -2969,6 +2969,11 @@
printf("wpa_supplicant is terminating - stop monitoring\n");
wpa_cli_quit = 1;
}
+#ifdef ANDROID_BRCM_P2P_PATCH
+ else if (str_match(pos, P2P_EVENT_GO_NEG_FAILURE)) {
+ wpa_cli_exec(action_file, ctrl_ifname, pos);
+ }
+#endif
}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 7126db9..62c111d 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -637,7 +637,11 @@
/* events.c */
void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
+#ifdef ANDROID_BRCM_P2P_PATCH
+int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
+#else
void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
+#endif /* ANDROID_BRCM_P2P_PATCH */
struct wpa_bss *selected,
struct wpa_ssid *ssid);