[PATCH] Retreive shared frequency when a singly "phy" is shared between multiple interfaces

Jithu Jance jithu
Wed Nov 9 23:34:24 PST 2011


This patch implements shared_freq handler for driver_nl80211.c If a "p2p_group_add" happens after legacy STA association, then this
patch will help to start the GO on the same frequency. This is useful when supplicant is started on multiple interface running over
a singly "PHY". 

For e.g wpa_supplicant -iwlan0 ..  -N -iwlan1 ...

Kindly see whether the patch is okay.


Signed-hostap: Jithu Jance <jithu at broadcom.com>


---
 src/drivers/driver_nl80211.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 2ab10ae..4948e38 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -269,6 +269,7 @@ static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv,
 				  const u8 *buf, size_t buf_len, u64 *cookie,
 				  int no_cck);
 static int wpa_driver_nl80211_probe_req_report(void *priv, int report);
+static int wpa_driver_nl80211_shared_freq(void *priv);
 
 #ifdef HOSTAPD
 static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx);
@@ -7231,6 +7232,41 @@ static int nl80211_signal_poll(void *priv, struct wpa_signal_info *si)
 	return nl80211_get_link_noise(drv, si);
 }
 
+static int wpa_driver_nl80211_shared_freq(void *priv)
+{
+	struct i802_bss *bss = priv;
+     struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl80211_global *global = drv->global;
+	struct wpa_driver_nl80211_data *driver = NULL;
+	int freq = 0;
+
+	/* If the same phy is in connected state with some other interface,
+	 * then retrieve the assoc freq */
+	wpa_printf(MSG_DEBUG, "nl80211: get shared freq for PHY(%s)", drv->phyname);
+
+        dl_list_for_each(driver, &global->interfaces,
+                         struct wpa_driver_nl80211_data, list) {
+
+		/* skip, if its the same instance */
+		if(drv == driver)
+			continue;
+
+		if(os_strcmp(drv->phyname, driver->phyname) == 0) {
+			if(driver->associated) {
+				wpa_printf(MSG_DEBUG, "nl80211: Found a match for (%s) "
+					"with macaddr("MACSTR") associated to %s ",
+					driver->phyname, MAC2STR(driver->addr), driver->ssid);
+				freq = nl80211_get_assoc_freq(driver);
+				wpa_printf(MSG_DEBUG, "nl80211: shared freq for PHY(%s):%d ", drv->phyname, freq);
+			}
+		}
+	}
+
+	if(!freq)
+		wpa_printf(MSG_DEBUG, "nl80211: No shared Interface for PHY(%s)", drv->phyname);
+
+	return freq;
+}
 
 static int nl80211_send_frame(void *priv, const u8 *data, size_t data_len,
 			      int encrypt)
@@ -7612,6 +7648,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.signal_monitor = nl80211_signal_monitor,
 	.signal_poll = nl80211_signal_poll,
 	.send_frame = nl80211_send_frame,
+	.shared_freq = wpa_driver_nl80211_shared_freq,
 	.set_param = nl80211_set_param,
 	.get_radio_name = nl80211_get_radio_name,
 	.add_pmkid = nl80211_add_pmkid,
-- 
1.7.4.1





- Jithu Jance.






More information about the Hostap mailing list