diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 1999-12-10 10:12:57 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 1999-12-10 10:12:57 +0000 |
commit | 9a9eedae6f9ba315109168d73efb4170f153acdb (patch) | |
tree | c6ad15ad2e71c085d9aa69347f2121dbc1ff3c61 | |
parent | cc70c02ab229784e5e0814387fc6294170f7c37b (diff) |
add IPv6 support. net.inet6.{ip6,icmp6} will be printed.
-rw-r--r-- | sbin/sysctl/Makefile | 4 | ||||
-rw-r--r-- | sbin/sysctl/sysctl.8 | 25 | ||||
-rw-r--r-- | sbin/sysctl/sysctl.c | 109 | ||||
-rw-r--r-- | usr.sbin/sysctl/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/sysctl/sysctl.8 | 25 | ||||
-rw-r--r-- | usr.sbin/sysctl/sysctl.c | 109 |
6 files changed, 268 insertions, 8 deletions
diff --git a/sbin/sysctl/Makefile b/sbin/sysctl/Makefile index f7b83f1d8af..f1b0ef0f89d 100644 --- a/sbin/sysctl/Makefile +++ b/sbin/sysctl/Makefile @@ -1,6 +1,8 @@ -# $OpenBSD: Makefile,v 1.3 1997/09/21 11:44:28 deraadt Exp $ +# $OpenBSD: Makefile,v 1.4 1999/12/10 10:12:56 itojun Exp $ PROG= sysctl MAN= sysctl.8 +CPPFLAGS+= -DINET6 + .include <bsd.prog.mk> diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index 3982fe8d865..97cb873396b 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.8,v 1.31 1999/10/28 03:34:03 angelos Exp $ +.\" $OpenBSD: sysctl.8,v 1.32 1999/12/10 10:12:56 itojun Exp $ .\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $ .\" .\" Copyright (c) 1993 @@ -173,6 +173,29 @@ privilege can change the value. .It net.inet.udp.baddynamic array yes .It net.inet.esp.enable integer yes .It net.inet.ah.enable integer yes +.It net.inet6.ip6.forwarding integer yes +.It net.inet6.ip6.redirect integer yes +.It net.inet6.ip6.hlim integer yes +.It net.inet6.ip6.maxfragpackets integer yes +.It net.inet6.ip6.accept_rtadv integer yes +.It net.inet6.ip6.keepfaith integer yes +.It net.inet6.ip6.log_interval integer yes +.It net.inet6.ip6.hdrnestlimit integer yes +.It net.inet6.ip6.dad_count integer yes +.It net.inet6.ip6.auto_flowlabel integer yes +.It net.inet6.ip6.defmcasthlim integer yes +.It net.inet6.ip6.gifhlim integer yes +.It net.inet6.ip6.kame_version string no +.It net.inet6.ip6.use_deprecated integer yes +.It net.inet6.icmp6.rediraccept integer yes +.It net.inet6.icmp6.redirtimeout integer yes +.It net.inet6.icmp6.errratelimit integer yes +.It net.inet6.icmp6.nd6_prune integer yes +.It net.inet6.icmp6.nd6_delay integer yes +.It net.inet6.icmp6.nd6_umaxtries integer yes +.It net.inet6.icmp6.nd6_mmaxtries integer yes +.It net.inet6.icmp6.nd6_useloopback integer yes +.It net.inet6.icmp6.nd6_proxyall integer yes .It net.ipx.ipx.recvspace integer yes .It net.ipx.ipx.sendspace integer yes .It debug.syncprt integer yes diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index ec37403f599..52975b7c0dd 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.42 1999/10/28 03:34:03 angelos Exp $ */ +/* $OpenBSD: sysctl.c,v 1.43 1999/12/10 10:12:56 itojun Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95"; #else -static char *rcsid = "$OpenBSD: sysctl.c,v 1.42 1999/10/28 03:34:03 angelos Exp $"; +static char *rcsid = "$OpenBSD: sysctl.c,v 1.43 1999/12/10 10:12:56 itojun Exp $"; #endif #endif /* not lint */ @@ -75,6 +75,13 @@ static char *rcsid = "$OpenBSD: sysctl.c,v 1.42 1999/10/28 03:34:03 angelos Exp #include <netinet/tcp_timer.h> #include <netinet/tcp_var.h> +#ifdef INET6 +#include <netinet6/ip6.h> +#include <netinet6/icmp6.h> +#include <netinet6/ip6_var.h> +#include <netinet6/pim6_var.h> +#endif + #include <netipx/ipx.h> #include <netipx/ipx_var.h> #include <netipx/spx_var.h> @@ -155,6 +162,9 @@ void parse_baddynamic __P((int *, size_t, char *, void **, size_t *, int, int)); void usage __P((void)); int findname __P((char *, char *, char **, struct list *)); int sysctl_inet __P((char *, char **, int *, int, int *)); +#ifdef INET6 +int sysctl_inet6 __P((char *, char **, int *, int, int *)); +#endif int sysctl_ipx __P((char *, char **, int *, int, int *)); int sysctl_fs __P((char *, char **, int *, int, int *)); int sysctl_bios __P((char *, char **, int *, int, int *)); @@ -391,6 +401,15 @@ parse(string, flags) } break; } +#ifdef INET6 + if (mib[1] == PF_INET6) { + len = sysctl_inet6(string, &bufp, mib, flags, &type); + if (len < 0) + return; + + break; + } +#endif if (mib[1] == PF_IPX) { len = sysctl_ipx(string, &bufp, mib, flags, &type); if (len >= 0) @@ -1063,6 +1082,92 @@ sysctl_inet(string, bufpp, mib, flags, typep) return(4); } +#ifdef INET6 +struct ctlname inet6name[] = CTL_IPV6PROTO_NAMES; +struct ctlname ip6name[] = IPV6CTL_NAMES; +struct ctlname icmp6name[] = ICMPV6CTL_NAMES; +struct ctlname pim6name[] = PIMCTL_NAMES; +struct list inet6list = { inet6name, IPV6PROTO_MAXID }; +struct list inet6vars[] = { +/*0*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, +/*10*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*20*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*30*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*40*/ { 0, 0 }, + { ip6name, IPV6CTL_MAXID }, /* ipv6 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*50*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { icmp6name, ICMPV6CTL_MAXID }, /* icmp6 */ + { 0, 0 }, +/*60*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*70*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*80*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*90*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*100*/ { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { pim6name, PIMCTL_MAXID }, /* pim6 */ +}; + +/* + * handle internet6 requests + */ +int +sysctl_inet6(string, bufpp, mib, flags, typep) + char *string; + char **bufpp; + int mib[]; + int flags; + int *typep; +{ + struct list *lp; + int indx; + + if (*bufpp == NULL) { + listall(string, &inet6list); + return(-1); + } + if ((indx = findname(string, "third", bufpp, &inet6list)) == -1) + return(-1); + mib[2] = indx; + if (indx < IPV6PROTO_MAXID && inet6vars[indx].list != NULL) + lp = &inet6vars[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); +} +#endif + struct ctlname ipxname[] = CTL_IPXPROTO_NAMES; struct ctlname ipxpname[] = IPXCTL_NAMES; struct ctlname spxpname[] = SPXCTL_NAMES; diff --git a/usr.sbin/sysctl/Makefile b/usr.sbin/sysctl/Makefile index f7b83f1d8af..f1b0ef0f89d 100644 --- a/usr.sbin/sysctl/Makefile +++ b/usr.sbin/sysctl/Makefile @@ -1,6 +1,8 @@ -# $OpenBSD: Makefile,v 1.3 1997/09/21 11:44:28 deraadt Exp $ +# $OpenBSD: Makefile,v 1.4 1999/12/10 10:12:56 itojun Exp $ PROG= sysctl MAN= sysctl.8 +CPPFLAGS+= -DINET6 + .include <bsd.prog.mk> diff --git a/usr.sbin/sysctl/sysctl.8 b/usr.sbin/sysctl/sysctl.8 index 3982fe8d865..97cb873396b 100644 --- a/usr.sbin/sysctl/sysctl.8 +++ b/usr.sbin/sysctl/sysctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.8,v 1.31 1999/10/28 03:34:03 angelos Exp $ +.\" $OpenBSD: sysctl.8,v 1.32 1999/12/10 10:12:56 itojun Exp $ .\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $ .\" .\" Copyright (c) 1993 @@ -173,6 +173,29 @@ privilege can change the value. .It net.inet.udp.baddynamic array yes .It net.inet.esp.enable integer yes .It net.inet.ah.enable integer yes +.It net.inet6.ip6.forwarding integer yes +.It net.inet6.ip6.redirect integer yes +.It net.inet6.ip6.hlim integer yes +.It net.inet6.ip6.maxfragpackets integer yes +.It net.inet6.ip6.accept_rtadv integer yes +.It net.inet6.ip6.keepfaith integer yes +.It net.inet6.ip6.log_interval integer yes +.It net.inet6.ip6.hdrnestlimit integer yes +.It net.inet6.ip6.dad_count integer yes +.It net.inet6.ip6.auto_flowlabel integer yes +.It net.inet6.ip6.defmcasthlim integer yes +.It net.inet6.ip6.gifhlim integer yes +.It net.inet6.ip6.kame_version string no +.It net.inet6.ip6.use_deprecated integer yes +.It net.inet6.icmp6.rediraccept integer yes +.It net.inet6.icmp6.redirtimeout integer yes +.It net.inet6.icmp6.errratelimit integer yes +.It net.inet6.icmp6.nd6_prune integer yes +.It net.inet6.icmp6.nd6_delay integer yes +.It net.inet6.icmp6.nd6_umaxtries integer yes +.It net.inet6.icmp6.nd6_mmaxtries integer yes +.It net.inet6.icmp6.nd6_useloopback integer yes +.It net.inet6.icmp6.nd6_proxyall integer yes .It net.ipx.ipx.recvspace integer yes .It net.ipx.ipx.sendspace integer yes .It debug.syncprt integer yes diff --git a/usr.sbin/sysctl/sysctl.c b/usr.sbin/sysctl/sysctl.c index ec37403f599..52975b7c0dd 100644 --- a/usr.sbin/sysctl/sysctl.c +++ b/usr.sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.42 1999/10/28 03:34:03 angelos Exp $ */ +/* $OpenBSD: sysctl.c,v 1.43 1999/12/10 10:12:56 itojun Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95"; #else -static char *rcsid = "$OpenBSD: sysctl.c,v 1.42 1999/10/28 03:34:03 angelos Exp $"; +static char *rcsid = "$OpenBSD: sysctl.c,v 1.43 1999/12/10 10:12:56 itojun Exp $"; #endif #endif /* not lint */ @@ -75,6 +75,13 @@ static char *rcsid = "$OpenBSD: sysctl.c,v 1.42 1999/10/28 03:34:03 angelos Exp #include <netinet/tcp_timer.h> #include <netinet/tcp_var.h> +#ifdef INET6 +#include <netinet6/ip6.h> +#include <netinet6/icmp6.h> +#include <netinet6/ip6_var.h> +#include <netinet6/pim6_var.h> +#endif + #include <netipx/ipx.h> #include <netipx/ipx_var.h> #include <netipx/spx_var.h> @@ -155,6 +162,9 @@ void parse_baddynamic __P((int *, size_t, char *, void **, size_t *, int, int)); void usage __P((void)); int findname __P((char *, char *, char **, struct list *)); int sysctl_inet __P((char *, char **, int *, int, int *)); +#ifdef INET6 +int sysctl_inet6 __P((char *, char **, int *, int, int *)); +#endif int sysctl_ipx __P((char *, char **, int *, int, int *)); int sysctl_fs __P((char *, char **, int *, int, int *)); int sysctl_bios __P((char *, char **, int *, int, int *)); @@ -391,6 +401,15 @@ parse(string, flags) } break; } +#ifdef INET6 + if (mib[1] == PF_INET6) { + len = sysctl_inet6(string, &bufp, mib, flags, &type); + if (len < 0) + return; + + break; + } +#endif if (mib[1] == PF_IPX) { len = sysctl_ipx(string, &bufp, mib, flags, &type); if (len >= 0) @@ -1063,6 +1082,92 @@ sysctl_inet(string, bufpp, mib, flags, typep) return(4); } +#ifdef INET6 +struct ctlname inet6name[] = CTL_IPV6PROTO_NAMES; +struct ctlname ip6name[] = IPV6CTL_NAMES; +struct ctlname icmp6name[] = ICMPV6CTL_NAMES; +struct ctlname pim6name[] = PIMCTL_NAMES; +struct list inet6list = { inet6name, IPV6PROTO_MAXID }; +struct list inet6vars[] = { +/*0*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, +/*10*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*20*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*30*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*40*/ { 0, 0 }, + { ip6name, IPV6CTL_MAXID }, /* ipv6 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*50*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { icmp6name, ICMPV6CTL_MAXID }, /* icmp6 */ + { 0, 0 }, +/*60*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*70*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*80*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*90*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, +/*100*/ { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { pim6name, PIMCTL_MAXID }, /* pim6 */ +}; + +/* + * handle internet6 requests + */ +int +sysctl_inet6(string, bufpp, mib, flags, typep) + char *string; + char **bufpp; + int mib[]; + int flags; + int *typep; +{ + struct list *lp; + int indx; + + if (*bufpp == NULL) { + listall(string, &inet6list); + return(-1); + } + if ((indx = findname(string, "third", bufpp, &inet6list)) == -1) + return(-1); + mib[2] = indx; + if (indx < IPV6PROTO_MAXID && inet6vars[indx].list != NULL) + lp = &inet6vars[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); +} +#endif + struct ctlname ipxname[] = CTL_IPXPROTO_NAMES; struct ctlname ipxpname[] = IPXCTL_NAMES; struct ctlname spxpname[] = SPXCTL_NAMES; |