diff options
-rw-r--r-- | sbin/sysctl/sysctl.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 1897960ce03..1fb3dec337f 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.156 2008/03/14 19:19:57 sobrado Exp $ */ +/* $OpenBSD: sysctl.c,v 1.157 2008/04/28 11:52:53 norby 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.156 2008/03/14 19:19:57 sobrado Exp $"; +static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.157 2008/04/28 11:52:53 norby Exp $"; #endif #endif /* not lint */ @@ -93,6 +93,8 @@ static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.156 2008/03/14 19:19:57 sobr #include <netinet6/pim6_var.h> #endif +#include <netmpls/mpls.h> + #include <uvm/uvm_swap_encrypt.h> #include <ufs/ufs/quota.h> @@ -197,6 +199,7 @@ int sysctl_inet(char *, char **, int *, int, int *); int sysctl_inet6(char *, char **, int *, int, int *); #endif int sysctl_bpf(char *, char **, int *, int, int *); +int sysctl_mpls(char *, char **, int *, int, int *); int sysctl_fs(char *, char **, int *, int, int *); static int sysctl_vfs(char *, char **, int[], int, int *); static int sysctl_vfsgen(char *, char **, int[], int, int *); @@ -579,6 +582,12 @@ parse(char *string, int flags) return; break; } + if (mib[1] == PF_MPLS) { + len = sysctl_mpls(string, &bufp, mib, flags, &type); + if (len < 0) + return; + break; + } if (flags == 0) return; warnx("use netstat to view %s information", string); @@ -2039,6 +2048,41 @@ sysctl_bpf(char *string, char **bufpp, int mib[], int flags, int *typep) return (3); } +struct ctlname mplsname[] = MPLSCTL_NAMES; +struct list mplslist = { mplsname, MPLSCTL_MAXID }; + +/* handle MPLS requests */ +int +sysctl_mpls(char *string, char **bufpp, int mib[], int flags, int *typep) +{ + struct list *lp; + int indx; + + if (*bufpp == NULL) { + listall(string, &mplslist); + return (-1); + } + if ((indx = findname(string, "third", bufpp, &mplslist)) == -1) + return (-1); + mib[2] = indx; + *typep = mplslist.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); +} + /* * Handle SysV semaphore info requests */ |