wpa_printf(MSG_INFO, "WPA: Not enough entropy in random pool "
"for secure operations - update keys later when "
"the first station connects");
+#ifdef ANDROID_BRCM_P2P_PATCH
+ os_free(group);
+ return NULL;
+#endif
}
/*
#define HOSTAPD_CHAN_HT40MINUS 0x00000020
#define HOSTAPD_CHAN_HT40 0x00000040
+#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
+ */
+#define WPA_MONITOR_IFNAME_PREFIX "m."
+#endif
+
/**
* struct hostapd_channel_data - Channel information
*/
const struct ieee80211_mgmt *mgmt;
union wpa_event_data event;
u16 status;
-#ifdef ANDROID_BRCM_P2P_PATCH
+#ifdef ANDROID_BRCM_P2P_PATCH
struct wpa_supplicant *wpa_s = drv->ctx;
#endif
mgmt = (const struct ieee80211_mgmt *) frame;
-#if (defined (CONFIG_AP) || defined (HOSTAPD) ) && defined (ANDROID_BRCM_P2P_PATCH)
+#if (defined (CONFIG_AP) || defined (HOSTAPD) ) && defined (ANDROID_BRCM_P2P_PATCH)
if (drv->nlmode == NL80211_IFTYPE_AP || drv->nlmode == NL80211_IFTYPE_P2P_GO) {
if (len < 24 + sizeof(mgmt->u.assoc_req)) {
wpa_printf(MSG_DEBUG, "nl80211: Too short association event "
}
event.assoc_info.freq = drv->assoc_freq;
-#if (defined (CONFIG_AP) || defined(HOSTAPD)) && defined (ANDROID_BRCM_P2P_PATCH)
+#if (defined (CONFIG_AP) || defined(HOSTAPD)) && defined (ANDROID_BRCM_P2P_PATCH)
}
#endif
wpa_supplicant_event(drv->ctx, EVENT_ASSOC, &event);
reason_code = le_to_host16(mgmt->u.deauth.reason_code);
if (type == EVENT_DISASSOC) {
-#ifdef ANDROID_BRCM_P2P_PATCH
+#ifdef ANDROID_BRCM_P2P_PATCH
if (drv->nlmode == NL80211_IFTYPE_AP ||
drv->nlmode == NL80211_IFTYPE_P2P_GO) {
event.disassoc_info.addr = mgmt->sa;
mgmt->u.disassoc.variable;
}
} else {
-#ifdef ANDROID_BRCM_P2P_PATCH
+#ifdef ANDROID_BRCM_P2P_PATCH
if (drv->nlmode == NL80211_IFTYPE_AP ||
drv->nlmode == NL80211_IFTYPE_P2P_GO) {
event.deauth_info.addr = mgmt->sa;
int ret;
int beacon_set;
int ifindex = if_nametoindex(bss->ifname);
-#ifdef ANDROID_BRCM_P2P_PATCH
+#ifdef ANDROID_BRCM_P2P_PATCH
beacon_set = 1;
#else
beacon_set = bss->beacon_set;
NL80211_CHAN_HT40PLUS);
break;
default:
-#ifndef ANDROID_BRCM_P2P_PATCH
+#ifndef ANDROID_BRCM_P2P_PATCH
/* Should be change to HT20 as a default value because P2P firmware does not support 11n for BCM4329 */
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
NL80211_CHAN_HT20);
struct sockaddr_ll ll;
int optval;
socklen_t optlen;
-
+#ifdef ANDROID_BRCM_P2P_PATCH
+ snprintf(buf, IFNAMSIZ, "%s%s", WPA_MONITOR_IFNAME_PREFIX, drv->first_bss.ifname);
+#else
snprintf(buf, IFNAMSIZ, "mon.%s", drv->first_bss.ifname);
+#endif
buf[IFNAMSIZ - 1] = '\0';
drv->monitor_ifidx =
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
-#ifndef ANDROID_BRCM_P2P_PATCH
+#ifndef ANDROID_BRCM_P2P_PATCH
NLA_PUT_U32(msg, NL80211_ATTR_DURATION, wait);
#endif
NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK);
goto out_err3;
}
-#ifdef ANDROID_BRCM_P2P_PATCH
+#ifdef ANDROID_BRCM_P2P_PATCH
if (drv->nlmode != NL80211_IFTYPE_AP &&
drv->nlmode != NL80211_IFTYPE_P2P_GO) {
wpa_printf(MSG_DEBUG, "nl80211: probe_req_report control only "
if (msg->capability) {
dev->info.dev_capab = msg->capability[0];
-#ifdef ANDROID_BRCM_P2P_PATCH
- if( dev->info.group_capab != msg->capability[1])
- dev->flags &= ~P2P_DEV_REPORTED;
-#endif
dev->info.group_capab = msg->capability[1];
}
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
if (p2p_send_action(p2p, freq, dst, p2p->cfg->dev_addr,
+ #ifdef ANDROID_BRCM_P2P_PATCH
+ p2p->cfg->p2p_dev_addr,
+ #else
p2p->cfg->dev_addr,
+ #endif
wpabuf_head(resp), wpabuf_len(resp), 200) < 0)
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
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
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);
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;
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)
{
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 */
}
/*
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
wpa_dbg(wpa_s, MSG_DEBUG, "Already associated with the "
"selected AP");
}
+#ifdef ANDROID_BRCM_P2P_PATCH
+ return 0;
+#endif
}
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);
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",
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,
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
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
}
/* 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);