diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-02-24 21:45:02 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-02-24 21:45:02 +0000 |
commit | 7a117c93132ed22b1595b0a31190782096db2f0d (patch) | |
tree | aed2e6c5725e4785427b68d0eae790ca22dd8a1f /sbin/sysctl/sysctl.c | |
parent | 4d6522e360a3bd08408dd444cb266f97602c8aea (diff) |
deal with bpf node
Diffstat (limited to 'sbin/sysctl/sysctl.c')
-rw-r--r-- | sbin/sysctl/sysctl.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 81c0751563e..be00a997f1c 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.109 2004/02/10 19:53:33 grange Exp $ */ +/* $OpenBSD: sysctl.c,v 1.110 2004/02/24 21:45:01 tedu Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95"; #else -static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.109 2004/02/10 19:53:33 grange Exp $"; +static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.110 2004/02/24 21:45:01 tedu Exp $"; #endif #endif /* not lint */ @@ -193,6 +193,7 @@ int sysctl_inet(char *, char **, int *, int, int *); #ifdef INET6 int sysctl_inet6(char *, char **, int *, int, int *); #endif +int sysctl_bpf(char *, char **, int *, int, int *); int sysctl_ipx(char *, char **, int *, int, int *); int sysctl_fs(char *, char **, int *, int, int *); static int sysctl_vfs(char *, char **, int[], int, int *); @@ -538,6 +539,12 @@ parse(char *string, int flags) break; return; } + if (mib[1] == PF_BPF) { + len = sysctl_bpf(string, &bufp, mib, flags, &type); + if (len < 0) + return; + break; + } if (flags == 0) return; warnx("use netstat to view %s information", string); @@ -1289,6 +1296,7 @@ struct ctlname grename[] = GRECTL_NAMES; struct ctlname mobileipname[] = MOBILEIPCTL_NAMES; struct ctlname ipcompname[] = IPCOMPCTL_NAMES; struct ctlname carpname[] = CARPCTL_NAMES; +struct ctlname bpfname[] = CTL_NET_BPF_NAMES; struct list inetlist = { inetname, IPPROTO_MAXID }; struct list inetvars[] = { { ipname, IPCTL_MAXID }, /* ip */ @@ -1405,6 +1413,7 @@ struct list inetvars[] = { { 0, 0 }, { carpname, CARPCTL_MAXID }, }; +struct list bpflist = { bpfname, NET_BPF_MAXID }; struct list kernmalloclist = { kernmallocname, KERN_MALLOC_MAXID }; struct list forkstatlist = { forkstatname, KERN_FORKSTAT_MAXID }; @@ -1885,6 +1894,23 @@ sysctl_ipx(char *string, char **bufpp, int mib[], int flags, int *typep) return (4); } +/* handle bpf requests */ +int +sysctl_bpf(char *string, char **bufpp, int mib[], int flags, int *typep) +{ + int indx; + + if (*bufpp == NULL) { + listall(string, &bpflist); + return (-1); + } + if ((indx = findname(string, "third", bufpp, &bpflist)) == -1) + return (-1); + mib[2] = indx; + *typep = CTLTYPE_INT; + return (3); +} + /* * Handle SysV semaphore info requests */ |