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 retrieving revision 1.25 retrieving revision 1.26 diff -u -p -r1.25 -r1.26 --- src/sys/netinet6/ip6_input.c 2000/07/06 12:36:19 1.25 +++ src/sys/netinet6/ip6_input.c 2000/08/26 11:03:46 1.26 @@ -1,5 +1,5 @@ -/* $NetBSD: ip6_input.c,v 1.25 2000/07/06 12:36:19 itojun Exp $ */ -/* $KAME: ip6_input.c,v 1.95 2000/07/02 07:49:37 jinmei Exp $ */ +/* $NetBSD: ip6_input.c,v 1.26 2000/08/26 11:03:46 itojun Exp $ */ +/* $KAME: ip6_input.c,v 1.119 2000/08/26 10:00:45 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -1365,6 +1365,8 @@ ip6_sysctl(name, namelen, oldp, oldlenp, void *newp; size_t newlen; { + int old, error; + /* All sysctl names at this level are terminal. */ if (namelen != 1) return ENOTDIR; @@ -1416,6 +1418,58 @@ ip6_sysctl(name, namelen, oldp, oldlenp, return sysctl_int(oldp, oldlenp, newp, newlen, &ip6_bindv6only); #endif + case IPV6CTL_ANONPORTMIN: + old = ip6_anonportmin; + error = sysctl_int(oldp, oldlenp, newp, newlen, + &ip6_anonportmin); + if (ip6_anonportmin >= ip6_anonportmax || ip6_anonportmin < 0 || + ip6_anonportmin > 65535 +#ifndef IPNOPRIVPORTS + || ip6_anonportmin < IPV6PORT_RESERVED +#endif + ) { + ip6_anonportmin = old; + return (EINVAL); + } + return (error); + case IPV6CTL_ANONPORTMAX: + old = ip6_anonportmax; + error = sysctl_int(oldp, oldlenp, newp, newlen, + &ip6_anonportmax); + if (ip6_anonportmin >= ip6_anonportmax || ip6_anonportmax < 0 || + ip6_anonportmax > 65535 +#ifndef IPNOPRIVPORTS + || ip6_anonportmax < IPV6PORT_RESERVED +#endif + ) { + ip6_anonportmax = old; + return (EINVAL); + } + return (error); +#ifndef IPNOPRIVPORTS + case IPV6CTL_LOWPORTMIN: + old = ip6_lowportmin; + error = sysctl_int(oldp, oldlenp, newp, newlen, + &ip6_lowportmin); + if (ip6_lowportmin >= ip6_lowportmax || + ip6_lowportmin > IPV6PORT_RESERVEDMAX || + ip6_lowportmin < IPV6PORT_RESERVEDMIN) { + ip6_lowportmin = old; + return (EINVAL); + } + return (error); + case IPV6CTL_LOWPORTMAX: + old = ip6_lowportmax; + error = sysctl_int(oldp, oldlenp, newp, newlen, + &ip6_lowportmax); + if (ip6_lowportmin >= ip6_lowportmax || + ip6_lowportmax > IPV6PORT_RESERVEDMAX || + ip6_lowportmax < IPV6PORT_RESERVEDMIN) { + ip6_lowportmax = old; + return (EINVAL); + } + return (error); +#endif default: return EOPNOTSUPP; }