summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-02-17 12:07:46 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-02-17 12:07:46 +0000
commitd0031e7cc36a4c279a48e08f99959b3c999f87fa (patch)
tree85fc7f7faee8e235d8f78b3ed60bf7a80f79459e /sys/netinet
parent34fae67660d6f74ab6614e42aa78d4cc5f76f607 (diff)
switch to sysctl_int_arr(); ok henning, deraadt
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_ah.h7
-rw-r--r--sys/netinet/ip_esp.h9
-rw-r--r--sys/netinet/ip_ipcomp.h7
-rw-r--r--sys/netinet/ipsec_input.c61
-rw-r--r--sys/netinet/udp_usrreq.c21
-rw-r--r--sys/netinet/udp_var.h10
6 files changed, 59 insertions, 56 deletions
diff --git a/sys/netinet/ip_ah.h b/sys/netinet/ip_ah.h
index 91c1eba52cd..2ec742dfe11 100644
--- a/sys/netinet/ip_ah.h
+++ b/sys/netinet/ip_ah.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.h,v 1.30 2003/02/12 14:41:07 jason Exp $ */
+/* $OpenBSD: ip_ah.h,v 1.31 2004/02/17 12:07:45 markus Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -86,6 +86,11 @@ struct ah
{ "enable", CTLTYPE_INT }, \
}
+#define AHCTL_VARS { \
+ NULL, \
+ &ah_enable, \
+}
+
#ifdef _KERNEL
extern int ah_enable;
extern struct ahstat ahstat;
diff --git a/sys/netinet/ip_esp.h b/sys/netinet/ip_esp.h
index ba1098adaf7..887dbdeac28 100644
--- a/sys/netinet/ip_esp.h
+++ b/sys/netinet/ip_esp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.h,v 1.39 2003/12/02 23:16:28 markus Exp $ */
+/* $OpenBSD: ip_esp.h,v 1.40 2004/02/17 12:07:45 markus Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -81,6 +81,13 @@ struct espstat
{ "udpencap_port", CTLTYPE_INT }, \
}
+#define ESPCTL_VARS { \
+ NULL, \
+ &esp_enable, \
+ &udpencap_enable, \
+ &udpencap_port, \
+}
+
#ifdef _KERNEL
extern int esp_enable;
extern int udpencap_enable;
diff --git a/sys/netinet/ip_ipcomp.h b/sys/netinet/ip_ipcomp.h
index 9597be23477..501e0db7bcc 100644
--- a/sys/netinet/ip_ipcomp.h
+++ b/sys/netinet/ip_ipcomp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipcomp.h,v 1.5 2003/02/19 19:19:54 jason Exp $ */
+/* $OpenBSD: ip_ipcomp.h,v 1.6 2004/02/17 12:07:45 markus Exp $ */
/*
* Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
@@ -75,6 +75,11 @@ struct ipcomp {
{ "enable", CTLTYPE_INT}, \
}
+#define IPCOMPCTL_VARS { \
+ NULL, \
+ &ipcomp_enable, \
+}
+
#ifdef _KERNEL
extern int ipcomp_enable;
extern struct ipcompstat ipcompstat;
diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c
index 39e7b157821..44ed27eedb1 100644
--- a/sys/netinet/ipsec_input.c
+++ b/sys/netinet/ipsec_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec_input.c,v 1.70 2003/12/02 23:16:29 markus Exp $ */
+/* $OpenBSD: ipsec_input.c,v 1.71 2004/02/17 12:07:45 markus Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -87,6 +87,10 @@ int esp_enable = 1;
int ah_enable = 1;
int ipcomp_enable = 0;
+int *espctl_vars[ESPCTL_MAXID] = ESPCTL_VARS;
+int *ahctl_vars[AHCTL_MAXID] = AHCTL_VARS;
+int *ipcompctl_vars[IPCOMPCTL_MAXID] = IPCOMPCTL_VARS;
+
#ifdef INET6
extern struct ip6protosw inet6sw[];
extern u_char ip6_protox[];
@@ -640,58 +644,33 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff,
}
int
-esp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlen, void *newp,
+esp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return ENOTDIR;
-
- switch (name[0]) {
- case ESPCTL_ENABLE:
- return sysctl_int(oldp, oldlen, newp, newlen, &esp_enable);
- case ESPCTL_UDPENCAP_ENABLE:
- return sysctl_int(oldp, oldlen, newp, newlen, &udpencap_enable);
- case ESPCTL_UDPENCAP_PORT:
- return sysctl_int(oldp, oldlen, newp, newlen, &udpencap_port);
- default:
- return ENOPROTOOPT;
- }
- /* NOTREACHED */
+ if (name[0] < ESPCTL_MAXID)
+ return (sysctl_int_arr(espctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
+ return (ENOPROTOOPT);
}
int
-ah_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlen, void *newp,
+ah_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return ENOTDIR;
-
- switch (name[0]) {
- case AHCTL_ENABLE:
- return sysctl_int(oldp, oldlen, newp, newlen, &ah_enable);
- default:
- return ENOPROTOOPT;
- }
- /* NOTREACHED */
+ if (name[0] < AHCTL_MAXID)
+ return (sysctl_int_arr(ahctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
+ return (ENOPROTOOPT);
}
int
-ipcomp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlen, void *newp,
+ipcomp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return ENOTDIR;
-
- switch (name[0]) {
- case IPCOMPCTL_ENABLE:
- return sysctl_int(oldp, oldlen, newp, newlen, &ipcomp_enable);
- default:
- return ENOPROTOOPT;
- }
- /* NOTREACHED */
+ if (name[0] < IPCOMPCTL_MAXID)
+ return (sysctl_int_arr(ipcompctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
+ return (ENOPROTOOPT);
}
#ifdef INET
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 61599b8c37c..4f40fd45230 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.97 2004/01/07 09:56:13 markus Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.98 2004/02/17 12:07:45 markus Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -109,6 +109,12 @@ extern int ip6_defhlim;
*/
int udpcksum = 1;
+u_int udp_sendspace = 9216; /* really max datagram size */
+u_int udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
+ /* 40 1K datagrams */
+
+int *udpctl_vars[UDPCTL_MAXID] = UDPCTL_VARS;
+
struct inpcbtable udbtable;
struct udpstat udpstat;
@@ -1009,10 +1015,6 @@ release:
return (error);
}
-u_int udp_sendspace = 9216; /* really max datagram size */
-u_int udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
- /* 40 1K datagrams */
-
#ifdef INET6
/*ARGSUSED*/
int
@@ -1261,16 +1263,13 @@ udp_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
return (ENOTDIR);
switch (name[0]) {
- case UDPCTL_CHECKSUM:
- return (sysctl_int(oldp, oldlenp, newp, newlen, &udpcksum));
case UDPCTL_BADDYNAMIC:
return (sysctl_struct(oldp, oldlenp, newp, newlen,
baddynamicports.udp, sizeof(baddynamicports.udp)));
- case UDPCTL_RECVSPACE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,&udp_recvspace));
- case UDPCTL_SENDSPACE:
- return (sysctl_int(oldp, oldlenp, newp, newlen,&udp_sendspace));
default:
+ if (name[0] < UDPCTL_MAXID)
+ return (sysctl_int_arr(udpctl_vars, name, namelen,
+ oldp, oldlenp, newp, newlen));
return (ENOPROTOOPT);
}
/* NOTREACHED */
diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h
index 8f679fbc7da..8c385683949 100644
--- a/sys/netinet/udp_var.h
+++ b/sys/netinet/udp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_var.h,v 1.15 2003/06/02 23:28:15 millert Exp $ */
+/* $OpenBSD: udp_var.h,v 1.16 2004/02/17 12:07:45 markus Exp $ */
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
/*
@@ -87,6 +87,14 @@ struct udpstat {
{ "sendspace", CTLTYPE_INT }, \
}
+#define UDPCTL_VARS { \
+ NULL, \
+ &udpcksum, \
+ NULL, \
+ &udp_recvspace, \
+ &udp_sendspace, \
+}
+
#ifdef _KERNEL
extern struct inpcbtable udbtable;
extern struct udpstat udpstat;