version 1.249, 2007/05/02 20:40:25 |
version 1.254.4.2, 2007/12/08 18:21:13 |
|
|
splx(s); |
splx(s); |
if (m == 0) |
if (m == 0) |
return; |
return; |
MCLAIM(m, &ip_rx_mowner); |
|
ip_input(m); |
ip_input(m); |
} |
} |
} |
} |
|
|
*/ |
*/ |
IPQ_LOCK(); |
IPQ_LOCK(); |
hash = IPREASS_HASH(ip->ip_src.s_addr, ip->ip_id); |
hash = IPREASS_HASH(ip->ip_src.s_addr, ip->ip_id); |
/* XXX LIST_FOREACH(fp, &ipq[hash], ipq_q) */ |
LIST_FOREACH(fp, &ipq[hash], ipq_q) { |
for (fp = LIST_FIRST(&ipq[hash]); fp != NULL; |
|
fp = LIST_NEXT(fp, ipq_q)) { |
|
if (ip->ip_id == fp->ipq_id && |
if (ip->ip_id == fp->ipq_id && |
in_hosteq(ip->ip_src, fp->ipq_src) && |
in_hosteq(ip->ip_src, fp->ipq_src) && |
in_hosteq(ip->ip_dst, fp->ipq_dst) && |
in_hosteq(ip->ip_dst, fp->ipq_dst) && |
|
|
/* XXX error stat??? */ |
/* XXX error stat??? */ |
error = EINVAL; |
error = EINVAL; |
DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/ |
DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/ |
goto bad; |
|
} |
} |
splx(s); |
splx(s); |
if (error) |
if (error) |
Line 1779 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 1895 ip_forward(struct mbuf *m, int srcrt) |
|
Line 1868 ip_forward(struct mbuf *m, int srcrt) |
|
*/ |
*/ |
if (rt->rt_ifp == m->m_pkthdr.rcvif && |
if (rt->rt_ifp == m->m_pkthdr.rcvif && |
(rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && |
(rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && |
!in_nullhost(satosin(rt_key(rt))->sin_addr) && |
!in_nullhost(satocsin(rt_getkey(rt))->sin_addr) && |
ipsendredirects && !srcrt) { |
ipsendredirects && !srcrt) { |
if (rt->rt_ifa && |
if (rt->rt_ifa && |
(ip->ip_src.s_addr & ifatoia(rt->rt_ifa)->ia_subnetmask) == |
(ip->ip_src.s_addr & ifatoia(rt->rt_ifa)->ia_subnetmask) == |
Line 2081 ip_savecontrol(struct inpcb *inp, struct |
|
Line 2054 ip_savecontrol(struct inpcb *inp, struct |
|
if (inp->inp_flags & INP_RECVIF) { |
if (inp->inp_flags & INP_RECVIF) { |
struct sockaddr_dl sdl; |
struct sockaddr_dl sdl; |
|
|
sdl.sdl_len = offsetof(struct sockaddr_dl, sdl_data[0]); |
sockaddr_dl_init(&sdl, sizeof(sdl), |
sdl.sdl_family = AF_LINK; |
(m->m_pkthdr.rcvif != NULL) |
sdl.sdl_index = m->m_pkthdr.rcvif ? |
? m->m_pkthdr.rcvif->if_index |
m->m_pkthdr.rcvif->if_index : 0; |
: 0, |
sdl.sdl_nlen = sdl.sdl_alen = sdl.sdl_slen = 0; |
0, NULL, 0, NULL, 0); |
*mp = sbcreatecontrol((void *) &sdl, sdl.sdl_len, |
*mp = sbcreatecontrol(&sdl, sdl.sdl_len, IP_RECVIF, IPPROTO_IP); |
IP_RECVIF, IPPROTO_IP); |
|
if (*mp) |
if (*mp) |
mp = &(*mp)->m_next; |
mp = &(*mp)->m_next; |
} |
} |