summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-07-03 10:32:34 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-07-03 10:32:34 +0000
commit378f5e3d7c132f2fe3edb6414cd23ff77c87ae7d (patch)
tree46301acf05fd7e20b84cf279c917ffd68277de80
parent87c3a1805d44c7fd2ec53e30d48e7cab484fb230 (diff)
wire up net.link.ifrxq.pressure_return and pressure_drop
ok visa@ deraadt@
-rw-r--r--sbin/sysctl/Makefile3
-rw-r--r--sbin/sysctl/sysctl.c49
2 files changed, 50 insertions, 2 deletions
diff --git a/sbin/sysctl/Makefile b/sbin/sysctl/Makefile
index d94a7e9d025..a8ced46f288 100644
--- a/sbin/sysctl/Makefile
+++ b/sbin/sysctl/Makefile
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile,v 1.12 2016/09/11 07:06:29 natano Exp $
+# $OpenBSD: Makefile,v 1.13 2019/07/03 10:32:33 dlg Exp $
PROG= sysctl
MAN= sysctl.8
+DEBUG=-g
CPPFLAGS+= -D_LIBKVM
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 4db2f2b661d..4fdf53b706b 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.244 2019/06/28 13:32:46 deraadt Exp $ */
+/* $OpenBSD: sysctl.c,v 1.245 2019/07/03 10:32:33 dlg Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -195,6 +195,7 @@ void usage(void);
int findname(char *, char *, char **, struct list *);
int sysctl_inet(char *, char **, int *, int, int *);
int sysctl_inet6(char *, char **, int *, int, int *);
+int sysctl_link(char *, char **, int *, int, int *);
int sysctl_bpf(char *, char **, int *, int, int *);
int sysctl_mpls(char *, char **, int *, int, int *);
int sysctl_pipex(char *, char **, int *, int, int *);
@@ -664,6 +665,12 @@ parse(char *string, int flags)
}
break;
}
+ if (mib[1] == PF_LINK) {
+ len = sysctl_link(string, &bufp, mib, flags, &type);
+ if (len < 0)
+ return;
+ break;
+ }
if (mib[1] == PF_BPF) {
len = sysctl_bpf(string, &bufp, mib, flags, &type);
if (len < 0)
@@ -2249,6 +2256,46 @@ sysctl_inet6(char *string, char **bufpp, int mib[], int flags, int *typep)
return (4);
}
+/* handle net.link requests */
+struct ctlname netlinkname[] = CTL_NET_LINK_NAMES;
+struct ctlname ifrxqname[] = CTL_NET_LINK_IFRXQ_NAMES;
+struct list netlinklist = { netlinkname, NET_LINK_MAXID };
+struct list netlinkvars[] = {
+ [NET_LINK_IFRXQ] = { ifrxqname, NET_LINK_IFRXQ_MAXID },
+};
+
+int
+sysctl_link(char *string, char **bufpp, int mib[], int flags, int *typep)
+{
+ struct list *lp;
+ int indx;
+
+ if (*bufpp == NULL) {
+ listall(string, &netlinklist);
+ return (-1);
+ }
+ if ((indx = findname(string, "third", bufpp, &netlinklist)) == -1)
+ return (-1);
+ mib[2] = indx;
+ if (indx < NET_LINK_MAXID && netlinkvars[indx].list != NULL)
+ lp = &netlinkvars[indx];
+ else if (!flags)
+ return (-1);
+ else {
+ warnx("%s: no variables defined for this protocol", string);
+ return (-1);
+ }
+ if (*bufpp == NULL) {
+ listall(string, lp);
+ return (-1);
+ }
+ if ((indx = findname(string, "fourth", bufpp, lp)) == -1)
+ return (-1);
+ mib[3] = indx;
+ *typep = lp->list[indx].ctl_type;
+ return (4);
+}
+
/* handle bpf requests */
int
sysctl_bpf(char *string, char **bufpp, int mib[], int flags, int *typep)