[PATCH 1/2] ibss: fix control freq if IBSS already found

Antonio Quartulli antonio at meshcoding.com
Mon Jan 19 10:09:52 EST 2015


Hello,

On 19/01/15 10:02, Janusz Dziedzic wrote:
> If IBSS already found in scan results change
> requested frequency and disable OBSS scan.
> 
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
> ---
>  wpa_supplicant/wpa_supplicant.c | 31 ++++++++++++++++++++++++++++---
>  1 file changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
> index 000c9ba..56f4c44 100644
> --- a/wpa_supplicant/wpa_supplicant.c
> +++ b/wpa_supplicant/wpa_supplicant.c
> @@ -1650,6 +1650,12 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
>  }
>  
>  
> +static int bss_is_ibss(struct wpa_bss *bss)
> +{
> +	return ((bss->caps & (IEEE80211_CAP_ESS | IEEE80211_CAP_IBSS)) ==
> +		 IEEE80211_CAP_IBSS);
> +}
> +
>  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
>  			  const struct wpa_ssid *ssid,
>  			  struct hostapd_freq_params *freq)
> @@ -1660,17 +1666,36 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
>  			   184, 192 };
>  	struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
>  	u8 channel;
> -	int i, chan_idx, ht40 = -1, res;
> +	int i, chan_idx, ht40 = -1, res, obss_scan = 1;
>  	unsigned int j;
>  
>  	freq->freq = ssid->frequency;
>  
> +	for (i = 0; i < wpa_s->last_scan_res_used; i++) {
> +		struct wpa_bss *bss = wpa_s->last_scan_res[i];
> +
> +		if (ssid->mode != WPAS_MODE_IBSS)
> +			break;
> +
> +		if (!bss_is_ibss(bss))
> +			continue;
> +
> +		if (ssid->ssid_len == bss->ssid_len &&
> +		    !memcmp(ssid->ssid, bss->ssid, bss->ssid_len)) {
> +			wpa_printf(MSG_DEBUG, "IBSS already found in scan results, "
> +					      "adjust control freq: %d", bss->freq);
> +			freq->freq = bss->freq;
> +			obss_scan = 0;
> +			break;
> +		}
> +	}

What if the user really wanted to start the IBSS on the specify
frequency rather than joining an already existing cell ?



-- 
Antonio Quartulli

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20150119/e1292cac/attachment.pgp>


More information about the HostAP mailing list