summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-03-18 19:38:39 +0000
committersam <sam@FreeBSD.org>2009-03-18 19:38:39 +0000
commit2235508d5eead1c1e8c9816bb780ba5a5ba0b588 (patch)
tree5fee62bb4014c155a83331a2e80de03c57497456
parent8bfd160665d6b36b087de434348dc376113ec6a6 (diff)
downloadFreeBSD-src-2235508d5eead1c1e8c9816bb780ba5a5ba0b588.zip
FreeBSD-src-2235508d5eead1c1e8c9816bb780ba5a5ba0b588.tar.gz
rate limit printfs for invalid tdma ie contents; probably want this to
be less than 1/sec
-rw-r--r--sys/net80211/ieee80211_tdma.c15
-rw-r--r--sys/net80211/ieee80211_tdma.h4
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/net80211/ieee80211_tdma.c b/sys/net80211/ieee80211_tdma.c
index 382507e..21d1bbd 100644
--- a/sys/net80211/ieee80211_tdma.c
+++ b/sys/net80211/ieee80211_tdma.c
@@ -387,8 +387,9 @@ tdma_update(struct ieee80211vap *vap, const struct ieee80211_tdma_param *tdma,
update = 0;
if (tdma->tdma_slotcnt != ts->tdma_slotcnt) {
if (!TDMA_SLOTCNT_VALID(tdma->tdma_slotcnt)) {
- printf("%s: bad slot cnt %u\n",
- __func__, tdma->tdma_slotcnt);
+ if (ppsratecheck(&ts->tdma_lastprint, &ts->tdma_fails, 1))
+ printf("%s: bad slot cnt %u\n",
+ __func__, tdma->tdma_slotcnt);
return 0;
}
update |= TDMA_UPDATE_SLOTCNT;
@@ -396,16 +397,18 @@ tdma_update(struct ieee80211vap *vap, const struct ieee80211_tdma_param *tdma,
slotlen = le16toh(tdma->tdma_slotlen) * 100;
if (slotlen != ts->tdma_slotlen) {
if (!TDMA_SLOTLEN_VALID(slotlen)) {
- printf("%s: bad slot len %u\n",
- __func__, slotlen);
+ if (ppsratecheck(&ts->tdma_lastprint, &ts->tdma_fails, 1))
+ printf("%s: bad slot len %u\n",
+ __func__, slotlen);
return 0;
}
update |= TDMA_UPDATE_SLOTLEN;
}
if (tdma->tdma_bintval != ts->tdma_bintval) {
if (!TDMA_BINTVAL_VALID(tdma->tdma_bintval)) {
- printf("%s: bad beacon interval %u\n",
- __func__, tdma->tdma_bintval);
+ if (ppsratecheck(&ts->tdma_lastprint, &ts->tdma_fails, 1))
+ printf("%s: bad beacon interval %u\n",
+ __func__, tdma->tdma_bintval);
return 0;
}
update |= TDMA_UPDATE_BINTVAL;
diff --git a/sys/net80211/ieee80211_tdma.h b/sys/net80211/ieee80211_tdma.h
index d6e45a5..4d07524 100644
--- a/sys/net80211/ieee80211_tdma.h
+++ b/sys/net80211/ieee80211_tdma.h
@@ -38,9 +38,11 @@ struct ieee80211_tdma_state {
uint8_t tdma_bintval; /* beacon interval (slots) */
uint8_t tdma_slot; /* station slot # */
uint8_t tdma_inuse[1]; /* mask of slots in use */
- void *tdma_peer; /* peer station cookie */
uint8_t tdma_active[1]; /* mask of active slots */
int tdma_count; /* active/inuse countdown */
+ void *tdma_peer; /* peer station cookie */
+ struct timeval tdma_lastprint; /* time of last rate-limited printf */
+ int tdma_fails; /* fail count for rate-limiting */
/* parent method pointers */
int (*tdma_newstate)(struct ieee80211vap *, enum ieee80211_state,
OpenPOWER on IntegriCloud