| version 1.114, 2000/05/10 03:31:30 |
version 1.114.4.5, 2001/04/06 00:24:47 |
| Line 459 ip_input(struct mbuf *m) |
|
| Line 459 ip_input(struct mbuf *m) |
|
| #endif |
#endif |
| |
|
| #ifdef PFIL_HOOKS |
#ifdef PFIL_HOOKS |
| |
#ifdef IPSEC |
| |
/* |
| |
* let ipfilter look at packet on the wire, |
| |
* not the decapsulated packet. |
| |
*/ |
| |
if (ipsec_gethist(m, NULL)) |
| |
goto nofilt; |
| |
#endif |
| /* |
/* |
| * Run through list of hooks for input packets. If there are any |
* Run through list of hooks for input packets. If there are any |
| * filters which require that additional packets in the flow are |
* filters which require that additional packets in the flow are |
| Line 479 ip_input(struct mbuf *m) |
|
| Line 487 ip_input(struct mbuf *m) |
|
| return; |
return; |
| ip = mtod(m, struct ip *); |
ip = mtod(m, struct ip *); |
| } |
} |
| |
#ifdef IPSEC |
| |
nofilt:; |
| |
#endif |
| #endif /* PFIL_HOOKS */ |
#endif /* PFIL_HOOKS */ |
| |
|
| /* |
/* |
|
|
| IPQ_UNLOCK(); |
IPQ_UNLOCK(); |
| } |
} |
| |
|
| |
#ifdef IPSEC |
| |
/* |
| |
* enforce IPsec policy checking if we are seeing last header. |
| |
* note that we do not visit this with protocols with pcb layer |
| |
* code - like udp/tcp/raw ip. |
| |
*/ |
| |
if ((inetsw[ip_protox[ip->ip_p]].pr_flags & PR_LASTHDR) != 0 && |
| |
ipsec4_in_reject(m, NULL)) { |
| |
ipsecstat.in_polvio++; |
| |
goto bad; |
| |
} |
| |
#endif |
| |
|
| /* |
/* |
| * Switch out to protocol's input routine. |
* Switch out to protocol's input routine. |
| */ |
*/ |
| Line 1398 ip_forward(m, srcrt) |
|
| Line 1422 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 1436 ip_forward(m, srcrt) |
|
| Line 1463 ip_forward(m, srcrt) |
|
| |
|
| #ifdef IPSEC |
#ifdef IPSEC |
| /* Don't lookup socket in forwading case */ |
/* Don't lookup socket in forwading case */ |
| ipsec_setsocket(m, NULL); |
(void)ipsec_setsocket(m, NULL); |
| #endif |
#endif |
| error = ip_output(m, (struct mbuf *)0, &ipforward_rt, |
error = ip_output(m, (struct mbuf *)0, &ipforward_rt, |
| (IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)), 0); |
(IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)), 0); |
| Line 1665 ip_sysctl(name, namelen, oldp, oldlenp, |
|
| Line 1692 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 1677 ip_sysctl(name, namelen, oldp, oldlenp, |
|
| Line 1705 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 1715 ip_sysctl(name, namelen, oldp, oldlenp, |
|
| Line 1744 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); |
| } |
} |