| version 1.82, 2006/01/23 23:01:40 |
version 1.82.2.2, 2006/02/23 16:57:04 |
| Line 94 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| Line 94 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| |
|
| #include <netinet/in.h> |
#include <netinet/in.h> |
| #include <netinet/in_systm.h> |
#include <netinet/in_systm.h> |
| |
#include <netinet/in_pcb.h> |
| #ifdef INET |
#ifdef INET |
| #include <netinet/ip.h> |
#include <netinet/ip.h> |
| #include <netinet/ip_icmp.h> |
#include <netinet/ip_icmp.h> |
| Line 101 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| Line 102 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| #include <netinet/ip6.h> |
#include <netinet/ip6.h> |
| #include <netinet6/in6_var.h> |
#include <netinet6/in6_var.h> |
| #include <netinet6/ip6_var.h> |
#include <netinet6/ip6_var.h> |
| #include <netinet6/in6_pcb.h> |
|
| #include <netinet/icmp6.h> |
#include <netinet/icmp6.h> |
| #include <netinet6/scope6_var.h> |
#include <netinet6/scope6_var.h> |
| #include <netinet6/in6_ifattach.h> |
#include <netinet6/in6_ifattach.h> |
| Line 1009 ip6_unknown_opt(optp, m, off) |
|
| Line 1009 ip6_unknown_opt(optp, m, off) |
|
| * you are using IP6_EXTHDR_CHECK() not m_pulldown()) |
* you are using IP6_EXTHDR_CHECK() not m_pulldown()) |
| */ |
*/ |
| void |
void |
| ip6_savecontrol(in6p, mp, ip6, m) |
ip6_savecontrol(inp, mp, ip6, m) |
| struct in6pcb *in6p; |
struct inpcb *inp; |
| struct mbuf **mp; |
struct mbuf **mp; |
| struct ip6_hdr *ip6; |
struct ip6_hdr *ip6; |
| struct mbuf *m; |
struct mbuf *m; |
| { |
{ |
| |
|
| #ifdef SO_TIMESTAMP |
#ifdef SO_TIMESTAMP |
| if (in6p->in6p_socket->so_options & SO_TIMESTAMP) { |
if (inp->inp_socket->so_options & SO_TIMESTAMP) { |
| struct timeval tv; |
struct timeval tv; |
| |
|
| microtime(&tv); |
microtime(&tv); |
| Line 1027 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1027 ip6_savecontrol(in6p, mp, ip6, m) |
|
| mp = &(*mp)->m_next; |
mp = &(*mp)->m_next; |
| } |
} |
| #endif |
#endif |
| if (in6p->in6p_flags & IN6P_RECVDSTADDR) { |
if (inp->inp_flags & IN6P_RECVDSTADDR) { |
| *mp = sbcreatecontrol((caddr_t) &ip6->ip6_dst, |
*mp = sbcreatecontrol((caddr_t) &ip6->ip6_dst, |
| sizeof(struct in6_addr), IPV6_RECVDSTADDR, IPPROTO_IPV6); |
sizeof(struct in6_addr), IPV6_RECVDSTADDR, IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| Line 1036 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1036 ip6_savecontrol(in6p, mp, ip6, m) |
|
| |
|
| #ifdef noyet |
#ifdef noyet |
| /* options were tossed above */ |
/* options were tossed above */ |
| if (in6p->in6p_flags & IN6P_RECVOPTS) |
if (inp->inp_flags & IN6P_RECVOPTS) |
| /* broken */ |
/* broken */ |
| /* ip6_srcroute doesn't do what we want here, need to fix */ |
/* ip6_srcroute doesn't do what we want here, need to fix */ |
| if (in6p->in6p_flags & IPV6P_RECVRETOPTS) |
if (inp->inp_flags & IPV6P_RECVRETOPTS) |
| /* broken */ |
/* broken */ |
| #endif |
#endif |
| |
|
| /* RFC 2292 sec. 5 */ |
/* RFC 2292 sec. 5 */ |
| if ((in6p->in6p_flags & IN6P_PKTINFO) != 0) { |
if ((inp->inp_flags & IN6P_PKTINFO) != 0) { |
| struct in6_pktinfo pi6; |
struct in6_pktinfo pi6; |
| bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); |
bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); |
| in6_clearscope(&pi6.ipi6_addr); /* XXX */ |
in6_clearscope(&pi6.ipi6_addr); /* XXX */ |
| Line 1056 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1056 ip6_savecontrol(in6p, mp, ip6, m) |
|
| if (*mp) |
if (*mp) |
| mp = &(*mp)->m_next; |
mp = &(*mp)->m_next; |
| } |
} |
| if (in6p->in6p_flags & IN6P_HOPLIMIT) { |
if (inp->inp_flags & IN6P_HOPLIMIT) { |
| int hlim = ip6->ip6_hlim & 0xff; |
int hlim = ip6->ip6_hlim & 0xff; |
| *mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int), |
*mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int), |
| IPV6_HOPLIMIT, IPPROTO_IPV6); |
IPV6_HOPLIMIT, IPPROTO_IPV6); |
| Line 1072 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1072 ip6_savecontrol(in6p, mp, ip6, m) |
|
| * returned to normal user. |
* returned to normal user. |
| * See also RFC 2292 section 6. |
* See also RFC 2292 section 6. |
| */ |
*/ |
| if ((in6p->in6p_flags & IN6P_HOPOPTS) != 0) { |
if ((inp->inp_flags & IN6P_HOPOPTS) != 0) { |
| /* |
/* |
| * Check if a hop-by-hop options header is contatined in the |
* Check if a hop-by-hop options header is contatined in the |
| * received packet, and if so, store the options as ancillary |
* received packet, and if so, store the options as ancillary |
| Line 1115 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1115 ip6_savecontrol(in6p, mp, ip6, m) |
|
| } |
} |
| |
|
| /* IPV6_DSTOPTS and IPV6_RTHDR socket options */ |
/* IPV6_DSTOPTS and IPV6_RTHDR socket options */ |
| if (in6p->in6p_flags & (IN6P_DSTOPTS | IN6P_RTHDR)) { |
if (inp->inp_flags & (IN6P_DSTOPTS | IN6P_RTHDR)) { |
| struct ip6_hdr *xip6 = mtod(m, struct ip6_hdr *); |
struct ip6_hdr *xip6 = mtod(m, struct ip6_hdr *); |
| int nxt = xip6->ip6_nxt, off = sizeof(struct ip6_hdr); |
int nxt = xip6->ip6_nxt, off = sizeof(struct ip6_hdr); |
| |
|
| Line 1164 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1164 ip6_savecontrol(in6p, mp, ip6, m) |
|
| |
|
| switch (nxt) { |
switch (nxt) { |
| case IPPROTO_DSTOPTS: |
case IPPROTO_DSTOPTS: |
| if (!in6p->in6p_flags & IN6P_DSTOPTS) |
if (!inp->inp_flags & IN6P_DSTOPTS) |
| break; |
break; |
| |
|
| *mp = sbcreatecontrol((caddr_t)ip6e, elen, |
*mp = sbcreatecontrol((caddr_t)ip6e, elen, |
| Line 1174 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1174 ip6_savecontrol(in6p, mp, ip6, m) |
|
| break; |
break; |
| |
|
| case IPPROTO_ROUTING: |
case IPPROTO_ROUTING: |
| if (!in6p->in6p_flags & IN6P_RTHDR) |
if (!inp->inp_flags & IN6P_RTHDR) |
| break; |
break; |
| |
|
| *mp = sbcreatecontrol((caddr_t)ip6e, elen, |
*mp = sbcreatecontrol((caddr_t)ip6e, elen, |