summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_node.c
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2008-04-21 19:37:19 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2008-04-21 19:37:19 +0000
commit0f4e544d0e77a9b0eda38174c19f833aada81ab1 (patch)
tree0f4f71d1b56ef93db1083a7e98f9c75c4e9c7f29 /sys/net80211/ieee80211_node.c
parent06e76e129ee17747a1caac19c5a96e8ecff75b5c (diff)
move ieee80211_auth_open() to ieee80211_proto.c
move ieee80211_setup_rates() to ieee80211_node.c move some prototypes from ieee80211_proto.h to ieee80211_crypto.h
Diffstat (limited to 'sys/net80211/ieee80211_node.c')
-rw-r--r--sys/net80211/ieee80211_node.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 53f4fe4af29..c7d0889a9cb 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.c,v 1.31 2008/04/16 18:32:15 damien Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.32 2008/04/21 19:37:18 damien Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
@@ -1013,6 +1013,37 @@ ieee80211_iterate_nodes(struct ieee80211com *ic, ieee80211_iter_func *f,
}
/*
+ * Install received rate set information in the node's state block.
+ */
+int
+ieee80211_setup_rates(struct ieee80211com *ic, struct ieee80211_node *ni,
+ const u_int8_t *rates, const u_int8_t *xrates, int flags)
+{
+ struct ieee80211_rateset *rs = &ni->ni_rates;
+
+ memset(rs, 0, sizeof(*rs));
+ rs->rs_nrates = rates[1];
+ memcpy(rs->rs_rates, rates + 2, rs->rs_nrates);
+ if (xrates != NULL) {
+ u_int8_t nxrates;
+ /*
+ * Tack on 11g extended supported rate element.
+ */
+ nxrates = xrates[1];
+ if (rs->rs_nrates + nxrates > IEEE80211_RATE_MAXSIZE) {
+ nxrates = IEEE80211_RATE_MAXSIZE - rs->rs_nrates;
+ IEEE80211_DPRINTF(("%s: extended rate set too large;"
+ " only using %u of %u rates\n",
+ __func__, nxrates, xrates[1]));
+ ic->ic_stats.is_rx_rstoobig++;
+ }
+ memcpy(rs->rs_rates + rs->rs_nrates, xrates+2, nxrates);
+ rs->rs_nrates += nxrates;
+ }
+ return ieee80211_fix_rate(ic, ni, flags);
+}
+
+/*
* Check if the specified node supports ERP.
*/
int