version 1.115, 2000/06/28 03:01:16 |
version 1.119, 2000/10/13 01:50:04 |
|
|
#ifdef IPSEC |
#ifdef IPSEC |
#include <netinet6/ipsec.h> |
#include <netinet6/ipsec.h> |
#include <netkey/key.h> |
#include <netkey/key.h> |
#include <netkey/key_debug.h> |
|
#endif |
#endif |
|
|
#ifndef IPFORWARDING |
#ifndef IPFORWARDING |
Line 1399 ip_forward(m, srcrt) |
|
Line 1398 ip_forward(m, srcrt) |
|
/* |
/* |
* Save at most 68 bytes of the packet in case |
* Save at most 68 bytes of the packet in case |
* we need to generate an ICMP message to the src. |
* we need to generate an ICMP message to the src. |
|
* Pullup to avoid sharing mbuf cluster between m and mcopy. |
*/ |
*/ |
mcopy = m_copy(m, 0, imin((int)ip->ip_len, 68)); |
mcopy = m_copym(m, 0, imin((int)ip->ip_len, 68), M_DONTWAIT); |
|
if (mcopy) |
|
mcopy = m_pullup(mcopy, ip->ip_hl << 2); |
|
|
/* |
/* |
* If forwarding packet using same interface that it came in on, |
* If forwarding packet using same interface that it came in on, |
Line 1666 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1668 ip_sysctl(name, namelen, oldp, oldlenp, |
|
case IPCTL_ANONPORTMIN: |
case IPCTL_ANONPORTMIN: |
old = anonportmin; |
old = anonportmin; |
error = sysctl_int(oldp, oldlenp, newp, newlen, &anonportmin); |
error = sysctl_int(oldp, oldlenp, newp, newlen, &anonportmin); |
if (anonportmin >= anonportmax || anonportmin > 65535 |
if (anonportmin >= anonportmax || anonportmin < 0 |
|
|| anonportmin > 65535 |
#ifndef IPNOPRIVPORTS |
#ifndef IPNOPRIVPORTS |
|| anonportmin < IPPORT_RESERVED |
|| anonportmin < IPPORT_RESERVED |
#endif |
#endif |
Line 1678 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1681 ip_sysctl(name, namelen, oldp, oldlenp, |
|
case IPCTL_ANONPORTMAX: |
case IPCTL_ANONPORTMAX: |
old = anonportmax; |
old = anonportmax; |
error = sysctl_int(oldp, oldlenp, newp, newlen, &anonportmax); |
error = sysctl_int(oldp, oldlenp, newp, newlen, &anonportmax); |
if (anonportmin >= anonportmax || anonportmax > 65535 |
if (anonportmin >= anonportmax || anonportmax < 0 |
|
|| anonportmax > 65535 |
#ifndef IPNOPRIVPORTS |
#ifndef IPNOPRIVPORTS |
|| anonportmax < IPPORT_RESERVED |
|| anonportmax < IPPORT_RESERVED |
#endif |
#endif |
Line 1716 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1720 ip_sysctl(name, namelen, oldp, oldlenp, |
|
&ip_gif_ttl)); |
&ip_gif_ttl)); |
#endif |
#endif |
|
|
|
#ifndef IPNOPRIVPORTS |
|
case IPCTL_LOWPORTMIN: |
|
old = lowportmin; |
|
error = sysctl_int(oldp, oldlenp, newp, newlen, &lowportmin); |
|
if (lowportmin >= lowportmax |
|
|| lowportmin > IPPORT_RESERVEDMAX |
|
|| lowportmin < IPPORT_RESERVEDMIN |
|
) { |
|
lowportmin = old; |
|
return (EINVAL); |
|
} |
|
return (error); |
|
case IPCTL_LOWPORTMAX: |
|
old = lowportmax; |
|
error = sysctl_int(oldp, oldlenp, newp, newlen, &lowportmax); |
|
if (lowportmin >= lowportmax |
|
|| lowportmax > IPPORT_RESERVEDMAX |
|
|| lowportmax < IPPORT_RESERVEDMIN |
|
) { |
|
lowportmax = old; |
|
return (EINVAL); |
|
} |
|
return (error); |
|
#endif |
|
|
default: |
default: |
return (EOPNOTSUPP); |
return (EOPNOTSUPP); |
} |
} |