version 1.253, 2007/09/11 14:18:09 |
version 1.257, 2007/12/20 19:53:32 |
|
|
splx(s); |
splx(s); |
if (m == 0) |
if (m == 0) |
return; |
return; |
MCLAIM(m, &ip_rx_mowner); |
|
ip_input(m); |
ip_input(m); |
} |
} |
} |
} |
Line 1776 ip_srcroute(void) |
|
Line 1775 ip_srcroute(void) |
|
return (m); |
return (m); |
} |
} |
|
|
/* |
|
* Strip out IP options, at higher |
|
* level protocol in the kernel. |
|
* Second argument is buffer to which options |
|
* will be moved, and return value is their length. |
|
* XXX should be deleted; last arg currently ignored. |
|
*/ |
|
void |
|
ip_stripoptions(struct mbuf *m, struct mbuf *mopt) |
|
{ |
|
int i; |
|
struct ip *ip = mtod(m, struct ip *); |
|
void *opts; |
|
int olen; |
|
|
|
olen = (ip->ip_hl << 2) - sizeof (struct ip); |
|
opts = (void *)(ip + 1); |
|
i = m->m_len - (sizeof (struct ip) + olen); |
|
memmove(opts, (char *)opts + olen, (unsigned)i); |
|
m->m_len -= olen; |
|
if (m->m_flags & M_PKTHDR) |
|
m->m_pkthdr.len -= olen; |
|
ip->ip_len = htons(ntohs(ip->ip_len) - olen); |
|
ip->ip_hl = sizeof (struct ip) >> 2; |
|
} |
|
|
|
const int inetctlerrmap[PRC_NCMDS] = { |
const int inetctlerrmap[PRC_NCMDS] = { |
0, 0, 0, 0, |
[PRC_MSGSIZE] = EMSGSIZE, |
0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, |
[PRC_HOSTDEAD] = EHOSTDOWN, |
EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, |
[PRC_HOSTUNREACH] = EHOSTUNREACH, |
EMSGSIZE, EHOSTUNREACH, 0, 0, |
[PRC_UNREACH_NET] = EHOSTUNREACH, |
0, 0, 0, 0, |
[PRC_UNREACH_HOST] = EHOSTUNREACH, |
ENOPROTOOPT |
[PRC_UNREACH_PROTOCOL] = ECONNREFUSED, |
|
[PRC_UNREACH_PORT] = ECONNREFUSED, |
|
[PRC_UNREACH_SRCFAIL] = EHOSTUNREACH, |
|
[PRC_PARAMPROB] = ENOPROTOOPT, |
}; |
}; |
|
|
/* |
/* |
Line 1958 ip_forward(struct mbuf *m, int srcrt) |
|
Line 1934 ip_forward(struct mbuf *m, int srcrt) |
|
type = ICMP_UNREACH; |
type = ICMP_UNREACH; |
code = ICMP_UNREACH_NEEDFRAG; |
code = ICMP_UNREACH_NEEDFRAG; |
#if !defined(IPSEC) && !defined(FAST_IPSEC) |
#if !defined(IPSEC) && !defined(FAST_IPSEC) |
if (ipforward_rt.ro_rt != NULL) |
if ((rt = rtcache_getrt(&ipforward_rt)) != NULL) |
destmtu = ipforward_rt.ro_rt->rt_ifp->if_mtu; |
destmtu = rt->rt_ifp->if_mtu; |
#else |
#else |
/* |
/* |
* If the packet is routed over IPsec tunnel, tell the |
* If the packet is routed over IPsec tunnel, tell the |
Line 1967 ip_forward(struct mbuf *m, int srcrt) |
|
Line 1943 ip_forward(struct mbuf *m, int srcrt) |
|
* tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz |
* tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz |
* XXX quickhack!!! |
* XXX quickhack!!! |
*/ |
*/ |
if (ipforward_rt.ro_rt != NULL) { |
if ((rt = rtcache_getrt(&ipforward_rt)) != NULL) { |
struct secpolicy *sp; |
struct secpolicy *sp; |
int ipsecerror; |
int ipsecerror; |
size_t ipsechdr; |
size_t ipsechdr; |
Line 1978 ip_forward(struct mbuf *m, int srcrt) |
|
Line 1954 ip_forward(struct mbuf *m, int srcrt) |
|
&ipsecerror); |
&ipsecerror); |
|
|
if (sp == NULL) |
if (sp == NULL) |
destmtu = ipforward_rt.ro_rt->rt_ifp->if_mtu; |
destmtu = rt->rt_ifp->if_mtu; |
else { |
else { |
/* count IPsec header size */ |
/* count IPsec header size */ |
ipsechdr = ipsec4_hdrsiz(mcopy, |
ipsechdr = ipsec4_hdrsiz(mcopy, |
Line 1993 ip_forward(struct mbuf *m, int srcrt) |
|
Line 1969 ip_forward(struct mbuf *m, int srcrt) |
|
&& sp->req->sav != NULL |
&& sp->req->sav != NULL |
&& sp->req->sav->sah != NULL) { |
&& sp->req->sav->sah != NULL) { |
ro = &sp->req->sav->sah->sa_route; |
ro = &sp->req->sav->sah->sa_route; |
if (ro->ro_rt && ro->ro_rt->rt_ifp) { |
if (rt && rt->rt_ifp) { |
destmtu = |
destmtu = |
ro->ro_rt->rt_rmx.rmx_mtu ? |
rt->rt_rmx.rmx_mtu ? |
ro->ro_rt->rt_rmx.rmx_mtu : |
rt->rt_rmx.rmx_mtu : |
ro->ro_rt->rt_ifp->if_mtu; |
rt->rt_ifp->if_mtu; |
destmtu -= ipsechdr; |
destmtu -= ipsechdr; |
} |
} |
} |
} |