Subject: Re: carrier detect and wi0
To: Steve Bellovin <smb@research.att.com>
From: David Young <dyoung@pobox.com>
List: current-users
Date: 06/23/2004 04:51:59
--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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.

Dave

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

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=proto-diff

Index: sys/net80211/ieee80211_proto.c
===================================================================
RCS file: /cvsroot/src/sys/net80211/ieee80211_proto.c,v
retrieving revision 1.8
diff -u -r1.8 ieee80211_proto.c
--- sys/net80211/ieee80211_proto.c	30 Apr 2004 23:58:20 -0000	1.8
+++ sys/net80211/ieee80211_proto.c	23 Jun 2004 09:44:14 -0000
@@ -88,6 +88,8 @@
 #endif
 #endif
 
+#include <net/route.h>
+
 #define	IEEE80211_RATE2MBS(r)	(((r) & IEEE80211_RATE_VAL) / 2)
 
 const char *ieee80211_mgt_subtype_name[] = {
@@ -338,6 +340,7 @@
 	struct ieee80211_node *ni;
 	enum ieee80211_state ostate;
 	ieee80211_node_critsec_decl(s);
+	int linkstate = LINK_STATE_DOWN;
 
 	ostate = ic->ic_state;
 	IEEE80211_DPRINTF(("%s: %s -> %s\n", __func__,
@@ -517,6 +520,7 @@
 		}
 		break;
 	case IEEE80211_S_RUN:
+		linkstate = LINK_STATE_UP;
 		switch (ostate) {
 		case IEEE80211_S_INIT:
 		case IEEE80211_S_AUTH:
@@ -549,5 +553,11 @@
 		}
 		break;
 	}
+	if (linkstate != ifp->if_link_state) {
+		ifp->if_link_state = linkstate;
+		s = splnet();
+		rt_ifmsg(ifp);
+		splx(s);
+	}
 	return 0;
 }

--CE+1k2dSO48ffgeK--