wpa_supplicant for ad-hoc mode
    Shawn Rutledge 
    shawn.t.rutledge at gmail.com
       
    Mon Mar  2 15:15:56 EST 2009
    
    
  
Next problem though: if one peer is not running wpa_supplicant, it can
work.  If both peers are running wpa_supplicant, they will keep timing
out.  Each timeout, the ESSID is de-configured:
wlan0     Disconnected  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Bit Rate=1 Mb/s
Authentication with 00:00:00:00:00:00 timed out.
BSSID 00:00:00:00:00:00 blacklist count incremented to 12
No keys have been configured - skip key clearing
State: ASSOCIATING -> DISCONNECTED
I tried to fix it like this:
static void wpa_supplicant_timeout(void *eloop_ctx, void *timeout_ctx)
{
	struct wpa_supplicant *wpa_s = eloop_ctx;
	const u8 *bssid = wpa_s->bssid;
	if (is_zero_ether_addr(bssid))
		bssid = wpa_s->pending_bssid;
	wpa_msg(wpa_s, MSG_INFO, "Authentication with " MACSTR " timed out.",
		MAC2STR(bssid));
	// In ad-hoc mode, this can be normal because we're waiting for a
	// peer to appear with the same SSID.
	if ( wpa_s->current_ssid->mode == IEEE80211_MODE_INFRA)
	{
		wpa_blacklist_add(wpa_s, bssid);
		wpa_sm_notify_disassoc(wpa_s->wpa);
		wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
	}
	wpa_s->reassociate = 1;
	wpa_supplicant_req_scan(wpa_s, 0, 0);
}
which tentatively seems to be working.
Why doesn't anybody comment on this thread?  Is nobody interested
using wpa_supplicant in ad-hoc mode?  Is there something wrong with
the very idea of it?  I think it would be helpful for easy wireless
configuration in every Linux distro, if one could unconditionally run
wpa_supplicant on every system, and it fit every wireless use case
(including ad-hoc).  Some typical distro-dependent scripting could be
simplified.
On 2/20/09, Shawn Rutledge <shawn.t.rutledge at gmail.com> wrote:
> For what it's worth, ad-hoc mode is working when I use the latest
>  wpa_supplicant from git (calls itself 0.7.0).  There were some fixes
>  to the proprietary Socket P300 driver from Embwise... maybe that has
>  something to do with it.  My custom GUI sends something like
>
>  SET_NETWORK 5 mode 1
>
>  and so mode=1 gets put into the conf file.  If wpa_gui is not yet
>  doing the same thing, I still think it should.
>
    
    
More information about the HostAP
mailing list