diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 08e666b93527..5db7e7e59753 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.c,v 1.10 2004/04/30 23:58:05 dyoung Exp $ */ +/* $NetBSD: ieee80211.c,v 1.11 2004/05/06 03:07:10 dyoung Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting @@ -35,7 +35,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.11 2004/04/02 20:19:20 sam Exp $"); #else -__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.10 2004/04/30 23:58:05 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.11 2004/05/06 03:07:10 dyoung Exp $"); #endif /* @@ -91,12 +91,19 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.10 2004/04/30 23:58:05 dyoung Exp $" #ifdef IEEE80211_DEBUG int ieee80211_debug = 0; +#ifdef __NetBSD__ +static int ieee80211_debug_nodenum; +#endif /* __NetBSD__ */ + #ifdef __FreeBSD__ SYSCTL_INT(_debug, OID_AUTO, ieee80211, CTLFLAG_RW, &ieee80211_debug, 0, "IEEE 802.11 media debugging printfs"); #endif #endif +int ieee80211_inact_max = IEEE80211_INACT_MAX; +static int ieee80211_inact_max_nodenum; + static void ieee80211_set11gbasicrates(struct ieee80211_rateset *, enum ieee80211_phymode); @@ -907,6 +914,90 @@ ieee80211_media2rate(int mword) #undef N } +#ifdef __NetBSD__ +/* TBD factor with sysctl_ath_verify. */ +static int +sysctl_ieee80211_verify(SYSCTLFN_ARGS) +{ + int error, t; + struct sysctlnode node; + + node = *rnode; + t = *(int*)rnode->sysctl_data; + node.sysctl_data = &t; + error = sysctl_lookup(SYSCTLFN_CALL(&node)); + if (error || newp == NULL) + return (error); + + IEEE80211_DPRINTF(("%s: t = %d, nodenum = %d, rnodenum = %d\n", + __func__, t, node.sysctl_num, rnode->sysctl_num)); + + if (node.sysctl_num == ieee80211_inact_max_nodenum) { + if (t < 0) + return (EINVAL); +#ifdef IEEE80211_DEBUG + } else if (node.sysctl_num == ieee80211_debug_nodenum) { + if (t < 0 || t > 2) + return (EINVAL); +#endif /* IEEE80211_DEBUG */ + } else + return (EINVAL); + + *(int*)rnode->sysctl_data = t; + + return (0); +} + +/* + * Setup sysctl(3) MIB, net.ieee80211.* + * + * TBD condition CTLFLAG_PERMANENT on being an LKM or not + */ +SYSCTL_SETUP(sysctl_ieee80211, "sysctl ieee80211 subtree setup") +{ + int rc, ieee80211_node_num; + struct sysctlnode *node; + + if ((rc = sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT, CTLTYPE_NODE, "net", NULL, + NULL, 0, NULL, 0, CTL_NET, CTL_EOL)) != 0) + goto err; + + if ((rc = sysctl_createv(clog, 0, NULL, &node, + CTLFLAG_PERMANENT, CTLTYPE_NODE, "ieee80211", NULL, + NULL, 0, NULL, 0, CTL_NET, CTL_CREATE, CTL_EOL)) != 0) + goto err; + + ieee80211_node_num = node->sysctl_num; + +#ifdef IEEE80211_DEBUG + + /* control debugging printfs */ + if ((rc = sysctl_createv(clog, 0, NULL, &node, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, + "debug", NULL, sysctl_ieee80211_verify, 0, &ieee80211_debug, 0, + CTL_NET, ieee80211_node_num, CTL_CREATE, CTL_EOL)) != 0) + goto err; + + ieee80211_debug_nodenum = node->sysctl_num; + +#endif /* IEEE80211_DEBUG */ + + /* control inactivity timer */ + if ((rc = sysctl_createv(clog, 0, NULL, &node, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, + "maxinact", NULL, sysctl_ieee80211_verify, 0, &ieee80211_inact_max, + 0, CTL_NET, ieee80211_node_num, CTL_CREATE, CTL_EOL)) != 0) + goto err; + + ieee80211_inact_max_nodenum = node->sysctl_num; + + return; +err: + printf("%s: sysctl_createv failed (rc = %d)\n", __func__, rc); +} +#endif /* __NetBSD__ */ + #ifdef __FreeBSD__ /* * Module glue. diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 50e498fd6960..1a92d57afe92 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.c,v 1.12 2004/05/01 01:49:03 dyoung Exp $ */ +/* $NetBSD: ieee80211_node.c,v 1.13 2004/05/06 03:07:10 dyoung Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting @@ -35,7 +35,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.22 2004/04/05 04:15:55 sam Exp $"); #else -__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.12 2004/05/01 01:49:03 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.13 2004/05/06 03:07:10 dyoung Exp $"); #endif #include "opt_inet.h" @@ -813,7 +813,7 @@ restart: if (ni->ni_scangen == gen) /* previously handled */ continue; ni->ni_scangen = gen; - if (++ni->ni_inact > IEEE80211_INACT_MAX) { + if (++ni->ni_inact > ieee80211_inact_max) { IEEE80211_DPRINTF(("station %s timed out " "due to inactivity (%u secs)\n", ether_sprintf(ni->ni_macaddr), diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 4412f597f571..90d793697a11 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_var.h,v 1.6 2004/04/30 23:51:50 dyoung Exp $ */ +/* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting @@ -313,4 +313,6 @@ extern int ieee80211_debug; #define IEEE80211_DPRINTF2(X) #endif +extern int ieee80211_inact_max; + #endif /* _NET80211_IEEE80211_VAR_H_ */