| version 1.94.2.5, 2007/05/17 13:41:51 |
version 1.95, 2007/02/17 22:34:13 |
|
|
| ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; |
ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; |
| |
|
| ip6_init2((void *)0); |
ip6_init2((void *)0); |
| #ifdef GATEWAY |
|
| ip6flow_init(ip6_hashsize); |
|
| #endif |
|
| |
|
| #ifdef PFIL_HOOKS |
#ifdef PFIL_HOOKS |
| /* Register our Packet Filter hook. */ |
/* Register our Packet Filter hook. */ |
|
|
| } |
} |
| } |
} |
| |
|
| extern struct route ip6_forward_rt; |
extern struct route_in6 ip6_forward_rt; |
| |
|
| void |
void |
| ip6_input(struct mbuf *m) |
ip6_input(m) |
| |
struct mbuf *m; |
| { |
{ |
| struct ip6_hdr *ip6; |
struct ip6_hdr *ip6; |
| int hit, off = sizeof(struct ip6_hdr), nest; |
int off = sizeof(struct ip6_hdr), nest; |
| u_int32_t plen; |
u_int32_t plen; |
| u_int32_t rtalert = ~0; |
u_int32_t rtalert = ~0; |
| int nxt, ours = 0, rh_present = 0; |
int nxt, ours = 0; |
| struct ifnet *deliverifp = NULL; |
struct ifnet *deliverifp = NULL; |
| int srcrt = 0; |
int srcrt = 0; |
| const struct rtentry *rt; |
|
| union { |
|
| struct sockaddr dst; |
|
| struct sockaddr_in6 dst6; |
|
| } u; |
|
| #ifdef FAST_IPSEC |
#ifdef FAST_IPSEC |
| struct m_tag *mtag; |
struct m_tag *mtag; |
| struct tdb_ident *tdbi; |
struct tdb_ident *tdbi; |
| Line 284 ip6_input(struct mbuf *m) |
|
| Line 277 ip6_input(struct mbuf *m) |
|
| else |
else |
| ip6stat.ip6s_mext1++; |
ip6stat.ip6s_mext1++; |
| } else { |
} else { |
| #define M2MMAX __arraycount(ip6stat.ip6s_m2m) |
#define M2MMAX (sizeof(ip6stat.ip6s_m2m)/sizeof(ip6stat.ip6s_m2m[0])) |
| if (m->m_next) { |
if (m->m_next) { |
| if (m->m_flags & M_LOOP) { |
if (m->m_flags & M_LOOP) { |
| ip6stat.ip6s_m2m[lo0ifp->if_index]++; /* XXX */ |
ip6stat.ip6s_m2m[lo0ifp->if_index]++; /* XXX */ |
| Line 306 ip6_input(struct mbuf *m) |
|
| Line 299 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, void *)) == 0) { |
if (IP6_HDR_ALIGNED_P(mtod(m, caddr_t)) == 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 332 ip6_input(struct mbuf *m) |
|
| Line 325 ip6_input(struct mbuf *m) |
|
| goto bad; |
goto bad; |
| } |
} |
| |
|
| #if defined(IPSEC) |
|
| /* IPv6 fast forwarding is not compatible with IPsec. */ |
|
| m->m_flags &= ~M_CANFASTFWD; |
|
| #else |
|
| /* |
|
| * Assume that we can create a fast-forward IP flow entry |
|
| * based on this packet. |
|
| */ |
|
| m->m_flags |= M_CANFASTFWD; |
|
| #endif |
|
| |
|
| #ifdef PFIL_HOOKS |
#ifdef PFIL_HOOKS |
| /* |
/* |
| * Run through list of hooks for input packets. If there are any |
* Run through list of hooks for input packets. If there are any |
| Line 479 ip6_input(struct mbuf *m) |
|
| Line 461 ip6_input(struct mbuf *m) |
|
| goto hbhcheck; |
goto hbhcheck; |
| } |
} |
| |
|
| sockaddr_in6_init(&u.dst6, &ip6->ip6_dst, 0, 0, 0); |
|
| |
|
| /* |
/* |
| * Unicast check |
* Unicast check |
| */ |
*/ |
| rt = rtcache_lookup2(&ip6_forward_rt, &u.dst, 1, &hit); |
if (!IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, |
| if (hit) |
&((const struct sockaddr_in6 *)rtcache_getdst((const struct route *)&ip6_forward_rt))->sin6_addr)) |
| ip6stat.ip6s_forward_cachehit++; |
rtcache_free((struct route *)&ip6_forward_rt); |
| else |
else |
| |
rtcache_check((struct route *)&ip6_forward_rt); |
| |
if (ip6_forward_rt.ro_rt != NULL) { |
| |
/* XXX Revalidated route is accounted wrongly. */ |
| |
ip6stat.ip6s_forward_cachehit++; |
| |
} else { |
| |
struct sockaddr_in6 *dst6; |
| |
|
| ip6stat.ip6s_forward_cachemiss++; |
ip6stat.ip6s_forward_cachemiss++; |
| |
|
| |
dst6 = &ip6_forward_rt.ro_dst; |
| |
memset(dst6, 0, sizeof(*dst6)); |
| |
dst6->sin6_len = sizeof(struct sockaddr_in6); |
| |
dst6->sin6_family = AF_INET6; |
| |
dst6->sin6_addr = ip6->ip6_dst; |
| |
|
| |
rtcache_init((struct route *)&ip6_forward_rt); |
| |
} |
| |
|
| #define rt6_key(r) ((struct sockaddr_in6 *)((r)->rt_nodes->rn_key)) |
#define rt6_key(r) ((struct sockaddr_in6 *)((r)->rt_nodes->rn_key)) |
| |
|
| /* |
/* |
| Line 501 ip6_input(struct mbuf *m) |
|
| Line 497 ip6_input(struct mbuf *m) |
|
| * But we think it's even useful in some situations, e.g. when using |
* But we think it's even useful in some situations, e.g. when using |
| * a special daemon which wants to intercept the packet. |
* a special daemon which wants to intercept the packet. |
| */ |
*/ |
| if (rt != NULL && |
if (ip6_forward_rt.ro_rt != NULL && |
| (rt->rt_flags & (RTF_HOST|RTF_GATEWAY)) == RTF_HOST && |
(ip6_forward_rt.ro_rt->rt_flags & |
| !(rt->rt_flags & RTF_CLONED) && |
(RTF_HOST|RTF_GATEWAY)) == RTF_HOST && |
| |
!(ip6_forward_rt.ro_rt->rt_flags & RTF_CLONED) && |
| #if 0 |
#if 0 |
| /* |
/* |
| * The check below is redundant since the comparison of |
* The check below is redundant since the comparison of |
| * the destination and the key of the rtentry has |
* the destination and the key of the rtentry has |
| * already done through looking up the routing table. |
* already done through looking up the routing table. |
| */ |
*/ |
| IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &rt6_key(rt)->sin6_addr) && |
IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, |
| |
&rt6_key(ip6_forward_rt.ro_rt)->sin6_addr) && |
| #endif |
#endif |
| rt->rt_ifp->if_type == IFT_LOOP) { |
ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_LOOP) { |
| struct in6_ifaddr *ia6 = (struct in6_ifaddr *)rt->rt_ifa; |
struct in6_ifaddr *ia6 = |
| |
(struct in6_ifaddr *)ip6_forward_rt.ro_rt->rt_ifa; |
| if (ia6->ia6_flags & IN6_IFF_ANYCAST) |
if (ia6->ia6_flags & IN6_IFF_ANYCAST) |
| m->m_flags |= M_ANYCAST6; |
m->m_flags |= M_ANYCAST6; |
| /* |
/* |
| Line 541 ip6_input(struct mbuf *m) |
|
| Line 540 ip6_input(struct mbuf *m) |
|
| */ |
*/ |
| #if defined(NFAITH) && 0 < NFAITH |
#if defined(NFAITH) && 0 < NFAITH |
| if (ip6_keepfaith) { |
if (ip6_keepfaith) { |
| if (rt != NULL && rt->rt_ifp != NULL && |
if (ip6_forward_rt.ro_rt != NULL && |
| rt->rt_ifp->if_type == IFT_FAITH) { |
ip6_forward_rt.ro_rt->rt_ifp != NULL && |
| |
ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) { |
| /* XXX do we need more sanity checks? */ |
/* XXX do we need more sanity checks? */ |
| ours = 1; |
ours = 1; |
| deliverifp = rt->rt_ifp; /* faith */ |
deliverifp = ip6_forward_rt.ro_rt->rt_ifp; /* faith */ |
| goto hbhcheck; |
goto hbhcheck; |
| } |
} |
| } |
} |
| Line 640 ip6_input(struct mbuf *m) |
|
| Line 640 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, |
| (char *)&ip6->ip6_plen - (char *)ip6); |
(caddr_t)&ip6->ip6_plen - (caddr_t)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 739 ip6_input(struct mbuf *m) |
|
| Line 739 ip6_input(struct mbuf *m) |
|
| in6_ifstat_inc(deliverifp, ifs6_in_deliver); |
in6_ifstat_inc(deliverifp, ifs6_in_deliver); |
| nest = 0; |
nest = 0; |
| |
|
| rh_present = 0; |
|
| while (nxt != IPPROTO_DONE) { |
while (nxt != IPPROTO_DONE) { |
| if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) { |
if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) { |
| ip6stat.ip6s_toomanyhdr++; |
ip6stat.ip6s_toomanyhdr++; |
| in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); |
|
| goto bad; |
goto bad; |
| } |
} |
| |
|
| Line 757 ip6_input(struct mbuf *m) |
|
| Line 755 ip6_input(struct mbuf *m) |
|
| goto bad; |
goto bad; |
| } |
} |
| |
|
| if (nxt == IPPROTO_ROUTING) { |
|
| if (rh_present++) { |
|
| in6_ifstat_inc(m->m_pkthdr.rcvif, |
|
| ifs6_in_hdrerr); |
|
| ip6stat.ip6s_badoptions++; |
|
| goto bad; |
|
| } |
|
| } |
|
| |
|
| #ifdef IPSEC |
#ifdef IPSEC |
| /* |
/* |
| * enforce IPsec policy checking if we are seeing last header. |
* enforce IPsec policy checking if we are seeing last header. |
| Line 948 ip6_process_hopopts(m, opthead, hbhlen, |
|
| Line 937 ip6_process_hopopts(m, opthead, hbhlen, |
|
| return (-1); |
return (-1); |
| } |
} |
| optlen = IP6OPT_RTALERT_LEN; |
optlen = IP6OPT_RTALERT_LEN; |
| bcopy((void *)(opt + 2), (void *)&rtalert_val, 2); |
bcopy((caddr_t)(opt + 2), (caddr_t)&rtalert_val, 2); |
| *rtalertp = ntohs(rtalert_val); |
*rtalertp = ntohs(rtalert_val); |
| break; |
break; |
| case IP6OPT_JUMBO: |
case IP6OPT_JUMBO: |
| Line 1107 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1096 ip6_savecontrol(in6p, mp, ip6, m) |
|
| struct timeval tv; |
struct timeval tv; |
| |
|
| microtime(&tv); |
microtime(&tv); |
| *mp = sbcreatecontrol((void *) &tv, sizeof(tv), |
*mp = sbcreatecontrol((caddr_t) &tv, sizeof(tv), |
| SCM_TIMESTAMP, SOL_SOCKET); |
SCM_TIMESTAMP, SOL_SOCKET); |
| if (*mp) |
if (*mp) |
| mp = &(*mp)->m_next; |
mp = &(*mp)->m_next; |
| Line 1126 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1115 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((void *) &pi6, |
*mp = sbcreatecontrol((caddr_t) &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 1136 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1125 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((void *) &hlim, sizeof(int), |
*mp = sbcreatecontrol((caddr_t) &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 1150 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1139 ip6_savecontrol(in6p, mp, ip6, m) |
|
| flowinfo >>= 20; |
flowinfo >>= 20; |
| |
|
| tclass = flowinfo & 0xff; |
tclass = flowinfo & 0xff; |
| *mp = sbcreatecontrol((void *)&tclass, sizeof(tclass), |
*mp = sbcreatecontrol((caddr_t)&tclass, sizeof(tclass), |
| IPV6_TCLASS, IPPROTO_IPV6); |
IPV6_TCLASS, IPPROTO_IPV6); |
| |
|
| if (*mp) |
if (*mp) |
| Line 1198 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1187 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((void *)hbh, hbhlen, |
*mp = sbcreatecontrol((caddr_t)hbh, hbhlen, |
| IS2292(IPV6_2292HOPOPTS, IPV6_HOPOPTS), |
IS2292(IPV6_2292HOPOPTS, IPV6_HOPOPTS), |
| IPPROTO_IPV6); |
IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| Line 1260 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1249 ip6_savecontrol(in6p, mp, ip6, m) |
|
| if (!in6p->in6p_flags & IN6P_DSTOPTS) |
if (!in6p->in6p_flags & IN6P_DSTOPTS) |
| break; |
break; |
| |
|
| *mp = sbcreatecontrol((void *)ip6e, elen, |
*mp = sbcreatecontrol((caddr_t)ip6e, elen, |
| IS2292(IPV6_2292DSTOPTS, IPV6_DSTOPTS), |
IS2292(IPV6_2292DSTOPTS, IPV6_DSTOPTS), |
| IPPROTO_IPV6); |
IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| Line 1271 ip6_savecontrol(in6p, mp, ip6, m) |
|
| Line 1260 ip6_savecontrol(in6p, mp, ip6, m) |
|
| if (!in6p->in6p_flags & IN6P_RTHDR) |
if (!in6p->in6p_flags & IN6P_RTHDR) |
| break; |
break; |
| |
|
| *mp = sbcreatecontrol((void *)ip6e, elen, |
*mp = sbcreatecontrol((caddr_t)ip6e, elen, |
| IS2292(IPV6_2292RTHDR, IPV6_RTHDR), |
IS2292(IPV6_2292RTHDR, IPV6_RTHDR), |
| IPPROTO_IPV6); |
IPPROTO_IPV6); |
| if (*mp) |
if (*mp) |
| Line 1332 ip6_notify_pmtu(struct in6pcb *in6p, con |
|
| Line 1321 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((void *)&mtuctl, sizeof(mtuctl), |
if ((m_mtu = sbcreatecontrol((caddr_t)&mtuctl, sizeof(mtuctl), |
| IPV6_PATHMTU, IPPROTO_IPV6)) == NULL) |
IPV6_PATHMTU, IPPROTO_IPV6)) == NULL) |
| return; |
return; |
| |
|
| Line 1372 ip6_pullexthdr(m, off, nxt) |
|
| Line 1361 ip6_pullexthdr(m, off, nxt) |
|
| } |
} |
| #endif |
#endif |
| |
|
| m_copydata(m, off, sizeof(ip6e), (void *)&ip6e); |
m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e); |
| if (nxt == IPPROTO_AH) |
if (nxt == IPPROTO_AH) |
| elen = (ip6e.ip6e_len + 2) << 2; |
elen = (ip6e.ip6e_len + 2) << 2; |
| else |
else |
| Line 1395 ip6_pullexthdr(m, off, nxt) |
|
| Line 1384 ip6_pullexthdr(m, off, nxt) |
|
| return NULL; |
return NULL; |
| } |
} |
| |
|
| m_copydata(m, off, elen, mtod(n, void *)); |
m_copydata(m, off, elen, mtod(n, caddr_t)); |
| n->m_len = elen; |
n->m_len = elen; |
| return n; |
return n; |
| } |
} |
| Line 1428 ip6_get_prevhdr(m, off) |
|
| Line 1417 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, char *) + len); |
ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + len); |
| |
|
| switch (nxt) { |
switch (nxt) { |
| case IPPROTO_FRAGMENT: |
case IPPROTO_FRAGMENT: |
| Line 1477 ip6_nexthdr(m, off, proto, nxtp) |
|
| Line 1466 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), (void *)&ip6); |
m_copydata(m, off, sizeof(ip6), (caddr_t)&ip6); |
| if (nxtp) |
if (nxtp) |
| *nxtp = ip6.ip6_nxt; |
*nxtp = ip6.ip6_nxt; |
| off += sizeof(ip6); |
off += sizeof(ip6); |
| Line 1490 ip6_nexthdr(m, off, proto, nxtp) |
|
| Line 1479 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), (void *)&fh); |
m_copydata(m, off, sizeof(fh), (caddr_t)&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 1501 ip6_nexthdr(m, off, proto, nxtp) |
|
| Line 1490 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), (void *)&ip6e); |
m_copydata(m, off, sizeof(ip6e), (caddr_t)&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 1514 ip6_nexthdr(m, off, proto, nxtp) |
|
| Line 1503 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), (void *)&ip6e); |
m_copydata(m, off, sizeof(ip6e), (caddr_t)&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; |
|
|
| m_tag_delete(m, mtag); |
m_tag_delete(m, mtag); |
| } |
} |
| |
|
| #ifdef GATEWAY |
|
| /* |
|
| * sysctl helper routine for net.inet.ip6.maxflows. Since |
|
| * we could reduce this value, call ip6flow_reap(); |
|
| */ |
|
| static int |
|
| sysctl_net_inet6_ip6_maxflows(SYSCTLFN_ARGS) |
|
| { |
|
| int s; |
|
| |
|
| s = sysctl_lookup(SYSCTLFN_CALL(rnode)); |
|
| if (s || newp == NULL) |
|
| return (s); |
|
| |
|
| s = splsoftnet(); |
|
| ip6flow_reap(0); |
|
| splx(s); |
|
| |
|
| return (0); |
|
| } |
|
| |
|
| static int |
|
| sysctl_net_inet6_ip6_hashsize(SYSCTLFN_ARGS) |
|
| { |
|
| int error, tmp; |
|
| struct sysctlnode node; |
|
| |
|
| node = *rnode; |
|
| tmp = ip6_hashsize; |
|
| node.sysctl_data = &tmp; |
|
| error = sysctl_lookup(SYSCTLFN_CALL(&node)); |
|
| if (error || newp == NULL) |
|
| return (error); |
|
| |
|
| if ((tmp & (tmp - 1)) == 0 && tmp != 0) { |
|
| /* |
|
| * Can only fail due to malloc() |
|
| */ |
|
| if (ip6flow_invalidate_all(tmp)) |
|
| return ENOMEM; |
|
| } else { |
|
| /* |
|
| * EINVAL if not a power of 2 |
|
| */ |
|
| return EINVAL; |
|
| } |
|
| |
|
| return (0); |
|
| } |
|
| #endif /* GATEWAY */ |
|
| |
|
| /* |
/* |
| * System control for IP6 |
* System control for IP6 |
| */ |
*/ |
| Line 1937 SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, |
|
| Line 1875 SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, |
|
| NULL, 0, &ip6_mcast_pmtu, 0, |
NULL, 0, &ip6_mcast_pmtu, 0, |
| CTL_NET, PF_INET6, IPPROTO_IPV6, |
CTL_NET, PF_INET6, IPPROTO_IPV6, |
| CTL_CREATE, CTL_EOL); |
CTL_CREATE, CTL_EOL); |
| #ifdef GATEWAY |
|
| sysctl_createv(clog, 0, NULL, NULL, |
|
| CTLFLAG_PERMANENT|CTLFLAG_READWRITE, |
|
| CTLTYPE_INT, "maxflows", |
|
| SYSCTL_DESCR("Number of flows for fast forwarding (IPv6)"), |
|
| sysctl_net_inet6_ip6_maxflows, 0, &ip6_maxflows, 0, |
|
| CTL_NET, PF_INET6, IPPROTO_IPV6, |
|
| CTL_CREATE, CTL_EOL); |
|
| sysctl_createv(clog, 0, NULL, NULL, |
|
| CTLFLAG_PERMANENT|CTLFLAG_READWRITE, |
|
| CTLTYPE_INT, "hashsize", |
|
| SYSCTL_DESCR("Size of hash table for fast forwarding (IPv6)"), |
|
| sysctl_net_inet6_ip6_hashsize, 0, &ip6_hashsize, 0, |
|
| CTL_NET, PF_INET6, IPPROTO_IPV6, |
|
| CTL_CREATE, CTL_EOL); |
|
| #endif |
|
| } |
} |