Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet6/ip6_input.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet6/ip6_input.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.94.2.2 retrieving revision 1.99 diff -u -p -r1.94.2.2 -r1.99 --- src/sys/netinet6/ip6_input.c 2007/03/12 05:59:57 1.94.2.2 +++ src/sys/netinet6/ip6_input.c 2007/03/23 14:24:22 1.99 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.94.2.2 2007/03/12 05:59:57 rmind Exp $ */ +/* $NetBSD: ip6_input.c,v 1.99 2007/03/23 14:24:22 liamjfoy Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.94.2.2 2007/03/12 05:59:57 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.99 2007/03/23 14:24:22 liamjfoy Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -183,7 +183,7 @@ ip6_init() ip6_init2((void *)0); #ifdef GATEWAY - ip6flow_init(); + ip6flow_init(ip6_hashsize); #endif #ifdef PFIL_HOOKS @@ -1625,6 +1625,35 @@ sysctl_net_inet_ip6_maxflows(SYSCTLFN_AR return (0); } + +static int +sysctl_net_inet6_ip6_hashsize(SYSCTLFN_ARGS) +{ + int error, tmp; + struct sysctlnode node; + + node = *rnode; + tmp = ip6_hashsize; + node.sysctl_data = &tmp; + error = sysctl_lookup(SYSCTLFN_CALL(&node)); + if (error || newp == NULL) + return (error); + + if ((tmp & (tmp - 1)) == 0 && tmp != 0) { + /* + * Can only fail due to malloc() + */ + if (ip6flow_invalidate_all(tmp)) + return ENOMEM; + } else { + /* + * EINVAL if not a power of 2 + */ + return EINVAL; + } + + return (0); +} #endif /* GATEWAY */ /* @@ -1918,5 +1947,12 @@ SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, sysctl_net_inet_ip6_maxflows, 0, &ip6_maxflows, 0, CTL_NET, PF_INET6, IPPROTO_IPV6, CTL_CREATE, CTL_EOL); + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, "hashsize", + SYSCTL_DESCR("Size of hash table for fast forwarding (IPv6)"), + sysctl_net_inet6_ip6_hashsize, 0, &ip6_hashsize, 0, + CTL_NET, PF_INET6, IPPROTO_IPV6, + CTL_CREATE, CTL_EOL); #endif }