Subject: Re: carrier detect and wi0
To: None <current-users@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: current-users
Date: 06/23/2004 14:20:38
--JbKQpFqZXJ2T76Sg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Jun 23, 2004 at 04:51:59AM -0500, David Young wrote:
> On Thu, Jun 17, 2004 at 10:24:25AM -0400, Steve Bellovin wrote:
> > I was playing with ifwatchd, and I noticed that there are no messages 
> > for RF carrier appearing or going away for wi0.  (I'll check an am0 
> > laptop tonight.)  It strikes me that there should be -- is this 
> > possible?  (This is on 2.0beta)
> 
> Steve,
> 
> This patch gives the indications I expect on atw.  I have not tried it
> with wi, yet.

Turns out that wi needs a different patch.  Stupid thick firmwares. :-)

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933

--JbKQpFqZXJ2T76Sg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=wi-patch

Index: sys/dev/ic/wi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/wi.c,v
retrieving revision 1.161
diff -u -r1.161 wi.c
--- sys/dev/ic/wi.c	6 Jun 2004 05:32:17 -0000	1.161
+++ sys/dev/ic/wi.c	23 Jun 2004 19:17:43 -0000
@@ -92,6 +92,7 @@
 #include <net/if_llc.h>
 #include <net/if_media.h>
 #include <net/if_ether.h>
+#include <net/route.h>
 
 #include <net80211/ieee80211_var.h>
 #include <net80211/ieee80211_compat.h>
@@ -2644,9 +2645,10 @@
 static int
 wi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
 {
+	struct ifnet *ifp = &ic->ic_if;
 	struct wi_softc *sc = ic->ic_softc;
 	struct ieee80211_node *ni = ic->ic_bss;
-	int buflen;
+	int buflen, linkstate = LINK_STATE_DOWN, s;
 	u_int16_t val;
 	struct wi_ssid ssid;
 	struct wi_macaddr bssid, old_bssid;
@@ -2668,6 +2670,7 @@
 		return (*sc->sc_newstate)(ic, nstate, arg);
 
 	case IEEE80211_S_RUN:
+		linkstate = LINK_STATE_UP;
 		sc->sc_flags &= ~WI_FLAGS_OUTRANGE;
 		buflen = IEEE80211_ADDR_LEN;
 		IEEE80211_ADDR_COPY(old_bssid.wi_mac_addr, ni->ni_bssid);
@@ -2716,6 +2719,12 @@
 		break;
 	}
 
+	if (ifp->if_link_state != linkstate) {
+		ifp->if_link_state = linkstate;
+		s = splnet();
+		rt_ifmsg(ifp);
+		splx(s);
+	}
 	ic->ic_state = nstate;
 	/* skip standard ieee80211 handling */
 	return 0;

--JbKQpFqZXJ2T76Sg--