summaryrefslogtreecommitdiffstats
path: root/sys/net80211
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2007-09-06 00:04:36 +0000
committersam <sam@FreeBSD.org>2007-09-06 00:04:36 +0000
commit6c621557d175381b693d30c4cc4f4c96e7e00e19 (patch)
tree6acbd5214085f8032da2d83ace6a3bfb629b89d9 /sys/net80211
parentaa00045c5dab16380783e06c0a19da83fdee1d08 (diff)
downloadFreeBSD-src-6c621557d175381b693d30c4cc4f4c96e7e00e19.zip
FreeBSD-src-6c621557d175381b693d30c4cc4f4c96e7e00e19.tar.gz
Fixup sta inactivity handling:
o reset ni_inact when ni_inact_reload is changed so we're assured a valid setting o never let ni_inact go negative o add a knob to disable hostap sta idle handling (e.g. so it can be done by a user application) o remove bogus reload on associate Reviewed by: avatar Approved by: re (blanket wireless)
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211_ioctl.c9
-rw-r--r--sys/net80211/ieee80211_ioctl.h1
-rw-r--r--sys/net80211/ieee80211_node.c19
-rw-r--r--sys/net80211/ieee80211_var.h1
4 files changed, 24 insertions, 6 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 5929edd..3fe85e9 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1105,6 +1105,9 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
case IEEE80211_IOC_HTCOMPAT:
ireq->i_val = (ic->ic_flags_ext & IEEE80211_FEXT_HTCOMPAT) != 0;
break;
+ case IEEE80211_IOC_INACTIVITY:
+ ireq->i_val = (ic->ic_flags_ext & IEEE80211_FEXT_INACT) != 0;
+ break;
default:
error = EINVAL;
break;
@@ -2470,6 +2473,12 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
IEEE80211_IS_CHAN_HT(ic->ic_bsschan))
error = ENETRESET;
break;
+ case IEEE80211_IOC_INACTIVITY:
+ if (ireq->i_val)
+ ic->ic_flags_ext |= IEEE80211_FEXT_INACT;
+ else
+ ic->ic_flags_ext &= ~IEEE80211_FEXT_INACT;
+ break;
default:
error = EINVAL;
break;
diff --git a/sys/net80211/ieee80211_ioctl.h b/sys/net80211/ieee80211_ioctl.h
index 2e17000..3221539 100644
--- a/sys/net80211/ieee80211_ioctl.h
+++ b/sys/net80211/ieee80211_ioctl.h
@@ -491,6 +491,7 @@ struct ieee80211req {
#define IEEE80211_IOC_COUNTRYCODE 90 /* ISO country code */
#define IEEE80211_IOC_LOCATION 91 /* indoor/outdoor/anywhere */
#define IEEE80211_IOC_HTCOMPAT 92 /* support pre-D1.10 HT ie's */
+#define IEEE80211_IOC_INACTIVITY 94 /* sta inactivity handling */
/*
* Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 690e54b..3c151ea 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -99,6 +99,8 @@ ieee80211_node_attach(struct ieee80211com *ic)
/* NB: driver should override */
ic->ic_max_aid = IEEE80211_AID_DEF;
+
+ ic->ic_flags_ext |= IEEE80211_FEXT_INACT; /* inactivity processing */
}
void
@@ -186,12 +188,16 @@ ieee80211_node_authorize(struct ieee80211_node *ni)
ni->ni_flags |= IEEE80211_NODE_AUTH;
ni->ni_inact_reload = ic->ic_inact_run;
+ ni->ni_inact = ni->ni_inact_reload;
}
void
ieee80211_node_unauthorize(struct ieee80211_node *ni)
{
ni->ni_flags &= ~IEEE80211_NODE_AUTH;
+ ni->ni_inact_reload = ic->ic_inact_auth;
+ if (ni->ni_inact > ni->ni_inact_reload)
+ ni->ni_inact = ni->ni_inact_reload;
}
/*
@@ -1468,13 +1474,14 @@ restart:
m_freem(ni->ni_rxfrag[0]);
ni->ni_rxfrag[0] = NULL;
}
+ if (ni->ni_inact > 0)
+ ni->ni_inact--;
/*
* Special case ourself; we may be idle for extended periods
* of time and regardless reclaiming our state is wrong.
*/
if (ni == ic->ic_bss)
continue;
- ni->ni_inact--;
if (ni->ni_associd != 0 || isadhoc) {
/*
* Age frames on the power save queue.
@@ -1495,8 +1502,9 @@ restart:
* of); this will get fixed more properly
* soon with better handling of the rate set.
*/
- if (0 < ni->ni_inact &&
- ni->ni_inact <= ic->ic_inact_probe &&
+ if ((ic->ic_flags_ext & IEEE80211_FEXT_INACT) &&
+ (0 < ni->ni_inact &&
+ ni->ni_inact <= ic->ic_inact_probe) &&
ni->ni_rates.rs_nrates != 0) {
IEEE80211_NOTE(ic,
IEEE80211_MSG_INACT | IEEE80211_MSG_NODE,
@@ -1516,7 +1524,8 @@ restart:
goto restart;
}
}
- if (ni->ni_inact <= 0) {
+ if ((ic->ic_flags_ext & IEEE80211_FEXT_INACT) &&
+ ni->ni_inact <= 0) {
IEEE80211_NOTE(ic,
IEEE80211_MSG_INACT | IEEE80211_MSG_NODE, ni,
"station timed out due to inactivity "
@@ -1742,8 +1751,6 @@ ieee80211_node_join(struct ieee80211com *ic, struct ieee80211_node *ni, int resp
/* give driver a chance to setup state like ni_txrate */
if (ic->ic_newassoc != NULL)
ic->ic_newassoc(ni, newassoc);
- ni->ni_inact_reload = ic->ic_inact_auth;
- ni->ni_inact = ni->ni_inact_reload;
IEEE80211_SEND_MGMT(ic, ni, resp, IEEE80211_STATUS_SUCCESS);
/* tell the authenticator about new station */
if (ic->ic_auth->ia_node_join != NULL)
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index 0b1e70c..d4d3897 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -333,6 +333,7 @@ struct ieee80211com {
/* ic_flags_ext */
#define IEEE80211_FEXT_WDS 0x00000001 /* CONF: 4 addr allowed */
+#define IEEE80211_FEXT_INACT 0x00000002 /* CONF: sta inact handling */
/* 0x00000006 reserved */
#define IEEE80211_FEXT_BGSCAN 0x00000008 /* STATUS: complete bgscan */
#define IEEE80211_FEXT_ERPUPDATE 0x00000200 /* STATUS: update ERP element */
OpenPOWER on IntegriCloud