From 182b1e5191b7e035a1b9e00bd0f68b6f8dfd64a7 Mon Sep 17 00:00:00 2001 From: itojun Date: Fri, 27 Jul 2001 04:48:13 +0000 Subject: [PATCH] do not #ifdef KEY_DEBUG in header. sync with kame --- sys/netkey/key.c | 36 +++++++++++++++++++++++++++++------- sys/netkey/key_var.h | 16 +--------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/sys/netkey/key.c b/sys/netkey/key.c index 6c48cd27243e..c58824e74251 100644 --- a/sys/netkey/key.c +++ b/sys/netkey/key.c @@ -1,4 +1,4 @@ -/* $NetBSD: key.c,v 1.44 2001/06/04 21:38:28 mrg Exp $ */ +/* $NetBSD: key.c,v 1.45 2001/07/27 04:48:13 itojun Exp $ */ /* $KAME: key.c,v 1.182 2001/02/16 23:43:01 thorpej Exp $ */ /* @@ -7365,8 +7365,6 @@ key_alloc_mbuf(l) #include #include -static int *key_sysvars[] = KEYCTL_VARS; - int key_sysctl(name, namelen, oldp, oldlenp, newp, newlen) int *name; @@ -7378,11 +7376,35 @@ key_sysctl(name, namelen, oldp, oldlenp, newp, newlen) { if (name[0] >= KEYCTL_MAXID) return EOPNOTSUPP; - if (!key_sysvars[name[0]]) - return EOPNOTSUPP; switch (name[0]) { - default: +#ifdef KEY_DEBUG + case KEYCTL_DEBUG_LEVEL: return sysctl_int(oldp, oldlenp, newp, newlen, - key_sysvars[name[0]]); + &key_debug_level); +#endif + case KEYCTL_SPI_TRY: + return sysctl_int(oldp, oldlenp, newp, newlen, + &key_spi_trycnt); + case KEYCTL_SPI_MIN_VALUE: + return sysctl_int(oldp, oldlenp, newp, newlen, + &key_spi_minval); + case KEYCTL_SPI_MAX_VALUE: + return sysctl_int(oldp, oldlenp, newp, newlen, + &key_spi_maxval); + case KEYCTL_RANDOM_INT: + return sysctl_int(oldp, oldlenp, newp, newlen, + &key_int_random); + case KEYCTL_LARVAL_LIFETIME: + return sysctl_int(oldp, oldlenp, newp, newlen, + &key_larval_lifetime); + case KEYCTL_BLOCKACQ_COUNT: + return sysctl_int(oldp, oldlenp, newp, newlen, + &key_blockacq_count); + case KEYCTL_BLOCKACQ_LIFETIME: + return sysctl_int(oldp, oldlenp, newp, newlen, + &key_blockacq_lifetime); + default: + return EOPNOTSUPP; } + /* NOTREACHED */ } diff --git a/sys/netkey/key_var.h b/sys/netkey/key_var.h index 96825e86a91e..8b29f6ace61c 100644 --- a/sys/netkey/key_var.h +++ b/sys/netkey/key_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: key_var.h,v 1.9 2001/05/30 11:42:14 mrg Exp $ */ +/* $NetBSD: key_var.h,v 1.10 2001/07/27 04:48:14 itojun Exp $ */ /* $KAME: key_var.h,v 1.8 2000/05/24 17:28:23 itojun Exp $ */ /* @@ -62,19 +62,6 @@ { "blockacq_lifetime", CTLTYPE_INT }, \ } -#ifdef IPSEC_DEBUG -#define KEYCTL_VARS { \ - 0, \ - &key_debug_level, \ - &key_spi_trycnt, \ - &key_spi_minval, \ - &key_spi_maxval, \ - &key_int_random, \ - &key_larval_lifetime, \ - &key_blockacq_count, \ - &key_blockacq_lifetime, \ -} -#else #define KEYCTL_VARS { \ 0, \ 0, \ @@ -86,7 +73,6 @@ &key_blockacq_count, \ &key_blockacq_lifetime, \ } -#endif #ifdef _KERNEL #define _ARRAYLEN(p) (sizeof(p)/sizeof(p[0]))