PERFORCE change 87301 for review
Sam Leffler
sam at FreeBSD.org
Sun Nov 27 03:22:30 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=87301
Change 87301 by sam at sam_ebb on 2005/11/27 03:22:07
o fix preference for privacy
o fix bssid/ssid match debug msg; mark match with '*'
Affected files ...
.. //depot/projects/wifi/sys/net80211/ieee80211_scan_sta.c#6 edit
Differences ...
==== //depot/projects/wifi/sys/net80211/ieee80211_scan_sta.c#6 (text+ko) ====
@@ -605,19 +605,21 @@
static int
sta_compare(const struct sta_entry *a, const struct sta_entry *b)
{
+#define PREFER(_a,_b,_what) do { \
+ if (((_a) ^ (_b)) & (_what)) \
+ return ((_a) & (_what)) ? 1 : -1; \
+} while (0)
u_int8_t maxa, maxb;
int8_t rssia, rssib;
int weight;
/* desired bssid */
- if ((a->se_flags ^ b->se_flags) & STA_BSSID_MATCH)
- return (a->se_flags & STA_BSSID_MATCH) ? 1 : -1;
+ PREFER(a->se_flags, b->se_flags, STA_BSSID_MATCH);
/* desired ssid */
- if ((a->se_flags ^ b->se_flags) & STA_SSID_MATCH)
- return (a->se_flags & STA_SSID_MATCH) ? 1 : -1;
+ PREFER(a->se_flags, b->se_flags, STA_SSID_MATCH);
/* privacy support */
- if ((a->base.se_capinfo ^ b->base.se_capinfo) & IEEE80211_CAPINFO_PRIVACY)
- return (a->se_flags & IEEE80211_CAPINFO_PRIVACY) ? 1 : -1;
+ PREFER(a->base.se_capinfo, b->base.se_capinfo,
+ IEEE80211_CAPINFO_PRIVACY);
/* compare count of previous failures */
weight = b->se_fails - a->se_fails;
@@ -630,7 +632,7 @@
* comparisons to avoid selecting an ap purely by rssi
* when both values may be good but one ap is otherwise
* more desirable (e.g. an 11b-only ap with stronger
- * rssi than an 11g ap).
+ * signal than an 11g ap).
*/
rssia = MIN(a->base.se_rssi, STA_RSSI_MAX);
rssib = MIN(b->base.se_rssi, STA_RSSI_MAX);
@@ -651,6 +653,7 @@
}
/* all things being equal, use signal level */
return a->base.se_rssi - b->base.se_rssi;
+#undef PREFER
}
/*
@@ -788,7 +791,7 @@
fail & 0x40 ? '=' : fail & 0x80 ? '^' : fail ? '-' : '+',
ether_sprintf(se->se_macaddr));
printf(" %s%c", ether_sprintf(se->se_bssid),
- se0->se_flags & STA_BSSID_MATCH ? '!' : ' ');
+ se0->se_flags & STA_BSSID_MATCH ? '*' : ' ');
printf(" %3d%c", ieee80211_chan2ieee(ic, se->se_chan),
fail & 0x01 ? '!' : ' ');
printf(" %+4d%c", se->se_rssi, fail & 0x100 ? '!' : ' ');
@@ -804,7 +807,7 @@
"wep" : "no",
fail & 0x04 ? '!' : ' ');
ieee80211_print_essid(se->se_ssid+2, se->se_ssid[1]);
- printf("%s\n", se0->se_flags & STA_SSID_MATCH ? "!" : "");
+ printf("%s\n", se0->se_flags & STA_SSID_MATCH ? "*" : "");
}
#endif
return fail;
More information about the p4-projects
mailing list