Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2008 19:40:47 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135741 for review
Message-ID:  <200802191940.m1JJelLi007331@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135741

Change 135741 by sam@sam_ebb on 2008/02/19 19:39:52

	(slightly) improve media status for 802.11 interfaces; really need
	to get the state to do this right but that belongs in the 802.11
	code and not in if_media handling

Affected files ...

.. //depot/projects/vap/sbin/ifconfig/ifmedia.c#5 edit

Differences ...

==== //depot/projects/vap/sbin/ifconfig/ifmedia.c#5 (text+ko) ====

@@ -102,6 +102,11 @@
 static struct ifmedia_description *get_subtype_desc(int,
     struct ifmedia_type_to_subtype *ttos);
 
+#define	IFM_OPMODE(x) \
+	((x) & (IFM_IEEE80211_ADHOC | IFM_IEEE80211_HOSTAP | \
+	 IFM_IEEE80211_IBSS | IFM_IEEE80211_WDS | IFM_IEEE80211_MONITOR))
+#define	IFM_IEEE80211_STA	0
+
 static void
 media_status(int s)
 {
@@ -162,10 +167,13 @@
 			break;
 
 		case IFM_IEEE80211:
-			/* XXX: Different value for adhoc? */
-			if (ifmr.ifm_status & IFM_ACTIVE)
-				printf("associated");
-			else
+			if (ifmr.ifm_status & IFM_ACTIVE) {
+				/* NB: only sta mode associates */
+				if (IFM_OPMODE(ifmr.ifm_active) == IFM_IEEE80211_STA)
+					printf("associated");
+				else
+					printf("running");
+			} else
 				printf("no carrier");
 			break;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802191940.m1JJelLi007331>