PERFORCE change 135741 for review
Sam Leffler
sam at FreeBSD.org
Tue Feb 19 19:40:48 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=135741
Change 135741 by sam at 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;
}
More information about the p4-projects
mailing list