Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net80211 Add a sysctl, net.ieee80211.debug, for turning ...



details:   https://anonhg.NetBSD.org/src/rev/708a65b0454e
branches:  trunk
changeset: 566341:708a65b0454e
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Thu May 06 03:07:10 2004 +0000

description:
Add a sysctl, net.ieee80211.debug, for turning debug messages on
and off.

Add a sysctl, net.ieee80211.maxinact, for adjusting the node time-out
interval.  After net.ieee80211.maxinact seconds of inactivity, an
AP will purge a peer/client-record.  Now the client has to reassociate.

diffstat:

 sys/net80211/ieee80211.c      |  95 ++++++++++++++++++++++++++++++++++++++++++-
 sys/net80211/ieee80211_node.c |   6 +-
 sys/net80211/ieee80211_var.h  |   4 +-
 3 files changed, 99 insertions(+), 6 deletions(-)

diffs (172 lines):

diff -r 92a6b8ed1dbc -r 708a65b0454e sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c  Thu May 06 03:03:20 2004 +0000
+++ b/sys/net80211/ieee80211.c  Thu May 06 03:07:10 2004 +0000
@@ -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 @@
 
 #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 @@
 #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 -r 92a6b8ed1dbc -r 708a65b0454e sys/net80211/ieee80211_node.c
--- a/sys/net80211/ieee80211_node.c     Thu May 06 03:03:20 2004 +0000
+++ b/sys/net80211/ieee80211_node.c     Thu May 06 03:07:10 2004 +0000
@@ -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 @@
                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 -r 92a6b8ed1dbc -r 708a65b0454e sys/net80211/ieee80211_var.h
--- a/sys/net80211/ieee80211_var.h      Thu May 06 03:03:20 2004 +0000
+++ b/sys/net80211/ieee80211_var.h      Thu May 06 03:07:10 2004 +0000
@@ -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 @@
 #define        IEEE80211_DPRINTF2(X)
 #endif
 
+extern int ieee80211_inact_max;
+
 #endif /* _NET80211_IEEE80211_VAR_H_ */



Home | Main Index | Thread Index | Old Index