summaryrefslogtreecommitdiff
path: root/sys/net80211
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2016-09-20 13:24:43 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2016-09-20 13:24:43 +0000
commit1befece75723eec00921d8e37c6cbd617b1d1729 (patch)
tree993dae434c99f0e3d4f2606bb75201e0e1efc456 /sys/net80211
parent8b8539842add62d551b7851d7a2447d2304c12f5 (diff)
Parse the DTIM count and period advertised in beacons and store them
in the node structure. This should be useful for iwm(4) in the future. ok phessler@
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211_input.c14
-rw-r--r--sys/net80211/ieee80211_node.h5
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 7209e3192a4..66c03fade59 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_input.c,v 1.178 2016/05/18 08:15:28 stsp Exp $ */
+/* $OpenBSD: ieee80211_input.c,v 1.179 2016/09/20 13:24:42 stsp Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
@@ -1393,7 +1393,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
const u_int8_t *tstamp, *ssid, *rates, *xrates, *edcaie, *wmmie;
const u_int8_t *rsnie, *wpaie, *htcaps, *htop;
u_int16_t capinfo, bintval;
- u_int8_t chan, bchan, erp;
+ u_int8_t chan, bchan, erp, dtim_count, dtim_period;
int is_new;
/*
@@ -1436,6 +1436,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
bchan = ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan);
chan = bchan;
erp = 0;
+ dtim_count = dtim_period = 0;
while (frm + 2 <= efrm) {
if (frm + 2 + frm[1] > efrm) {
ic->ic_stats.is_rx_elem_toosmall++;
@@ -1477,6 +1478,12 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
case IEEE80211_ELEMID_HTOP:
htop = frm;
break;
+ case IEEE80211_ELEMID_TIM:
+ if (frm[1] > 3) {
+ dtim_count = frm[2];
+ dtim_period = frm[3];
+ }
+ break;
case IEEE80211_ELEMID_VENDOR:
if (frm[1] < 4) {
ic->ic_stats.is_rx_elem_toosmall++;
@@ -1568,6 +1575,9 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
if (htop && !ieee80211_setup_htop(ni, htop + 2, htop[1]))
htop = NULL; /* invalid HTOP */
+ ni->ni_dtimcount = dtim_count;
+ ni->ni_dtimperiod = dtim_period;
+
/*
* When operating in station mode, check for state updates
* while we're associated.
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
index 4c47ceaab02..50acc7b5cc7 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.h,v 1.61 2016/09/15 03:32:48 dlg Exp $ */
+/* $OpenBSD: ieee80211_node.h,v 1.62 2016/09/20 13:24:42 stsp Exp $ */
/* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */
/*-
@@ -188,9 +188,10 @@ struct ieee80211_node {
struct ieee80211_channel *ni_chan;
u_int8_t ni_erp; /* 11g only */
-#ifdef notyet
/* DTIM and contention free period (CFP) */
+ u_int8_t ni_dtimcount;
u_int8_t ni_dtimperiod;
+#ifdef notyet
u_int8_t ni_cfpperiod; /* # of DTIMs between CFPs */
u_int16_t ni_cfpduremain; /* remaining cfp duration */
u_int16_t ni_cfpmaxduration;/* max CFP duration in TU */