Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Provide in6_multi_group
details: https://anonhg.NetBSD.org/src/rev/5cb9b2deb331
branches: trunk
changeset: 822093:5cb9b2deb331
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Mar 01 08:54:12 2017 +0000
description:
Provide in6_multi_group
Use it when checking if we belong to the group, instead of in6_lookup_multi.
No functional change.
diffstat:
sys/netinet6/in6_var.h | 3 ++-
sys/netinet6/ip6_input.c | 10 +++++-----
sys/netinet6/ip6_mroute.c | 10 +++++-----
sys/netinet6/ip6_output.c | 11 +++++------
sys/netinet6/mld6.c | 14 ++++++++++++--
5 files changed, 29 insertions(+), 19 deletions(-)
diffs (166 lines):
diff -r 8d9df9ff3058 -r 5cb9b2deb331 sys/netinet6/in6_var.h
--- a/sys/netinet6/in6_var.h Wed Mar 01 08:31:06 2017 +0000
+++ b/sys/netinet6/in6_var.h Wed Mar 01 08:54:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_var.h,v 1.93 2017/02/23 07:57:10 ozaki-r Exp $ */
+/* $NetBSD: in6_var.h,v 1.94 2017/03/01 08:54:12 ozaki-r Exp $ */
/* $KAME: in6_var.h,v 1.81 2002/06/08 11:16:51 itojun Exp $ */
/*
@@ -683,6 +683,7 @@
struct in6_multi *
in6_lookup_multi(const struct in6_addr *, const struct ifnet *);
+bool in6_multi_group(const struct in6_addr *, const struct ifnet *);
void in6_purge_multi(struct ifnet *);
struct in6_multi *in6_addmulti(struct in6_addr *, struct ifnet *,
int *, int);
diff -r 8d9df9ff3058 -r 5cb9b2deb331 sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c Wed Mar 01 08:31:06 2017 +0000
+++ b/sys/netinet6/ip6_input.c Wed Mar 01 08:54:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_input.c,v 1.175 2017/02/22 07:46:00 ozaki-r Exp $ */
+/* $NetBSD: ip6_input.c,v 1.176 2017/03/01 08:54:12 ozaki-r Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.175 2017/02/22 07:46:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.176 2017/03/01 08:54:12 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_gateway.h"
@@ -458,15 +458,15 @@
* Multicast check
*/
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
- struct in6_multi *in6m = 0;
+ bool ingroup;
in6_ifstat_inc(rcvif, ifs6_in_mcast);
/*
* See if we belong to the destination multicast group on the
* arrival interface.
*/
- in6m = in6_lookup_multi(&ip6->ip6_dst, rcvif);
- if (in6m)
+ ingroup = in6_multi_group(&ip6->ip6_dst, rcvif);
+ if (ingroup)
ours = 1;
else if (!ip6_mrouter) {
uint64_t *ip6s = IP6_STAT_GETREF();
diff -r 8d9df9ff3058 -r 5cb9b2deb331 sys/netinet6/ip6_mroute.c
--- a/sys/netinet6/ip6_mroute.c Wed Mar 01 08:31:06 2017 +0000
+++ b/sys/netinet6/ip6_mroute.c Wed Mar 01 08:54:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_mroute.c,v 1.118 2017/02/22 07:46:00 ozaki-r Exp $ */
+/* $NetBSD: ip6_mroute.c,v 1.119 2017/03/01 08:54:12 ozaki-r Exp $ */
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
/*
@@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.118 2017/02/22 07:46:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.119 2017/03/01 08:54:12 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1551,7 +1551,7 @@
int error __mrt6debugused = 0;
int s;
static struct route ro;
- struct in6_multi *in6m;
+ bool ingroup;
struct sockaddr_in6 dst6;
u_long linkmtu;
@@ -1608,8 +1608,8 @@
*/
sockaddr_in6_init(&dst6, &ip6->ip6_dst, 0, 0, 0);
- in6m = in6_lookup_multi(&ip6->ip6_dst, ifp);
- if (in6m != NULL) {
+ ingroup = in6_multi_group(&ip6->ip6_dst, ifp);
+ if (ingroup) {
ip6_mloopback(ifp, m,
satocsin6(rtcache_getdst(&ro)));
}
diff -r 8d9df9ff3058 -r 5cb9b2deb331 sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Wed Mar 01 08:31:06 2017 +0000
+++ b/sys/netinet6/ip6_output.c Wed Mar 01 08:54:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_output.c,v 1.186 2017/02/22 07:46:00 ozaki-r Exp $ */
+/* $NetBSD: ip6_output.c,v 1.187 2017/03/01 08:54:12 ozaki-r Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.186 2017/02/22 07:46:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.187 2017/03/01 08:54:12 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -636,7 +636,7 @@
if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst))
m->m_flags &= ~(M_BCAST | M_MCAST); /* just in case */
else {
- struct in6_multi *in6m;
+ bool ingroup;
m->m_flags = (m->m_flags & ~M_BCAST) | M_MCAST;
@@ -652,9 +652,8 @@
goto bad;
}
- in6m = in6_lookup_multi(&ip6->ip6_dst, ifp);
- if (in6m != NULL &&
- (im6o == NULL || im6o->im6o_multicast_loop)) {
+ ingroup = in6_multi_group(&ip6->ip6_dst, ifp);
+ if (ingroup && (im6o == NULL || im6o->im6o_multicast_loop)) {
/*
* If we belong to the destination multicast group
* on the outgoing interface, and the caller did not
diff -r 8d9df9ff3058 -r 5cb9b2deb331 sys/netinet6/mld6.c
--- a/sys/netinet6/mld6.c Wed Mar 01 08:31:06 2017 +0000
+++ b/sys/netinet6/mld6.c Wed Mar 01 08:54:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mld6.c,v 1.83 2017/02/23 07:57:10 ozaki-r Exp $ */
+/* $NetBSD: mld6.c,v 1.84 2017/03/01 08:54:12 ozaki-r Exp $ */
/* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */
/*
@@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.83 2017/02/23 07:57:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.84 2017/03/01 08:54:12 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -780,6 +780,16 @@
return in6m;
}
+bool
+in6_multi_group(const struct in6_addr *addr, const struct ifnet *ifp)
+{
+ bool ingroup;
+
+ ingroup = in6_lookup_multi(addr, ifp) != NULL;
+
+ return ingroup;
+}
+
/*
* Purge in6_multi records associated to the interface.
*/
Home |
Main Index |
Thread Index |
Old Index