version 1.73.2.1.2.3, 2007/06/04 19:22:52 |
version 1.77.10.1, 2006/05/24 02:22:48 |
Line 112 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 112 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
#include <netinet6/ip6protosw.h> |
#include <netinet6/ip6protosw.h> |
|
|
/* we need it for NLOOP. */ |
|
#include "loop.h" |
|
#include "faith.h" |
#include "faith.h" |
#include "gif.h" |
#include "gif.h" |
#include "bpfilter.h" |
|
|
|
#if NGIF > 0 |
#if NGIF > 0 |
#include <netinet6/in6_gif.h> |
#include <netinet6/in6_gif.h> |
Line 131 static int ip6qmaxlen = IFQ_MAXLEN; |
|
Line 128 static int ip6qmaxlen = IFQ_MAXLEN; |
|
struct in6_ifaddr *in6_ifaddr; |
struct in6_ifaddr *in6_ifaddr; |
struct ifqueue ip6intrq; |
struct ifqueue ip6intrq; |
|
|
extern struct ifnet loif[NLOOP]; |
|
int ip6_forward_srcrt; /* XXX */ |
int ip6_forward_srcrt; /* XXX */ |
int ip6_sourcecheck; /* XXX */ |
int ip6_sourcecheck; /* XXX */ |
int ip6_sourcecheck_interval; /* XXX */ |
int ip6_sourcecheck_interval; /* XXX */ |
|
|
#define M2MMAX (sizeof(ip6stat.ip6s_m2m)/sizeof(ip6stat.ip6s_m2m[0])) |
#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[loif[0].if_index]++; /* XXX */ |
ip6stat.ip6s_m2m[lo0ifp->if_index]++; /* XXX */ |
} else if (m->m_pkthdr.rcvif->if_index < M2MMAX) |
} else if (m->m_pkthdr.rcvif->if_index < M2MMAX) |
ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; |
ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; |
else |
else |
Line 997 ip6_savecontrol(in6p, mp, ip6, m) |
|
Line 993 ip6_savecontrol(in6p, mp, ip6, m) |
|
struct ip6_hdr *ip6; |
struct ip6_hdr *ip6; |
struct mbuf *m; |
struct mbuf *m; |
{ |
{ |
struct proc *p = curproc; /* XXX */ |
|
int privileged; |
|
|
|
privileged = 0; |
|
if (p && !suser(p->p_ucred, &p->p_acflag)) |
|
privileged++; |
|
|
|
#ifdef SO_TIMESTAMP |
#ifdef SO_TIMESTAMP |
if (in6p->in6p_socket->so_options & SO_TIMESTAMP) { |
if (in6p->in6p_socket->so_options & SO_TIMESTAMP) { |
Line 1060 ip6_savecontrol(in6p, mp, ip6, m) |
|
Line 1050 ip6_savecontrol(in6p, mp, ip6, m) |
|
/* IN6P_NEXTHOP - for outgoing packet only */ |
/* IN6P_NEXTHOP - for outgoing packet only */ |
|
|
/* |
/* |
* IPV6_HOPOPTS socket option. We require super-user privilege |
* IPV6_HOPOPTS socket option. Recall that we required super-user |
* for the option, but it might be too strict, since there might |
* privilege for the option (see ip6_ctloutput), but it might be too |
* be some hop-by-hop options which can be returned to normal user. |
* strict, since there might be some hop-by-hop options which can be |
* See RFC 2292 section 6. |
* returned to normal user. |
|
* See also RFC 2292 section 6. |
*/ |
*/ |
if ((in6p->in6p_flags & IN6P_HOPOPTS) != 0 && privileged) { |
if ((in6p->in6p_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 1160 ip6_savecontrol(in6p, mp, ip6, m) |
|
Line 1151 ip6_savecontrol(in6p, mp, ip6, m) |
|
if (!in6p->in6p_flags & IN6P_DSTOPTS) |
if (!in6p->in6p_flags & IN6P_DSTOPTS) |
break; |
break; |
|
|
/* |
|
* We also require super-user privilege for |
|
* the option. |
|
* See the comments on IN6_HOPOPTS. |
|
*/ |
|
if (!privileged) |
|
break; |
|
|
|
*mp = sbcreatecontrol((caddr_t)ip6e, elen, |
*mp = sbcreatecontrol((caddr_t)ip6e, elen, |
IPV6_DSTOPTS, IPPROTO_IPV6); |
IPV6_DSTOPTS, IPPROTO_IPV6); |
if (*mp) |
if (*mp) |
Line 1440 u_char inet6ctlerrmap[PRC_NCMDS] = { |
|
Line 1423 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 1694 SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, |
|
Line 1652 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); |
|
} |
} |