| Submitter | Masashi Honma |
|---|---|
| Date | July 13, 2012, 1 p.m. |
| Message ID | <CAFk-A4nF8aoppuRQ68u82xFFuAiXMf_cBc+iPtJXH_yb7kZLrw@mail.gmail.com> |
| Download | mbox | patch |
| Permalink | /patch/170883/ |
| State | Accepted |
| Commit | 0a0c38f63d825b352deb819b32a0fb1203eb936c |
| Headers | show |
Comments
On Fri, Jul 13, 2012 at 10:00:45PM +0900, Masashi Honma wrote: > There is a device driver causes Fig.2 case. > The device driver returns EINVAL for get_bssid() because it recognizes it has > already been disconnected. > When the wpa_supplicant received EINVAL, the wpa_supplicant recognized that > it's own BSSID is 00:00:00:00:00:00. > This patch solves this issue. Thanks, applied. Please include the Signed-hostap: tag in future contributions to avoid extra delays once I start being more strict about this getting included in every commit to hostap.git.
Patch
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 59b103e..5b7c14a 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1523,9 +1523,15 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, if (data && wpa_supplicant_event_associnfo(wpa_s, data) < 0) return; + if (wpa_drv_get_bssid(wpa_s, bssid) < 0) { + wpa_dbg(wpa_s, MSG_ERROR, "Failed to get BSSID"); + wpa_supplicant_disassociate( + wpa_s, WLAN_REASON_DEAUTH_LEAVING); + return; + } + wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATED); - if (wpa_drv_get_bssid(wpa_s, bssid) >= 0 && - os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0) { + if (os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0) { wpa_dbg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID=" MACSTR, MAC2STR(bssid));
On the ordinally case, the flow is like Fig.1. wpa_supplicant <--(EVENT_ASSOC event )-- device driver wpa_supplicant --( get_bssid() )--> device driver wpa_supplicant <--( return BSSID )-- device driver Fig.1. Ordinally case There is a device driver causes Fig.2 case. The device driver returns EINVAL for get_bssid() because it recognizes it has already been disconnected. When the wpa_supplicant received EINVAL, the wpa_supplicant recognized that it's own BSSID is 00:00:00:00:00:00. wpa_supplicant <--(EVENT_ASSOC event )-- device driver device driver (receive deauth) wpa_supplicant --( get_bssid() )--> device driver wpa_supplicant <--( return EINVAL )-- device driver Fig.2. Invalid case This patch solves this issue. random_add_randomness(bssid, ETH_ALEN); Regards, Masashi Honma.