summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2013-06-08 14:24:40 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2013-06-08 14:24:40 +0000
commit145d20d3089f385b19118cccc36b5bd809d49094 (patch)
tree5417c0c18137fff62a645044bbf333fa29b37d6b
parentb5eb995ea27dc816484505244c7aef178f6ac040 (diff)
Add new sysctl for pipex packet input/output queue length and
counters. ok guenther, feedback jmc
-rw-r--r--lib/libc/gen/sysctl.329
-rw-r--r--sbin/sysctl/sysctl.810
-rw-r--r--sbin/sysctl/sysctl.c17
-rw-r--r--sys/net/pipex.c14
-rw-r--r--sys/net/pipex.h14
5 files changed, 66 insertions, 18 deletions
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index f658c7f78ad..acb4c9654ee 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.3,v 1.221 2013/06/05 03:39:22 tedu Exp $
+.\" $OpenBSD: sysctl.3,v 1.222 2013/06/08 14:24:39 yasuoka Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 5 2013 $
+.Dd $Mdocdate: June 8 2013 $
.Dt SYSCTL 3
.Os
.Sh NAME
@@ -1974,11 +1974,34 @@ The currently defined variable names are:
.Bl -column "Third level name" "integer" "Changeable" -offset indent
.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
.It Dv PIPEXCTL_ENABLE Ta integer Ta yes
+.It Dv PIPEXCTL_INQ Ta node Ta not applicable
+.It Dv PIPEXCTL_OUTQ Ta node Ta not applicable
.El
.Bl -tag -width "123456"
.It Dv PIPEXCTL_ENABLE
If set to 1, enable PIPEX processing.
The default is 0.
+.It Dv PIPEXCTL_INQ
+Fourth level comprises an array of
+.Li struct ifqueue
+structures containing information about the PIPEX packet input queue.
+The forth level names for the elements of
+.Li struct ifqueue
+are the same as described in
+.Li ip.ifq
+in the
+.Dv PF_INET
+section.
+.It Dv PIPEXCTL_OUTQ
+Fourth level comprises an array of
+.Li struct ifqueue
+structures containing information about PIPEX packet output queue.
+The forth level names for the elements of
+.Li struct ifqueue are same as described in
+.Li ip.ifq
+in the
+.Dv PF_INET
+section.
.El
.El
.Ss CTL_VFS
@@ -2174,6 +2197,8 @@ definitions for third level virtual file system identifiers
definitions for second level virtual memory identifiers
.It Aq Pa uvm/uvm_swap_encrypt.h
definitions for third level virtual memory identifiers
+.It Aq Pa net/if.h
+definitions for packet input/output queue identifiers
.It Aq Pa net/pipex.h
definitions for third level PIPEX identifiers
.It Aq Pa netinet/in.h
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index f1f88061a31..b851aaf020c 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.8,v 1.169 2013/06/02 21:37:03 yasuoka Exp $
+.\" $OpenBSD: sysctl.8,v 1.170 2013/06/08 14:24:39 yasuoka Exp $
.\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $
.\"
.\" Copyright (c) 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95
.\"
-.Dd $Mdocdate: June 2 2013 $
+.Dd $Mdocdate: June 8 2013 $
.Dt SYSCTL 8
.Os
.Sh NAME
@@ -327,6 +327,12 @@ and a few require a kernel compiled with non-standard
.It net.mpls.mapttl_ip Ta integer Ta yes
.It net.mpls.mapttl_ip6 Ta integer Ta yes
.It net.pipex.enable Ta integer Ta yes
+.It net.pipex.inq.len Ta integer Ta no
+.It net.pipex.inq.maxlen Ta integer Ta yes
+.It net.pipex.inq.drops Ta integer Ta no
+.It net.pipex.outq.len Ta integer Ta no
+.It net.pipex.outq.maxlen Ta integer Ta yes
+.It net.pipex.outq.drops=0 Ta integer Ta no
.It debug.syncprt Ta integer Ta yes
.It debug.busyprt Ta integer Ta yes
.It debug.doclusterread Ta integer Ta yes
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 9b62beeb73c..444ea003885 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.189 2013/04/16 22:06:48 deraadt Exp $ */
+/* $OpenBSD: sysctl.c,v 1.190 2013/06/08 14:24:39 yasuoka Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -2175,6 +2175,7 @@ sysctl_mpls(char *string, char **bufpp, int mib[], int flags, int *typep)
int
sysctl_pipex(char *string, char **bufpp, int mib[], int flags, int *typep)
{
+ struct list *lp;
int indx;
if (*bufpp == NULL) {
@@ -2185,6 +2186,20 @@ sysctl_pipex(char *string, char **bufpp, int mib[], int flags, int *typep)
return (-1);
mib[2] = indx;
*typep = pipexlist.list[indx].ctl_type;
+ if (*typep == CTLTYPE_NODE) {
+ int tindx;
+
+ if (*bufpp == NULL) {
+ listall(string, &ifqlist);
+ return(-1);
+ }
+ lp = &ifqlist;
+ if ((tindx = findname(string, "fourth", bufpp, lp)) == -1)
+ return (-1);
+ mib[3] = tindx;
+ *typep = lp->list[tindx].ctl_type;
+ return(4);
+ }
return (3);
}
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index a40ed53101e..5da7f15bbf4 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.41 2013/04/16 07:36:55 yasuoka Exp $ */
+/* $OpenBSD: pipex.c,v 1.42 2013/06/08 14:24:38 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -3061,14 +3061,18 @@ int
pipex_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return (ENOTDIR);
-
switch (name[0]) {
case PIPEXCTL_ENABLE:
+ if (namelen != 1)
+ return (ENOTDIR);
return (sysctl_int(oldp, oldlenp, newp, newlen,
&pipex_enable));
+ case PIPEXCTL_INQ:
+ return (sysctl_ifq(name + 1, namelen - 1,
+ oldp, oldlenp, newp, newlen, &pipexinq));
+ case PIPEXCTL_OUTQ:
+ return (sysctl_ifq(name + 1, namelen - 1,
+ oldp, oldlenp, newp, newlen, &pipexoutq));
default:
return (ENOPROTOOPT);
}
diff --git a/sys/net/pipex.h b/sys/net/pipex.h
index 197a34bfe7a..f2b9839c528 100644
--- a/sys/net/pipex.h
+++ b/sys/net/pipex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.h,v 1.16 2012/12/05 23:20:23 deraadt Exp $ */
+/* $OpenBSD: pipex.h,v 1.17 2013/06/08 14:24:38 yasuoka Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -33,17 +33,15 @@
* Names for pipex sysctl objects
*/
#define PIPEXCTL_ENABLE 1
-#define PIPEXCTL_MAXID 2
+#define PIPEXCTL_INQ 2
+#define PIPEXCTL_OUTQ 3
+#define PIPEXCTL_MAXID 4
#define PIPEXCTL_NAMES { \
{ 0, 0 }, \
{ "enable", CTLTYPE_INT }, \
-}
-
-#define PIPEXCTL_VARS { \
- NULL, \
- &pipex_enable \
- NULL \
+ { "inq", CTLTYPE_NODE }, \
+ { "outq", CTLTYPE_NODE }, \
}
#define PIPEX_PROTO_L2TP 1 /* protocol L2TP */