From 8bfd160665d6b36b087de434348dc376113ec6a6 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 18 Mar 2009 19:28:17 +0000 Subject: Minor cleanups of tdma protocol handling: o break out version-related code to simplify rev'ing the protocol o add parameter validation macros so checks that appear multiple places are consistent (and easy to change) o add protocol version check when looking for a scan candidate o improve scan debug output format o rewrite beacon update handling to calculate a bitmask of changed values and pass that down through the driver callback so drivers can optimize work o do slot bounds check before use when parsing received beacons --- sys/net80211/ieee80211_scan_sta.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'sys/net80211/ieee80211_scan_sta.c') diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c index bc99817..607c36d 100644 --- a/sys/net80211/ieee80211_scan_sta.c +++ b/sys/net80211/ieee80211_scan_sta.c @@ -126,6 +126,7 @@ static void sta_flush_table(struct sta_table *); #define MATCH_TDMA_NOTMASTER 0x0800 /* not TDMA master */ #define MATCH_TDMA_NOSLOT 0x1000 /* all TDMA slots occupied */ #define MATCH_TDMA_LOCAL 0x2000 /* local address */ +#define MATCH_TDMA_VERSION 0x4000 /* protocol version mismatch */ static int match_bss(struct ieee80211vap *, const struct ieee80211_scan_state *, struct sta_entry *, int); static void adhoc_age(struct ieee80211_scan_state *); @@ -970,9 +971,12 @@ match_bss(struct ieee80211vap *vap, if (vap->iv_caps & IEEE80211_C_TDMA) { const struct ieee80211_tdma_param *tdma = (const struct ieee80211_tdma_param *)se->se_ies.tdma_ie; + const struct ieee80211_tdma_state *ts = vap->iv_tdma; if (tdma == NULL) fail |= MATCH_TDMA_NOIE; + else if (tdma->tdma_version != ts->tdma_version) + fail |= MATCH_TDMA_VERSION; else if (tdma->tdma_slot != 0) fail |= MATCH_TDMA_NOTMASTER; else if (tdma_isfull(tdma)) @@ -1062,9 +1066,10 @@ match_bss(struct ieee80211vap *vap, fail & MATCH_CC ? '$' : #ifdef IEEE80211_SUPPORT_TDMA fail & MATCH_TDMA_NOIE ? '&' : - fail & MATCH_TDMA_NOTMASTER ? ':' : - fail & MATCH_TDMA_NOSLOT ? '@' : - fail & MATCH_TDMA_LOCAL ? '#' : + fail & MATCH_TDMA_VERSION ? 'v' : + fail & MATCH_TDMA_NOTMASTER ? 's' : + fail & MATCH_TDMA_NOSLOT ? 'f' : + fail & MATCH_TDMA_LOCAL ? 'l' : #endif fail ? '-' : '+', ether_sprintf(se->se_macaddr)); printf(" %s%c", ether_sprintf(se->se_bssid), @@ -1076,8 +1081,7 @@ match_bss(struct ieee80211vap *vap, fail & MATCH_RATE ? '!' : ' '); printf(" %4s%c", (se->se_capinfo & IEEE80211_CAPINFO_ESS) ? "ess" : - (se->se_capinfo & IEEE80211_CAPINFO_IBSS) ? "ibss" : - "????", + (se->se_capinfo & IEEE80211_CAPINFO_IBSS) ? "ibss" : "", fail & MATCH_CAPINFO ? '!' : ' '); printf(" %3s%c ", (se->se_capinfo & IEEE80211_CAPINFO_PRIVACY) ? -- cgit v1.1