| version 1.77.10.2, 2007/04/26 06:55:11 |
version 1.78, 2005/05/29 21:43:51 |
| Line 150 static struct mbuf *ip6_pullexthdr __P(( |
|
| Line 150 static struct mbuf *ip6_pullexthdr __P(( |
|
| void |
void |
| ip6_init() |
ip6_init() |
| { |
{ |
| struct ip6protosw *pr; |
const struct ip6protosw *pr; |
| int i; |
int i; |
| |
|
| pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); |
pr = (const struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); |
| if (pr == 0) |
if (pr == 0) |
| panic("ip6_init"); |
panic("ip6_init"); |
| for (i = 0; i < IPPROTO_MAX; i++) |
for (i = 0; i < IPPROTO_MAX; i++) |
| ip6_protox[i] = pr - inet6sw; |
ip6_protox[i] = pr - inet6sw; |
| for (pr = (struct ip6protosw *)inet6domain.dom_protosw; |
for (pr = (const struct ip6protosw *)inet6domain.dom_protosw; |
| pr < (struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++) |
pr < (const struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++) |
| if (pr->pr_domain->dom_family == PF_INET6 && |
if (pr->pr_domain->dom_family == PF_INET6 && |
| pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) |
pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) |
| ip6_protox[pr->pr_protocol] = pr - inet6sw; |
ip6_protox[pr->pr_protocol] = pr - inet6sw; |
| Line 1005 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1005 ip6_savecontrol(in6p, mp, ip6, m) |
|
| mp = &(*mp)->m_next; |
mp = &(*mp)->m_next; |
| } |
} |
| #endif |
#endif |
| |
|
| /* some OSes call this logic with IPv4 packet, for SO_TIMESTAMP */ |
|
| if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) |
|
| return; |
|
| |
|
| if (in6p->in6p_flags & IN6P_RECVDSTADDR) { |
if (in6p->in6p_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); |
| Line 1064 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1059 ip6_savecontrol(in6p, mp, ip6, m) |
|
| * just after the IPv6 header, which fact is assured through |
* just after the IPv6 header, which fact is assured through |
| * the IPv6 input processing. |
* the IPv6 input processing. |
| */ |
*/ |
| struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); |
struct ip6_hdr *xip6 = mtod(m, struct ip6_hdr *); |
| if (ip6->ip6_nxt == IPPROTO_HOPOPTS) { |
if (xip6->ip6_nxt == IPPROTO_HOPOPTS) { |
| struct ip6_hbh *hbh; |
struct ip6_hbh *hbh; |
| int hbhlen; |
int hbhlen; |
| struct mbuf *ext; |
struct mbuf *ext; |
| |
|
| ext = ip6_pullexthdr(m, sizeof(struct ip6_hdr), |
ext = ip6_pullexthdr(m, sizeof(struct ip6_hdr), |
| ip6->ip6_nxt); |
xip6->ip6_nxt); |
| if (ext == NULL) { |
if (ext == NULL) { |
| ip6stat.ip6s_tooshort++; |
ip6stat.ip6s_tooshort++; |
| return; |
return; |
| Line 1100 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1095 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 (in6p->in6p_flags & (IN6P_DSTOPTS | IN6P_RTHDR)) { |
| struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); |
struct ip6_hdr *xip6 = mtod(m, struct ip6_hdr *); |
| int nxt = ip6->ip6_nxt, off = sizeof(struct ip6_hdr); |
int nxt = xip6->ip6_nxt, off = sizeof(struct ip6_hdr); |
| |
|
| /* |
/* |
| * Search for destination options headers or routing |
* Search for destination options headers or routing |
| Line 1423 u_char inet6ctlerrmap[PRC_NCMDS] = { |
|
| Line 1418 u_char inet6ctlerrmap[PRC_NCMDS] = { |
|
| ENOPROTOOPT |
ENOPROTOOPT |
| }; |
}; |
| |
|
| static int |
|
| sysctl_net_inet6_ip6_rht0(SYSCTLFN_ARGS) |
|
| { |
|
| int error, tmp; |
|
| struct sysctlnode node; |
|
| |
|
| node = *rnode; |
|
| tmp = ip6_rht0; |
|
| node.sysctl_data = &tmp; |
|
| error = sysctl_lookup(SYSCTLFN_CALL(&node)); |
|
| if (error || newp == NULL) |
|
| return error; |
|
| |
|
| switch (tmp) { |
|
| case -1: /* disable processing */ |
|
| case 0: /* disable for host, enable for router */ |
|
| case 1: /* enable for all */ |
|
| break; |
|
| default: |
|
| return EINVAL; |
|
| } |
|
| ip6_rht0 = tmp; |
|
| return 0; |
|
| } |
|
| |
|
| SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, "sysctl net.inet6.ip6 subtree setup") |
SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, "sysctl net.inet6.ip6 subtree setup") |
| { |
{ |
| |
|
| Line 1610 SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, |
|
| Line 1580 SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, |
|
| CTLFLAG_PERMANENT, |
CTLFLAG_PERMANENT, |
| CTLTYPE_STRING, "kame_version", |
CTLTYPE_STRING, "kame_version", |
| SYSCTL_DESCR("KAME Version"), |
SYSCTL_DESCR("KAME Version"), |
| NULL, 0, __KAME_VERSION, 0, |
NULL, 0, __UNCONST(__KAME_VERSION), 0, |
| CTL_NET, PF_INET6, IPPROTO_IPV6, |
CTL_NET, PF_INET6, IPPROTO_IPV6, |
| IPV6CTL_KAME_VERSION, CTL_EOL); |
IPV6CTL_KAME_VERSION, CTL_EOL); |
| sysctl_createv(clog, 0, NULL, NULL, |
sysctl_createv(clog, 0, NULL, NULL, |
| Line 1677 SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, |
|
| Line 1647 SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, |
|
| NULL, 0, &ip6_maxfrags, 0, |
NULL, 0, &ip6_maxfrags, 0, |
| CTL_NET, PF_INET6, IPPROTO_IPV6, |
CTL_NET, PF_INET6, IPPROTO_IPV6, |
| IPV6CTL_MAXFRAGS, CTL_EOL); |
IPV6CTL_MAXFRAGS, CTL_EOL); |
| sysctl_createv(clog, 0, NULL, NULL, |
|
| CTLFLAG_PERMANENT|CTLFLAG_READWRITE, |
|
| CTLTYPE_INT, "rht0", |
|
| SYSCTL_DESCR("Processing of routing header type 0 (IPv6)"), |
|
| sysctl_net_inet6_ip6_rht0, 0, &ip6_rht0, 0, |
|
| CTL_NET, PF_INET6, IPPROTO_IPV6, |
|
| CTL_CREATE, CTL_EOL); |
|
| } |
} |