nl80211: Implement shared_freq

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"
and the station interface is not used for the P2P device operations.

For example, wpa_supplicant -iwlan0 ..  -N -iwlan1 ... and wlan0 is used
for station connection and wlan1 as the P2P device interface.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
This commit is contained in:
Jithu Jance 2011-11-19 11:23:49 +02:00 committed by Jouni Malinen
parent 3b7ea88047
commit 57ebba598d

View file

@ -7216,6 +7216,44 @@ static int nl80211_signal_poll(void *priv, struct wpa_signal_info *si)
}
static int wpa_driver_nl80211_shared_freq(void *priv)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
struct wpa_driver_nl80211_data *driver;
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, &drv->global->interfaces,
struct wpa_driver_nl80211_data, list) {
if (drv == driver ||
os_strcmp(drv->phyname, driver->phyname) != 0 ||
!driver->associated)
continue;
wpa_printf(MSG_DEBUG, "nl80211: Found a match for PHY %s - %s "
MACSTR,
driver->phyname, driver->first_bss.ifname,
MAC2STR(driver->addr));
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) in associated state", drv->phyname);
return freq;
}
static int nl80211_send_frame(void *priv, const u8 *data, size_t data_len,
int encrypt)
{
@ -7594,6 +7632,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,