summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-02-15 11:16:09 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-02-15 11:16:09 +0000
commit9af28b7ef8fcb82425389802b33fbb5d219d5bfa (patch)
tree788d8b71f7760ef08a3dd2762ae90f9eb83dfd9e
parent1de25cf61875f377333aa5a709a844f94c3e27f6 (diff)
switch to sysctl_int_arr(); ok itojun, henning, miod, deraadt
-rw-r--r--sys/netinet/icmp6.h26
-rw-r--r--sys/netinet/icmp_var.h12
-rw-r--r--sys/netinet/in.h34
-rw-r--r--sys/netinet/ip_icmp.c24
-rw-r--r--sys/netinet/ip_input.c67
-rw-r--r--sys/netinet/tcp_usrreq.c63
-rw-r--r--sys/netinet/tcp_var.h23
-rw-r--r--sys/netinet6/icmp6.c40
-rw-r--r--sys/netinet6/in6.h47
-rw-r--r--sys/netinet6/ip6_input.c47
10 files changed, 178 insertions, 205 deletions
diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h
index 085e00fed44..b0b94232267 100644
--- a/sys/netinet/icmp6.h
+++ b/sys/netinet/icmp6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.h,v 1.28 2003/11/16 20:30:07 avsm Exp $ */
+/* $OpenBSD: icmp6.h,v 1.29 2004/02/15 11:16:08 markus Exp $ */
/* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */
/*
@@ -621,6 +621,30 @@ struct icmp6stat {
{ 0, 0 }, \
}
+#define ICMPV6CTL_VARS { \
+ NULL, \
+ NULL, \
+ &icmp6_rediraccept, \
+ &icmp6_redirtimeout, \
+ NULL, \
+ NULL, \
+ &nd6_prune, \
+ NULL, \
+ &nd6_delay, \
+ &nd6_umaxtries, \
+ &nd6_mmaxtries, \
+ &nd6_useloopback, \
+ NULL, \
+ &icmp6_nodeinfo, \
+ &icmp6errppslim, \
+ &nd6_maxnudhint, \
+ &icmp6_mtudisc_hiwat, \
+ &icmp6_mtudisc_lowat, \
+ &nd6_debug, \
+ NULL, \
+ NULL, \
+}
+
#define RTF_PROBEMTU RTF_PROTO1
#ifdef _KERNEL
diff --git a/sys/netinet/icmp_var.h b/sys/netinet/icmp_var.h
index a3a791c48db..b759744656a 100644
--- a/sys/netinet/icmp_var.h
+++ b/sys/netinet/icmp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp_var.h,v 1.11 2003/06/02 23:28:13 millert Exp $ */
+/* $OpenBSD: icmp_var.h,v 1.12 2004/02/15 11:16:08 markus Exp $ */
/* $NetBSD: icmp_var.h,v 1.8 1995/03/26 20:32:19 jtc Exp $ */
/*
@@ -76,6 +76,16 @@ struct icmpstat {
{ "tstamprepl", CTLTYPE_INT }, \
}
+#define ICMPCTL_VARS { \
+ NULL, \
+ &icmpmaskrepl, \
+ &icmpbmcastecho, \
+ &icmperrppslim, \
+ &icmp_rediraccept, \
+ NULL, \
+ &icmptstamprepl, \
+}
+
#ifdef _KERNEL
extern struct icmpstat icmpstat;
#endif /* _KERNEL */
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index e7cc74a75ba..4e8b331de54 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.h,v 1.60 2003/12/17 21:36:17 mcbride Exp $ */
+/* $OpenBSD: in.h,v 1.61 2004/02/15 11:16:08 markus Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
@@ -504,6 +504,38 @@ struct ip_mreq {
{ "mtudisctimeout", CTLTYPE_INT }, \
{ "ipsec-comp-alg", CTLTYPE_STRING }, \
}
+#define IPCTL_VARS { \
+ NULL, \
+ &ipforwarding, \
+ &ipsendredirects, \
+ &ip_defttl, \
+ NULL, \
+ NULL, \
+ &ip_directedbcast, \
+ &ipport_firstauto, \
+ &ipport_lastauto, \
+ &ipport_hifirstauto, \
+ &ipport_hilastauto, \
+ &ip_maxqueue, \
+ &encdebug, \
+ NULL, \
+ &ipsec_expire_acquire, \
+ &ipsec_keep_invalid, \
+ &ipsec_require_pfs, \
+ &ipsec_soft_allocations, \
+ &ipsec_exp_allocations, \
+ &ipsec_soft_bytes, \
+ &ipsec_exp_bytes, \
+ &ipsec_exp_timeout, \
+ &ipsec_soft_timeout, \
+ &ipsec_soft_first_use, \
+ &ipsec_exp_first_use, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+}
/* INET6 stuff */
#define __KAME_NETINET_IN_H_INCLUDED_
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 95d543880ad..d6f5a9fc1e1 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.61 2003/07/09 22:03:16 itojun Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.62 2004/02/15 11:16:08 markus Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -106,6 +106,8 @@ int icmp_redirtimeout = 10 * 60;
static struct rttimer_queue *icmp_redirect_timeout_q = NULL;
struct icmpstat icmpstat;
+int *icmpctl_vars[ICMPCTL_MAXID] = ICMPCTL_VARS;
+
void icmp_mtudisc_timeout(struct rtentry *, struct rttimer *);
int icmp_ratelimit(const struct in_addr *, const int, const int);
static void icmp_redirect_timeout(struct rtentry *, struct rttimer *);
@@ -801,23 +803,6 @@ icmp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (ENOTDIR);
switch (name[0]) {
- case ICMPCTL_TSTAMPREPL:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &icmptstamprepl));
- case ICMPCTL_MASKREPL:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &icmpmaskrepl));
- case ICMPCTL_BMCASTECHO:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &icmpbmcastecho));
- case ICMPCTL_ERRPPSLIMIT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &icmperrppslim));
- break;
- case ICMPCTL_REDIRACCEPT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &icmp_rediraccept));
- break;
case ICMPCTL_REDIRTIMEOUT: {
int error;
@@ -840,6 +825,9 @@ icmp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
break;
}
default:
+ if (name[0] < ICMPCTL_MAXID)
+ return (sysctl_int_arr(icmpctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
return (ENOPROTOOPT);
}
/* NOTREACHED */
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 214635ed801..4472fcbe4b0 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.116 2004/02/13 01:29:46 brad Exp $ */
+/* $OpenBSD: ip_input.c,v 1.117 2004/02/15 11:16:08 markus Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -140,6 +140,8 @@ extern int ipport_hifirstauto;
extern int ipport_hilastauto;
extern struct baddynamicports baddynamicports;
+int *ipctl_vars[IPCTL_MAXID] = IPCTL_VARS;
+
extern struct domain inetdomain;
extern struct protosw inetsw[];
u_char ip_protox[IPPROTO_MAX];
@@ -1605,13 +1607,6 @@ ip_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
return (ENOTDIR);
switch (name[0]) {
- case IPCTL_FORWARDING:
- return (sysctl_int(oldp, oldlenp, newp, newlen, &ipforwarding));
- case IPCTL_SENDREDIRECTS:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsendredirects));
- case IPCTL_DEFTTL:
- return (sysctl_int(oldp, oldlenp, newp, newlen, &ip_defttl));
#ifdef notyet
case IPCTL_DEFMTU:
return (sysctl_int(oldp, oldlenp, newp, newlen, &ip_mtu));
@@ -1624,9 +1619,6 @@ ip_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
return (EPERM);
return (sysctl_int(oldp, oldlenp, newp, newlen,
&ip_dosourceroute));
- case IPCTL_DIRECTEDBCAST:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ip_directedbcast));
case IPCTL_MTUDISC:
error = sysctl_int(oldp, oldlenp, newp, newlen,
&ip_mtudisc);
@@ -1646,53 +1638,6 @@ ip_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
rt_timer_queue_change(ip_mtudisc_timeout_q,
ip_mtudisc_timeout);
return (error);
- case IPCTL_IPPORT_FIRSTAUTO:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipport_firstauto));
- case IPCTL_IPPORT_LASTAUTO:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipport_lastauto));
- case IPCTL_IPPORT_HIFIRSTAUTO:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipport_hifirstauto));
- case IPCTL_IPPORT_HILASTAUTO:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipport_hilastauto));
- case IPCTL_IPPORT_MAXQUEUE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ip_maxqueue));
- case IPCTL_ENCDEBUG:
- return (sysctl_int(oldp, oldlenp, newp, newlen, &encdebug));
- case IPCTL_IPSEC_EMBRYONIC_SA_TIMEOUT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_keep_invalid));
- case IPCTL_IPSEC_REQUIRE_PFS:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_require_pfs));
- case IPCTL_IPSEC_SOFT_ALLOCATIONS:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_soft_allocations));
- case IPCTL_IPSEC_ALLOCATIONS:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_exp_allocations));
- case IPCTL_IPSEC_SOFT_BYTES:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_soft_bytes));
- case IPCTL_IPSEC_BYTES:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_exp_bytes));
- case IPCTL_IPSEC_TIMEOUT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_exp_timeout));
- case IPCTL_IPSEC_SOFT_TIMEOUT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_soft_timeout));
- case IPCTL_IPSEC_SOFT_FIRSTUSE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_soft_first_use));
- case IPCTL_IPSEC_FIRSTUSE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_exp_first_use));
case IPCTL_IPSEC_ENC_ALGORITHM:
return (sysctl_tstring(oldp, oldlenp, newp, newlen,
ipsec_def_enc, sizeof(ipsec_def_enc)));
@@ -1700,14 +1645,14 @@ ip_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
return (sysctl_tstring(oldp, oldlenp, newp, newlen,
ipsec_def_auth,
sizeof(ipsec_def_auth)));
- case IPCTL_IPSEC_EXPIRE_ACQUIRE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &ipsec_expire_acquire));
case IPCTL_IPSEC_IPCOMP_ALGORITHM:
return (sysctl_tstring(oldp, oldlenp, newp, newlen,
ipsec_def_comp,
sizeof(ipsec_def_comp)));
default:
+ if (name[0] < IPCTL_MAXID)
+ return (sysctl_int_arr(ipctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
return (EOPNOTSUPP);
}
/* NOTREACHED */
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index c1cd8d33bf7..db32c7e2f7c 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.79 2004/01/31 21:09:15 henning Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.80 2004/02/15 11:16:08 markus Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -107,6 +107,17 @@ extern int tcp_rst_ppslim;
/* from in_pcb.c */
extern struct baddynamicports baddynamicports;
+#ifndef TCP_SENDSPACE
+#define TCP_SENDSPACE 1024*16
+#endif
+u_int tcp_sendspace = TCP_SENDSPACE;
+#ifndef TCP_RECVSPACE
+#define TCP_RECVSPACE 1024*16
+#endif
+u_int tcp_recvspace = TCP_RECVSPACE;
+
+int *tcpctl_vars[TCPCTL_MAXID] = TCPCTL_VARS;
+
struct inpcbtable tcbtable;
int tcp_ident(void *, size_t *, void *, size_t);
@@ -645,15 +656,6 @@ tcp_ctloutput(op, so, level, optname, mp)
return (error);
}
-#ifndef TCP_SENDSPACE
-#define TCP_SENDSPACE 1024*16
-#endif
-u_int tcp_sendspace = TCP_SENDSPACE;
-#ifndef TCP_RECVSPACE
-#define TCP_RECVSPACE 1024*16
-#endif
-u_int tcp_recvspace = TCP_RECVSPACE;
-
/*
* Attach TCP protocol to socket, allocating
* internet protocol control block, tcp control block,
@@ -882,29 +884,11 @@ tcp_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
return (ENOTDIR);
switch (name[0]) {
- case TCPCTL_RFC1323:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_do_rfc1323));
#ifdef TCP_SACK
case TCPCTL_SACK:
return (sysctl_int(oldp, oldlenp, newp, newlen,
&tcp_do_sack));
#endif
- case TCPCTL_MSSDFLT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_mssdflt));
- case TCPCTL_KEEPINITTIME:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcptv_keep_init));
-
- case TCPCTL_KEEPIDLE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_keepidle));
-
- case TCPCTL_KEEPINTVL:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_keepintvl));
-
case TCPCTL_SLOWHZ:
return (sysctl_rdint(oldp, oldlenp, newp, PR_SLOWHZ));
@@ -912,34 +896,17 @@ tcp_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
return (sysctl_struct(oldp, oldlenp, newp, newlen,
baddynamicports.tcp, sizeof(baddynamicports.tcp)));
- case TCPCTL_RECVSPACE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,&tcp_recvspace));
-
- case TCPCTL_SENDSPACE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,&tcp_sendspace));
case TCPCTL_IDENT:
return (tcp_ident(oldp, oldlenp, newp, newlen));
- case TCPCTL_RSTPPSLIMIT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_rst_ppslim));
- case TCPCTL_ACK_ON_PUSH:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_ack_on_push));
#ifdef TCP_ECN
case TCPCTL_ECN:
return (sysctl_int(oldp, oldlenp, newp, newlen,
&tcp_do_ecn));
#endif
- case TCPCTL_SYN_CACHE_LIMIT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_syn_cache_limit));
- case TCPCTL_SYN_BUCKET_LIMIT:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_syn_bucket_limit));
- case TCPCTL_RFC3390:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &tcp_do_rfc3390));
default:
+ if (name[0] < TCPCTL_MAXID)
+ return (sysctl_int_arr(tcpctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
return (ENOPROTOOPT);
}
/* NOTREACHED */
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index b9639558ae3..6b3306026bc 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.57 2004/01/31 19:40:10 markus Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.58 2004/02/15 11:16:08 markus Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -458,6 +458,27 @@ struct tcpstat {
{ "rfc3390", CTLTYPE_INT }, \
}
+#define TCPCTL_VARS { \
+ NULL, \
+ &tcp_do_rfc1323, \
+ &tcptv_keep_init, \
+ &tcp_keepidle, \
+ &tcp_keepintvl, \
+ NULL, \
+ NULL, \
+ &tcp_recvspace, \
+ &tcp_sendspace, \
+ NULL, \
+ NULL, \
+ &tcp_mssdflt, \
+ &tcp_rst_ppslim, \
+ &tcp_ack_on_push, \
+ NULL, \
+ &tcp_syn_cache_limit, \
+ &tcp_syn_bucket_limit, \
+ &tcp_do_rfc3390 \
+}
+
struct tcp_ident_mapping {
struct sockaddr_storage faddr, laddr;
int euid, ruid;
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 1ae2bee2aad..d4627ff69ce 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.80 2004/02/04 13:14:42 dhartmei Exp $ */
+/* $OpenBSD: icmp6.c,v 1.81 2004/02/15 11:16:08 markus Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -2838,6 +2838,9 @@ icmp6_redirect_timeout(rt, r)
#include <uvm/uvm_extern.h>
#include <sys/sysctl.h>
+
+int *icmpv6ctl_vars[ICMPV6CTL_MAXID] = ICMPV6CTL_VARS;
+
int
icmp6_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
int *name;
@@ -2854,45 +2857,16 @@ icmp6_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
switch (name[0]) {
- case ICMPV6CTL_REDIRACCEPT:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &icmp6_rediraccept);
- case ICMPV6CTL_REDIRTIMEOUT:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &icmp6_redirtimeout);
case ICMPV6CTL_STATS:
return sysctl_rdstruct(oldp, oldlenp, newp,
&icmp6stat, sizeof(icmp6stat));
- case ICMPV6CTL_ND6_PRUNE:
- return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_prune);
- case ICMPV6CTL_ND6_DELAY:
- return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_delay);
- case ICMPV6CTL_ND6_UMAXTRIES:
- return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_umaxtries);
- case ICMPV6CTL_ND6_MMAXTRIES:
- return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_mmaxtries);
- case ICMPV6CTL_ND6_USELOOPBACK:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &nd6_useloopback);
- case ICMPV6CTL_NODEINFO:
- return sysctl_int(oldp, oldlenp, newp, newlen, &icmp6_nodeinfo);
- case ICMPV6CTL_ERRPPSLIMIT:
- return sysctl_int(oldp, oldlenp, newp, newlen, &icmp6errppslim);
- case ICMPV6CTL_ND6_MAXNUDHINT:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &nd6_maxnudhint);
- case ICMPV6CTL_MTUDISC_HIWAT:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &icmp6_mtudisc_hiwat);
- case ICMPV6CTL_MTUDISC_LOWAT:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &icmp6_mtudisc_lowat);
- case ICMPV6CTL_ND6_DEBUG:
- return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_debug);
case ICMPV6CTL_ND6_DRLIST:
case ICMPV6CTL_ND6_PRLIST:
return nd6_sysctl(name[0], oldp, oldlenp, newp, newlen);
default:
+ if (name[0] < ICMPV6CTL_MAXID)
+ return (sysctl_int_arr(icmpv6ctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
return ENOPROTOOPT;
}
/* NOTREACHED */
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index e6f3c1737c3..e99d5edaac1 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.h,v 1.31 2003/06/02 23:28:15 millert Exp $ */
+/* $OpenBSD: in6.h,v 1.32 2004/02/15 11:16:08 markus Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -588,6 +588,51 @@ struct in6_pktinfo {
{ "maxfrags", CTLTYPE_INT }, \
}
+#define IPV6CTL_VARS { \
+ NULL, \
+ &ip6_forwarding, \
+ &ip6_sendredirects, \
+ &ip6_defhlim, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ &ip6_maxfragpackets, \
+ NULL, \
+ NULL, \
+ &ip6_accept_rtadv, \
+ &ip6_keepfaith, \
+ &ip6_log_interval, \
+ &ip6_hdrnestlimit, \
+ &ip6_dad_count, \
+ &ip6_auto_flowlabel, \
+ &ip6_defmcasthlim, \
+ NULL, \
+ NULL, \
+ &ip6_use_deprecated, \
+ &ip6_rr_prune, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ NULL, \
+ &ip6_maxfrags, \
+}
+
#endif /* !_XOPEN_SOURCE */
#ifdef _KERNEL
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index d516f01ed18..5a73b7b6715 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.56 2003/12/08 10:05:31 dhartmei Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.57 2004/02/15 11:16:08 markus Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -1342,6 +1342,8 @@ u_char inet6ctlerrmap[PRC_NCMDS] = {
#include <uvm/uvm_extern.h>
#include <sys/sysctl.h>
+int *ipv6ctl_vars[IPV6CTL_MAXID] = IPV6CTL_VARS;
+
int
ip6_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
int *name;
@@ -1356,50 +1358,15 @@ ip6_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
return ENOTDIR;
switch (name[0]) {
-
- case IPV6CTL_FORWARDING:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_forwarding);
- case IPV6CTL_SENDREDIRECTS:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_sendredirects);
- case IPV6CTL_DEFHLIM:
- return sysctl_int(oldp, oldlenp, newp, newlen, &ip6_defhlim);
- case IPV6CTL_MAXFRAGPACKETS:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_maxfragpackets);
- case IPV6CTL_ACCEPT_RTADV:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_accept_rtadv);
- case IPV6CTL_KEEPFAITH:
- return sysctl_int(oldp, oldlenp, newp, newlen, &ip6_keepfaith);
- case IPV6CTL_LOG_INTERVAL:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_log_interval);
- case IPV6CTL_HDRNESTLIMIT:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_hdrnestlimit);
- case IPV6CTL_DAD_COUNT:
- return sysctl_int(oldp, oldlenp, newp, newlen, &ip6_dad_count);
- case IPV6CTL_AUTO_FLOWLABEL:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_auto_flowlabel);
- case IPV6CTL_DEFMCASTHLIM:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_defmcasthlim);
case IPV6CTL_KAME_VERSION:
return sysctl_rdstring(oldp, oldlenp, newp, __KAME_VERSION);
- case IPV6CTL_USE_DEPRECATED:
- return sysctl_int(oldp, oldlenp, newp, newlen,
- &ip6_use_deprecated);
- case IPV6CTL_RR_PRUNE:
- return sysctl_int(oldp, oldlenp, newp, newlen, &ip6_rr_prune);
case IPV6CTL_V6ONLY:
return sysctl_rdint(oldp, oldlenp, newp, ip6_v6only);
- case IPV6CTL_MAXFRAGS:
- return sysctl_int(oldp, oldlenp, newp, newlen, &ip6_maxfrags);
default:
- return EOPNOTSUPP;
+ if (name[0] < IPV6CTL_MAXID)
+ return (sysctl_int_arr(ipv6ctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
+ return (EOPNOTSUPP);
}
/* NOTREACHED */
}