Commit feeeaa87 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

[PATCH] softmac: fix event sending

Softmac is sending custom events to userspace already, but it
should _really_ be sending the right WEXT events instead. This
patch fixes that.
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 68970ce6
...@@ -267,8 +267,9 @@ extern void ieee80211softmac_stop(struct net_device *dev); ...@@ -267,8 +267,9 @@ extern void ieee80211softmac_stop(struct net_device *dev);
#define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5 #define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5
#define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6 #define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6
#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7 #define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7
#define IEEE80211SOFTMAC_EVENT_DISASSOCIATED 8
/* keep this updated! */ /* keep this updated! */
#define IEEE80211SOFTMAC_EVENT_LAST 7 #define IEEE80211SOFTMAC_EVENT_LAST 8
/* /*
* If you want to be notified of certain events, you can call * If you want to be notified of certain events, you can call
* ieee80211softmac_notify[_atomic] with * ieee80211softmac_notify[_atomic] with
......
...@@ -101,6 +101,7 @@ ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason) ...@@ -101,6 +101,7 @@ ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason)
/* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */
mac->associated = 0; mac->associated = 0;
mac->associnfo.associating = 0; mac->associnfo.associating = 0;
ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL);
spin_unlock_irqrestore(&mac->lock, flags); spin_unlock_irqrestore(&mac->lock, flags);
} }
...@@ -373,6 +374,7 @@ ieee80211softmac_handle_disassoc(struct net_device * dev, ...@@ -373,6 +374,7 @@ ieee80211softmac_handle_disassoc(struct net_device * dev,
spin_lock_irqsave(&mac->lock, flags); spin_lock_irqsave(&mac->lock, flags);
mac->associnfo.bssvalid = 0; mac->associnfo.bssvalid = 0;
mac->associated = 0; mac->associated = 0;
ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL);
schedule_work(&mac->associnfo.work); schedule_work(&mac->associnfo.work);
spin_unlock_irqrestore(&mac->lock, flags); spin_unlock_irqrestore(&mac->lock, flags);
......
...@@ -67,6 +67,7 @@ static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = { ...@@ -67,6 +67,7 @@ static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = {
"authenticating failed", "authenticating failed",
"authenticating timed out", "authenticating timed out",
"associating failed because no suitable network was found", "associating failed because no suitable network was found",
"disassociated",
}; };
...@@ -128,13 +129,36 @@ void ...@@ -128,13 +129,36 @@ void
ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx)
{ {
struct ieee80211softmac_event *eventptr, *tmp; struct ieee80211softmac_event *eventptr, *tmp;
union iwreq_data wrqu; struct ieee80211softmac_network *network;
char *msg;
if (event >= 0) { if (event >= 0) {
union iwreq_data wrqu;
int we_event;
char *msg = NULL;
switch(event) {
case IEEE80211SOFTMAC_EVENT_ASSOCIATED:
network = (struct ieee80211softmac_network *)event_ctx;
wrqu.data.length = 0;
wrqu.data.flags = 0;
memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
we_event = SIOCGIWAP;
break;
case IEEE80211SOFTMAC_EVENT_DISASSOCIATED:
wrqu.data.length = 0;
wrqu.data.flags = 0;
memset(&wrqu, '\0', sizeof (union iwreq_data));
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
we_event = SIOCGIWAP;
break;
default:
msg = event_descriptions[event]; msg = event_descriptions[event];
wrqu.data.length = strlen(msg); wrqu.data.length = strlen(msg);
wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg); we_event = IWEVCUSTOM;
break;
}
wireless_send_event(mac->dev, we_event, &wrqu, msg);
} }
if (!list_empty(&mac->events)) if (!list_empty(&mac->events))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment