| version 1.96, 2007/02/22 08:39:27 |
version 1.97, 2007/03/04 06:03:26 |
| Line 298 ip6_input(struct mbuf *m) |
|
| Line 298 ip6_input(struct mbuf *m) |
|
| * it. Otherwise, if it is aligned, make sure the entire base |
* it. Otherwise, if it is aligned, make sure the entire base |
| * IPv6 header is in the first mbuf of the chain. |
* IPv6 header is in the first mbuf of the chain. |
| */ |
*/ |
| if (IP6_HDR_ALIGNED_P(mtod(m, caddr_t)) == 0) { |
if (IP6_HDR_ALIGNED_P(mtod(m, void *)) == 0) { |
| struct ifnet *inifp = m->m_pkthdr.rcvif; |
struct ifnet *inifp = m->m_pkthdr.rcvif; |
| if ((m = m_copyup(m, sizeof(struct ip6_hdr), |
if ((m = m_copyup(m, sizeof(struct ip6_hdr), |
| (max_linkhdr + 3) & ~3)) == NULL) { |
(max_linkhdr + 3) & ~3)) == NULL) { |
| Line 639 ip6_input(struct mbuf *m) |
|
| Line 639 ip6_input(struct mbuf *m) |
|
| in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); |
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); |
| icmp6_error(m, ICMP6_PARAM_PROB, |
icmp6_error(m, ICMP6_PARAM_PROB, |
| ICMP6_PARAMPROB_HEADER, |
ICMP6_PARAMPROB_HEADER, |
| (caddr_t)&ip6->ip6_plen - (caddr_t)ip6); |
(char *)&ip6->ip6_plen - (char *)ip6); |
| return; |
return; |
| } |
} |
| IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), |
IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), |
| Line 936 ip6_process_hopopts(m, opthead, hbhlen, |
|
| Line 936 ip6_process_hopopts(m, opthead, hbhlen, |
|
| return (-1); |
return (-1); |
| } |
} |
| optlen = IP6OPT_RTALERT_LEN; |
optlen = IP6OPT_RTALERT_LEN; |
| bcopy((caddr_t)(opt + 2), (caddr_t)&rtalert_val, 2); |
bcopy((void *)(opt + 2), (void *)&rtalert_val, 2); |
| *rtalertp = ntohs(rtalert_val); |
*rtalertp = ntohs(rtalert_val); |
| break; |
break; |
| case IP6OPT_JUMBO: |
case IP6OPT_JUMBO: |
| Line 1095 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1095 ip6_savecontrol(in6p, mp, ip6, m) |
|
| struct timeval tv; |
struct timeval tv; |
| |
|
| microtime(&tv); |
microtime(&tv); |
| *mp = sbcreatecontrol((caddr_t) &tv, sizeof(tv), |
*mp = sbcreatecontrol((void *) &tv, sizeof(tv), |
| SCM_TIMESTAMP, SOL_SOCKET); |
SCM_TIMESTAMP, SOL_SOCKET); |
| if (*mp) |
if (*mp) |
| mp = &(*mp)->m_next; |
mp = &(*mp)->m_next; |
| Line 1114 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1114 ip6_savecontrol(in6p, mp, ip6, m) |
|
| in6_clearscope(&pi6.ipi6_addr); /* XXX */ |
in6_clearscope(&pi6.ipi6_addr); /* XXX */ |
| pi6.ipi6_ifindex = m->m_pkthdr.rcvif ? |
pi6.ipi6_ifindex = m->m_pkthdr.rcvif ? |
| m->m_pkthdr.rcvif->if_index : 0; |
m->m_pkthdr.rcvif->if_index : 0; |
| *mp = sbcreatecontrol((caddr_t) &pi6, |
*mp = sbcreatecontrol((void *) &pi6, |
| sizeof(struct in6_pktinfo), |
sizeof(struct in6_pktinfo), |
| IS2292(IPV6_2292PKTINFO, IPV6_PKTINFO), IPPROTO_IPV6); |
IS2292(IPV6_2292PKTINFO, IPV6_PKTINFO), IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| Line 1124 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1124 ip6_savecontrol(in6p, mp, ip6, m) |
|
| if (in6p->in6p_flags & IN6P_HOPLIMIT) { |
if (in6p->in6p_flags & IN6P_HOPLIMIT) { |
| int hlim = ip6->ip6_hlim & 0xff; |
int hlim = ip6->ip6_hlim & 0xff; |
| |
|
| *mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int), |
*mp = sbcreatecontrol((void *) &hlim, sizeof(int), |
| IS2292(IPV6_2292HOPLIMIT, IPV6_HOPLIMIT), IPPROTO_IPV6); |
IS2292(IPV6_2292HOPLIMIT, IPV6_HOPLIMIT), IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| mp = &(*mp)->m_next; |
mp = &(*mp)->m_next; |
| Line 1138 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1138 ip6_savecontrol(in6p, mp, ip6, m) |
|
| flowinfo >>= 20; |
flowinfo >>= 20; |
| |
|
| tclass = flowinfo & 0xff; |
tclass = flowinfo & 0xff; |
| *mp = sbcreatecontrol((caddr_t)&tclass, sizeof(tclass), |
*mp = sbcreatecontrol((void *)&tclass, sizeof(tclass), |
| IPV6_TCLASS, IPPROTO_IPV6); |
IPV6_TCLASS, IPPROTO_IPV6); |
| |
|
| if (*mp) |
if (*mp) |
| Line 1186 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1186 ip6_savecontrol(in6p, mp, ip6, m) |
|
| * be removed before returning in the RFC 2292. |
* be removed before returning in the RFC 2292. |
| * Note: this constraint is removed in RFC3542. |
* Note: this constraint is removed in RFC3542. |
| */ |
*/ |
| *mp = sbcreatecontrol((caddr_t)hbh, hbhlen, |
*mp = sbcreatecontrol((void *)hbh, hbhlen, |
| IS2292(IPV6_2292HOPOPTS, IPV6_HOPOPTS), |
IS2292(IPV6_2292HOPOPTS, IPV6_HOPOPTS), |
| IPPROTO_IPV6); |
IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| Line 1248 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1248 ip6_savecontrol(in6p, mp, ip6, m) |
|
| if (!in6p->in6p_flags & IN6P_DSTOPTS) |
if (!in6p->in6p_flags & IN6P_DSTOPTS) |
| break; |
break; |
| |
|
| *mp = sbcreatecontrol((caddr_t)ip6e, elen, |
*mp = sbcreatecontrol((void *)ip6e, elen, |
| IS2292(IPV6_2292DSTOPTS, IPV6_DSTOPTS), |
IS2292(IPV6_2292DSTOPTS, IPV6_DSTOPTS), |
| IPPROTO_IPV6); |
IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| Line 1259 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1259 ip6_savecontrol(in6p, mp, ip6, m) |
|
| if (!in6p->in6p_flags & IN6P_RTHDR) |
if (!in6p->in6p_flags & IN6P_RTHDR) |
| break; |
break; |
| |
|
| *mp = sbcreatecontrol((caddr_t)ip6e, elen, |
*mp = sbcreatecontrol((void *)ip6e, elen, |
| IS2292(IPV6_2292RTHDR, IPV6_RTHDR), |
IS2292(IPV6_2292RTHDR, IPV6_RTHDR), |
| IPPROTO_IPV6); |
IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| Line 1320 ip6_notify_pmtu(struct in6pcb *in6p, con |
|
| Line 1320 ip6_notify_pmtu(struct in6pcb *in6p, con |
|
| if (sa6_recoverscope(&mtuctl.ip6m_addr)) |
if (sa6_recoverscope(&mtuctl.ip6m_addr)) |
| return; |
return; |
| |
|
| if ((m_mtu = sbcreatecontrol((caddr_t)&mtuctl, sizeof(mtuctl), |
if ((m_mtu = sbcreatecontrol((void *)&mtuctl, sizeof(mtuctl), |
| IPV6_PATHMTU, IPPROTO_IPV6)) == NULL) |
IPV6_PATHMTU, IPPROTO_IPV6)) == NULL) |
| return; |
return; |
| |
|
| Line 1360 ip6_pullexthdr(m, off, nxt) |
|
| Line 1360 ip6_pullexthdr(m, off, nxt) |
|
| } |
} |
| #endif |
#endif |
| |
|
| m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e); |
m_copydata(m, off, sizeof(ip6e), (void *)&ip6e); |
| if (nxt == IPPROTO_AH) |
if (nxt == IPPROTO_AH) |
| elen = (ip6e.ip6e_len + 2) << 2; |
elen = (ip6e.ip6e_len + 2) << 2; |
| else |
else |
| Line 1383 ip6_pullexthdr(m, off, nxt) |
|
| Line 1383 ip6_pullexthdr(m, off, nxt) |
|
| return NULL; |
return NULL; |
| } |
} |
| |
|
| m_copydata(m, off, elen, mtod(n, caddr_t)); |
m_copydata(m, off, elen, mtod(n, void *)); |
| n->m_len = elen; |
n->m_len = elen; |
| return n; |
return n; |
| } |
} |
| Line 1416 ip6_get_prevhdr(m, off) |
|
| Line 1416 ip6_get_prevhdr(m, off) |
|
| nxt = ip6->ip6_nxt; |
nxt = ip6->ip6_nxt; |
| len = sizeof(struct ip6_hdr); |
len = sizeof(struct ip6_hdr); |
| while (len < off) { |
while (len < off) { |
| ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + len); |
ip6e = (struct ip6_ext *)(mtod(m, char *) + len); |
| |
|
| switch (nxt) { |
switch (nxt) { |
| case IPPROTO_FRAGMENT: |
case IPPROTO_FRAGMENT: |
| Line 1465 ip6_nexthdr(m, off, proto, nxtp) |
|
| Line 1465 ip6_nexthdr(m, off, proto, nxtp) |
|
| return -1; |
return -1; |
| if (m->m_pkthdr.len < off + sizeof(ip6)) |
if (m->m_pkthdr.len < off + sizeof(ip6)) |
| return -1; |
return -1; |
| m_copydata(m, off, sizeof(ip6), (caddr_t)&ip6); |
m_copydata(m, off, sizeof(ip6), (void *)&ip6); |
| if (nxtp) |
if (nxtp) |
| *nxtp = ip6.ip6_nxt; |
*nxtp = ip6.ip6_nxt; |
| off += sizeof(ip6); |
off += sizeof(ip6); |
| Line 1478 ip6_nexthdr(m, off, proto, nxtp) |
|
| Line 1478 ip6_nexthdr(m, off, proto, nxtp) |
|
| */ |
*/ |
| if (m->m_pkthdr.len < off + sizeof(fh)) |
if (m->m_pkthdr.len < off + sizeof(fh)) |
| return -1; |
return -1; |
| m_copydata(m, off, sizeof(fh), (caddr_t)&fh); |
m_copydata(m, off, sizeof(fh), (void *)&fh); |
| if ((fh.ip6f_offlg & IP6F_OFF_MASK) != 0) |
if ((fh.ip6f_offlg & IP6F_OFF_MASK) != 0) |
| return -1; |
return -1; |
| if (nxtp) |
if (nxtp) |
| Line 1489 ip6_nexthdr(m, off, proto, nxtp) |
|
| Line 1489 ip6_nexthdr(m, off, proto, nxtp) |
|
| case IPPROTO_AH: |
case IPPROTO_AH: |
| if (m->m_pkthdr.len < off + sizeof(ip6e)) |
if (m->m_pkthdr.len < off + sizeof(ip6e)) |
| return -1; |
return -1; |
| m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e); |
m_copydata(m, off, sizeof(ip6e), (void *)&ip6e); |
| if (nxtp) |
if (nxtp) |
| *nxtp = ip6e.ip6e_nxt; |
*nxtp = ip6e.ip6e_nxt; |
| off += (ip6e.ip6e_len + 2) << 2; |
off += (ip6e.ip6e_len + 2) << 2; |
| Line 1502 ip6_nexthdr(m, off, proto, nxtp) |
|
| Line 1502 ip6_nexthdr(m, off, proto, nxtp) |
|
| case IPPROTO_DSTOPTS: |
case IPPROTO_DSTOPTS: |
| if (m->m_pkthdr.len < off + sizeof(ip6e)) |
if (m->m_pkthdr.len < off + sizeof(ip6e)) |
| return -1; |
return -1; |
| m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e); |
m_copydata(m, off, sizeof(ip6e), (void *)&ip6e); |
| if (nxtp) |
if (nxtp) |
| *nxtp = ip6e.ip6e_nxt; |
*nxtp = ip6e.ip6e_nxt; |
| off += (ip6e.ip6e_len + 1) << 3; |
off += (ip6e.ip6e_len + 1) << 3; |