Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Mar 2004 03:37:44 +0100
From:      Dirk-Willem van Gulik <dirkx@asemantics.com>
To:        Suleiman Souhlal <refugee@segfaulted.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: events when (de)associating or when cable is (un)plugged
Message-ID:  <BA068B86-7F97-11D8-8F99-000A95CDA38A@asemantics.com>
In-Reply-To: <37AF87AA-7F87-11D8-8F99-000A95CDA38A@webweaving.org>
References:  <39FE23FA-7F75-11D8-8F99-000A95CDA38A@webweaving.org> <20040326181713.32971952@zZzZ.segfaulted.com> <37AF87AA-7F87-11D8-8F99-000A95CDA38A@webweaving.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Suleiman,

Thanks for all the help  - I just hacked up the patch below and took
http://green.homeunix.org/~green/linkwatcher.c for  testing. I also
had to add the LINKUP/DOWN in some non-mii using ethernet
cards (as only miibus(4) seems to issue this event).

Now experimenting with different types of changes to the 
link/association
on wifi level. Not exactly clear yet on the semantics of a 'lost link' 
myself;
  i.e. loss of assoc with -a- basestation; with the basestationS of a 
given
ssid or simply connection loss; or whenever a handover happens, etc.

Thanks for the help.

Dw.

diff -c -r /usr/src/sys/net80211/ieee80211.c 
/usr/src.new/sys/net80211/ieee80211.c
*** /usr/src/sys/net80211/ieee80211.c   Mon Sep 15 00:32:18 2003
--- /usr/src.new/sys/net80211/ieee80211.c       Wed Mar 17 19:32:48 2004
***************
*** 845,850 ****
--- 845,889 ----
   #undef N
   }

+ /* Event notification channel */
+ int
+ ieee80211_new_state(struct ieee80211com * ic, enum ieee80211_state 
nstate , int arg)
+ {
+         int link = NOTE_LINKINV;
+
+       /* Callback into the real driver */
+       int err =  (ic->ic_newstate)(ic, nstate, arg);
+
+#if IEEE80211_DEBUG
+               printf("Transition to state %x(%d) %s\n",nstate,arg, 
err ? "Failed" : "ok");
+#endif
+
+       switch(nstate) {
+
+       case IEEE80211_S_SCAN:
+               case IEEE80211_S_AUTH:
+               case IEEE80211_S_ASSOC:
+               	link = NOTE_LINKDOWN;
+               	break;
+
+               case IEEE80211_S_RUN:
+               	link = NOTE_LINKUP;
+               	break;
+
+               case IEEE80211_S_INIT:
+       default:
+               	link = NOTE_LINKINV;
+               	break;
+       };
+       /* XXX rely on ordering and do ((struct ifnet *)ic)->if_klist  
cast ??? XX */
+         KNOTE(&(ic->ic_ac.ac_if.if_klist), link);
+
+       return err;
+ }
+
   /*
    * Module glue.
    *
diff -c -r /usr/src/sys/net80211/ieee80211_proto.h 
/usr/src.new/sys/net80211/ieee80211_proto.h
*** /usr/src/sys/net80211/ieee80211_proto.h     Wed Aug 20 00:17:03 2003
--- /usr/src.new/sys/net80211/ieee80211_proto.h Wed Mar 17 17:48:13 2004
***************
*** 67,74 ****
--- 67,78 ----
   extern        struct mbuf *ieee80211_decap(struct ifnet *, struct 
mbuf *);
   extern        u_int8_t *ieee80211_add_rates(u_int8_t *frm,
                 const struct ieee80211_rateset *);
+ extern int ieee80211_new_state(struct ieee80211com *, enum 
ieee80211_state , int);
+ #if 0
   #define       ieee80211_new_state(_ic, _nstate, _arg) \
         (((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
+ #endif
   extern        u_int8_t *ieee80211_add_xrates(u_int8_t *frm,
                 const struct ieee80211_rateset *);
   extern        void ieee80211_print_essid(u_int8_t *, int);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BA068B86-7F97-11D8-8F99-000A95CDA38A>