diff options
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 6 | ||||
-rw-r--r-- | sys/netinet6/in6.h | 7 | ||||
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 6 | ||||
-rw-r--r-- | sys/netinet6/in6_proto.c | 7 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 13 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 7 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 3 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 10 |
9 files changed, 50 insertions, 13 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 734a1993cee..f576d02319a 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.65 2006/04/16 19:09:56 canacar Exp $ */ +/* $OpenBSD: in6.c,v 1.66 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -87,7 +87,9 @@ #include <netinet6/ip6_var.h> #include <netinet6/nd6.h> #include <netinet6/mld6_var.h> +#ifdef MROUTING #include <netinet6/ip6_mroute.h> +#endif #include <netinet6/in6_ifattach.h> /* backward compatibility for a while... */ @@ -335,11 +337,13 @@ in6_control(so, cmd, data, ifp, p) if ((so->so_state & SS_PRIV) != 0) privileged++; +#ifdef MROUTING switch (cmd) { case SIOCGETSGCNT_IN6: case SIOCGETMIFCNT_IN6: return (mrt6_ioctl(cmd, data)); } +#endif if (ifp == NULL) return (EOPNOTSUPP); diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index 157e7651622..4dc98f6f180 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.h,v 1.37 2005/12/13 00:35:23 millert Exp $ */ +/* $OpenBSD: in6.h,v 1.38 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */ /* @@ -550,7 +550,8 @@ struct in6_pktinfo { #define IPV6CTL_MAXFRAGS 41 /* max fragments */ /* New entries should be added here from current IPV6CTL_MAXID value. */ /* to define items, should talk with KAME guys first, for *BSD compatibility */ -#define IPV6CTL_MAXID 42 +#define IPV6CTL_MFORWARDING 42 +#define IPV6CTL_MAXID 43 #define IPV6CTL_NAMES { \ { 0, 0 }, \ @@ -595,6 +596,7 @@ struct in6_pktinfo { { 0, 0 }, \ { 0, 0 }, \ { "maxfrags", CTLTYPE_INT }, \ + { "mforwarding", CTLTYPE_INT }, \ } #define IPV6CTL_VARS { \ @@ -640,6 +642,7 @@ struct in6_pktinfo { NULL, \ NULL, \ &ip6_maxfrags, \ + &ip6_mforwarding, \ } #endif /* __BSD_VISIBLE */ diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 53fea4b8566..f101dd1f36c 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.40 2006/03/05 21:48:57 miod Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.41 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -54,7 +54,9 @@ #include <netinet6/in6_ifattach.h> #include <netinet6/ip6_var.h> #include <netinet6/nd6.h> +#ifdef MROUTING #include <netinet6/ip6_mroute.h> +#endif unsigned long in6_maxmtu = 0; @@ -652,8 +654,10 @@ in6_ifdetach(ifp) struct sockaddr_in6 sin6; struct in6_multi_mship *imm; +#ifdef MROUTING /* remove ip6_mrouter stuff */ ip6_mrouter_detach(ifp); +#endif /* remove neighbor management table */ nd6_purge(ifp); diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index ea881b14f77..6eda9527782 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_proto.c,v 1.47 2005/10/14 02:44:27 brad Exp $ */ +/* $OpenBSD: in6_proto.c,v 1.48 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */ /* @@ -95,7 +95,9 @@ #include <netinet/ip_esp.h> #include <netinet/ip_ipip.h> +#ifdef MROUTING #include <netinet6/pim6_var.h> +#endif #include <netinet6/nd6.h> @@ -213,11 +215,13 @@ struct ip6protosw inet6sw[] = { }, #endif /* INET */ #endif /* GIF */ +#ifdef MROUTING { SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR, pim6_input, rip6_output, 0, rip6_ctloutput, rip6_usrreq, 0, 0, 0, 0, }, +#endif #if NCARP > 0 { SOCK_RAW, &inet6domain, IPPROTO_CARP, PR_ATOMIC|PR_ADDR, carp6_proto_input, rip6_output, 0, rip6_ctloutput, @@ -250,6 +254,7 @@ struct domain inet6domain = * Internet configuration info */ int ip6_forwarding = 0; /* no forwarding unless sysctl'd to enable */ +int ip6_mforwarding = 0; /* no mulitcast forwarding unless ... */ int ip6_sendredirects = 1; int ip6_defhlim = IPV6_DEFHLIM; int ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 96ff66c17b4..57a9a1f22f2 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.66 2006/05/27 20:00:37 claudio Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.67 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -377,7 +377,11 @@ ip6_input(m) IN6_LOOKUP_MULTI(ip6->ip6_dst, m->m_pkthdr.rcvif, in6m); if (in6m) ours = 1; - else if (!ip6_mrouter) { +#ifdef MROUTING + else if (!ip6_mforwarding || !ip6_mrouter) { +#else + else { +#endif ip6stat.ip6s_notmember++; if (!IN6_IS_ADDR_MC_LINKLOCAL(&ip6->ip6_dst)) ip6stat.ip6s_cantforward++; @@ -594,11 +598,14 @@ ip6_input(m) * ip6_mforward() returns a non-zero value, the packet * must be discarded, else it may be accepted below. */ - if (ip6_mrouter && ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { +#ifdef MROUTING + if (ip6_mforwarding && ip6_mrouter && + ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { ip6stat.ip6s_cantforward++; m_freem(m); return; } +#endif if (!ours) { m_freem(m); return; diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 31972159f45..ed33e5e171a 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.88 2006/03/05 21:48:57 miod Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.89 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -673,12 +673,15 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp) * above, will be forwarded by the ip6_input() routine, * if necessary. */ - if (ip6_mrouter && (flags & IPV6_FORWARDING) == 0) { +#ifdef MROUTING + if (ip6_mforwarding && ip6_mrouter && + (flags & IPV6_FORWARDING) == 0) { if (ip6_mforward(ip6, ifp, m) != 0) { m_freem(m); goto done; } } +#endif } /* * Multicasts with a hoplimit of zero may be looped back, diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index ca27d05cf2c..5c1faf6adec 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.25 2004/10/18 03:59:34 itojun Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.26 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -206,6 +206,7 @@ extern struct ip6stat ip6stat; /* statistics */ extern int ip6_defhlim; /* default hop limit */ extern int ip6_defmcasthlim; /* default multicast hop limit */ extern int ip6_forwarding; /* act as router? */ +extern int ip6_mforwarding; /* act as multicast router? */ extern int ip6_sendredirect; /* send ICMPv6 redirect? */ extern int ip6_forward_srcrt; /* forward src-routed? */ extern int ip6_use_deprecated; /* allow deprecated addr as source */ diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index f668bb59daf..348731c0435 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6.c,v 1.20 2006/03/05 21:48:57 miod Exp $ */ +/* $OpenBSD: mld6.c,v 1.21 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */ /* @@ -445,7 +445,9 @@ mld6_sendpkt(in6m, type, dst) * Request loopback of the report if we are acting as a multicast * router, so that the process-level routing daemon can hear it. */ +#ifdef MROUTING im6o.im6o_multicast_loop = (ip6_mrouter != NULL); +#endif /* increment output statictics */ icmp6stat.icp6s_outhist[type]++; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 641cce0427b..c74c1c8e49a 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.29 2006/03/05 21:48:57 miod Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.30 2006/05/27 23:40:27 claudio Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -78,7 +78,9 @@ #include <netinet/in_var.h> #include <netinet/ip6.h> #include <netinet6/ip6_var.h> +#ifdef MROUTING #include <netinet6/ip6_mroute.h> +#endif #include <netinet/icmp6.h> #include <netinet/in_systm.h> #include <netinet/ip.h> @@ -523,11 +525,14 @@ rip6_ctloutput(op, so, level, optname, mp) int level, optname; struct mbuf **mp; { +#ifdef MROUTING int error = 0; +#endif switch (level) { case IPPROTO_IPV6: switch (optname) { +#ifdef MROUTING case MRT6_INIT: case MRT6_DONE: case MRT6_ADD_MIF: @@ -544,6 +549,7 @@ rip6_ctloutput(op, so, level, optname, mp) else error = EINVAL; return (error); +#endif case IPV6_CHECKSUM: return (ip6_raw_ctloutput(op, so, level, optname, mp)); default: @@ -635,8 +641,10 @@ rip6_usrreq(so, req, m, nam, control, p) case PRU_DETACH: if (in6p == 0) panic("rip6_detach"); +#ifdef MROUTING if (so == ip6_mrouter) ip6_mrouter_done(); +#endif /* xxx: RSVP */ if (in6p->in6p_icmp6filt) { FREE(in6p->in6p_icmp6filt, M_PCB); |