Completely untested, not entirely sure it compiles.  For whatever
reason, softmac is sending custom events to userspace already, but it
should _really_ be sending the right WEXT events instead.  Comments?  If
this looks good, please apply it.

Signed-off-by: Dan Williams <[EMAIL PROTECTED]>


--- a/include/net/ieee80211softmac.h.assoc      2006-03-09 13:14:56.000000000 
-0500
+++ b/include/net/ieee80211softmac.h    2006-03-09 13:15:22.000000000 -0500
@@ -267,8 +267,9 @@
 #define IEEE80211SOFTMAC_EVENT_AUTH_FAILED             5
 #define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT            6
 #define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7
+#define IEEE80211SOFTMAC_EVENT_DISASSOCIATED           8
 /* 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
  * ieee80211softmac_notify[_atomic] with
--- a/net/ieee80211/softmac/ieee80211softmac_event.c.assoc      2006-03-09 
13:05:09.000000000 -0500
+++ b/net/ieee80211/softmac/ieee80211softmac_event.c    2006-03-09 
15:21:12.000000000 -0500
@@ -67,6 +67,7 @@
        "authenticating failed",
        "authenticating timed out",
        "associating failed because no suitable network was found",
+       "disassociated",
 };
 
 
@@ -128,13 +129,32 @@
 ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int 
event, void *event_ctx)
 {
        struct ieee80211softmac_event *eventptr, *tmp;
-       union iwreq_data wrqu;
-       char *msg;
        
        if (event >= 0) {
-               msg = event_descriptions[event];
-               wrqu.data.length = strlen(msg);
-               wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg);
+               union iwreq_data wrqu;
+               int we_event;
+               char *msg = NULL;
+
+               if (event == IEEE80211SOFTMAC_EVENT_ASSOCIATED) {
+                       struct ieee80211softmac_network *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;
+               } else if (event == 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;
+               } else {
+                       msg = event_descriptions[event];
+                       wrqu.data.length = strlen(msg);
+                       we_event = IWEVCUSTOM;
+               }
+               wireless_send_event(mac->dev, we_event, &wrqu, msg);
        }
 
        if (!list_empty(&mac->events))
--- a/net/ieee80211/softmac/ieee80211softmac_assoc.c.assoc      2006-03-09 
13:13:54.000000000 -0500
+++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c    2006-03-09 
13:21:00.000000000 -0500
@@ -104,6 +104,7 @@
        /* Do NOT clear bssvalid as that will break 
ieee80211softmac_assoc_work! */
        mac->associated = 0;
        mac->associnfo.associating = 0;
+       ieee80211softmac_call_events_locked(mac, 
IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL);
        spin_unlock_irqrestore(&mac->lock, flags);
 }
 
@@ -378,6 +379,7 @@
        spin_lock_irqsave(&mac->lock, flags);
        mac->associnfo.bssvalid = 0;
        mac->associated = 0;
+       ieee80211softmac_call_events_locked(mac, 
IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL);
        schedule_work(&mac->associnfo.work);
        spin_unlock_irqrestore(&mac->lock, flags);
        


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to