diff options
| author | Johannes Berg <johannes@sipsolutions.net> | 2006-04-12 20:42:42 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2006-04-19 17:25:39 -0400 |
| commit | feeeaa87e8e6702f57ed3be7904ffd87cc044b82 (patch) | |
| tree | 658f8410a8a1777aecbf3bef8e3e8f7a7f677e69 | |
| parent | 68970ce6ac5ed01b1d10047fd4daba5b40786694 (diff) | |
[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: Dan Williams <dcbw@redhat.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | include/net/ieee80211softmac.h | 3 | ||||
| -rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_assoc.c | 2 | ||||
| -rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_event.c | 34 |
3 files changed, 33 insertions, 6 deletions
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index b971d8c82bdd..6b3693f05ca0 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
| @@ -267,8 +267,9 @@ extern void ieee80211softmac_stop(struct net_device *dev); | |||
| 267 | #define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5 | 267 | #define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5 |
| 268 | #define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6 | 268 | #define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6 |
| 269 | #define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7 | 269 | #define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7 |
| 270 | #define IEEE80211SOFTMAC_EVENT_DISASSOCIATED 8 | ||
| 270 | /* keep this updated! */ | 271 | /* keep this updated! */ |
| 271 | #define IEEE80211SOFTMAC_EVENT_LAST 7 | 272 | #define IEEE80211SOFTMAC_EVENT_LAST 8 |
| 272 | /* | 273 | /* |
| 273 | * If you want to be notified of certain events, you can call | 274 | * If you want to be notified of certain events, you can call |
| 274 | * ieee80211softmac_notify[_atomic] with | 275 | * ieee80211softmac_notify[_atomic] with |
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index cb9fca86c26b..4498023841dc 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c | |||
| @@ -101,6 +101,7 @@ ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason) | |||
| 101 | /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ | 101 | /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ |
| 102 | mac->associated = 0; | 102 | mac->associated = 0; |
| 103 | mac->associnfo.associating = 0; | 103 | mac->associnfo.associating = 0; |
| 104 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); | ||
| 104 | spin_unlock_irqrestore(&mac->lock, flags); | 105 | spin_unlock_irqrestore(&mac->lock, flags); |
| 105 | } | 106 | } |
| 106 | 107 | ||
| @@ -373,6 +374,7 @@ ieee80211softmac_handle_disassoc(struct net_device * dev, | |||
| 373 | spin_lock_irqsave(&mac->lock, flags); | 374 | spin_lock_irqsave(&mac->lock, flags); |
| 374 | mac->associnfo.bssvalid = 0; | 375 | mac->associnfo.bssvalid = 0; |
| 375 | mac->associated = 0; | 376 | mac->associated = 0; |
| 377 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); | ||
| 376 | schedule_work(&mac->associnfo.work); | 378 | schedule_work(&mac->associnfo.work); |
| 377 | spin_unlock_irqrestore(&mac->lock, flags); | 379 | spin_unlock_irqrestore(&mac->lock, flags); |
| 378 | 380 | ||
diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c index 0a52bbda1e4c..5bdd5edd432c 100644 --- a/net/ieee80211/softmac/ieee80211softmac_event.c +++ b/net/ieee80211/softmac/ieee80211softmac_event.c | |||
| @@ -67,6 +67,7 @@ static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = { | |||
| 67 | "authenticating failed", | 67 | "authenticating failed", |
| 68 | "authenticating timed out", | 68 | "authenticating timed out", |
| 69 | "associating failed because no suitable network was found", | 69 | "associating failed because no suitable network was found", |
| 70 | "disassociated", | ||
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| 72 | 73 | ||
| @@ -128,13 +129,36 @@ void | |||
| 128 | ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) | 129 | ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) |
| 129 | { | 130 | { |
| 130 | struct ieee80211softmac_event *eventptr, *tmp; | 131 | struct ieee80211softmac_event *eventptr, *tmp; |
| 131 | union iwreq_data wrqu; | 132 | struct ieee80211softmac_network *network; |
| 132 | char *msg; | ||
| 133 | 133 | ||
| 134 | if (event >= 0) { | 134 | if (event >= 0) { |
| 135 | msg = event_descriptions[event]; | 135 | union iwreq_data wrqu; |
| 136 | wrqu.data.length = strlen(msg); | 136 | int we_event; |
| 137 | wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg); | 137 | char *msg = NULL; |
| 138 | |||
| 139 | switch(event) { | ||
| 140 | case IEEE80211SOFTMAC_EVENT_ASSOCIATED: | ||
| 141 | network = (struct ieee80211softmac_network *)event_ctx; | ||
| 142 | wrqu.data.length = 0; | ||
| 143 | wrqu.data.flags = 0; | ||
| 144 | memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN); | ||
| 145 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | ||
| 146 | we_event = SIOCGIWAP; | ||
| 147 | break; | ||
| 148 | case IEEE80211SOFTMAC_EVENT_DISASSOCIATED: | ||
| 149 | wrqu.data.length = 0; | ||
| 150 | wrqu.data.flags = 0; | ||
| 151 | memset(&wrqu, '\0', sizeof (union iwreq_data)); | ||
| 152 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | ||
| 153 | we_event = SIOCGIWAP; | ||
| 154 | break; | ||
| 155 | default: | ||
| 156 | msg = event_descriptions[event]; | ||
| 157 | wrqu.data.length = strlen(msg); | ||
| 158 | we_event = IWEVCUSTOM; | ||
| 159 | break; | ||
| 160 | } | ||
| 161 | wireless_send_event(mac->dev, we_event, &wrqu, msg); | ||
| 138 | } | 162 | } |
| 139 | 163 | ||
| 140 | if (!list_empty(&mac->events)) | 164 | if (!list_empty(&mac->events)) |
