| version 1.22.2.1, 2000/07/03 22:48:19 |
version 1.22.2.2, 2000/08/27 01:25:08 |
|
|
| /* $NetBSD$ */ |
/* $NetBSD$ */ |
| /* $KAME: ip6_input.c,v 1.95 2000/07/02 07:49:37 jinmei 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. |
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
| Line 1346 ip6_sysctl(name, namelen, oldp, oldlenp, |
|
| Line 1346 ip6_sysctl(name, namelen, oldp, oldlenp, |
|
| void *newp; |
void *newp; |
| size_t newlen; |
size_t newlen; |
| { |
{ |
| |
int old, error; |
| |
|
| /* All sysctl names at this level are terminal. */ |
/* All sysctl names at this level are terminal. */ |
| if (namelen != 1) |
if (namelen != 1) |
| return ENOTDIR; |
return ENOTDIR; |
| Line 1397 ip6_sysctl(name, namelen, oldp, oldlenp, |
|
| Line 1399 ip6_sysctl(name, namelen, oldp, oldlenp, |
|
| return sysctl_int(oldp, oldlenp, newp, newlen, |
return sysctl_int(oldp, oldlenp, newp, newlen, |
| &ip6_bindv6only); |
&ip6_bindv6only); |
| #endif |
#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: |
default: |
| return EOPNOTSUPP; |
return EOPNOTSUPP; |
| } |
} |