Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Make a deletion of in6m in nd6_rtrequest atomic



details:   https://anonhg.NetBSD.org/src/rev/8831c7b236c9
branches:  trunk
changeset: 319417:8831c7b236c9
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue May 29 04:38:29 2018 +0000

description:
Make a deletion of in6m in nd6_rtrequest atomic

diffstat:

 sys/netinet6/in6_var.h |   4 +++-
 sys/netinet6/mld6.c    |  17 +++++++++++++++--
 sys/netinet6/nd6.c     |  12 ++++--------
 3 files changed, 22 insertions(+), 11 deletions(-)

diffs (95 lines):

diff -r 53096857192b -r 8831c7b236c9 sys/netinet6/in6_var.h
--- a/sys/netinet6/in6_var.h    Tue May 29 04:37:58 2018 +0000
+++ b/sys/netinet6/in6_var.h    Tue May 29 04:38:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_var.h,v 1.99 2018/05/29 04:36:47 ozaki-r Exp $     */
+/*     $NetBSD: in6_var.h,v 1.100 2018/05/29 04:38:29 ozaki-r Exp $    */
 /*     $KAME: in6_var.h,v 1.81 2002/06/08 11:16:51 itojun Exp $        */
 
 /*
@@ -692,6 +692,8 @@
        int *, int);
 void   in6_delmulti(struct in6_multi *);
 void   in6_delmulti_locked(struct in6_multi *);
+void   in6_lookup_and_delete_multi(const struct in6_addr *,
+           const struct ifnet *);
 struct in6_multi_mship *in6_joingroup(struct ifnet *, struct in6_addr *,
        int *, int);
 int    in6_leavegroup(struct in6_multi_mship *);
diff -r 53096857192b -r 8831c7b236c9 sys/netinet6/mld6.c
--- a/sys/netinet6/mld6.c       Tue May 29 04:37:58 2018 +0000
+++ b/sys/netinet6/mld6.c       Tue May 29 04:38:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mld6.c,v 1.96 2018/05/29 04:37:58 ozaki-r Exp $        */
+/*     $NetBSD: mld6.c,v 1.97 2018/05/29 04:38:29 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.96 2018/05/29 04:37:58 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.97 2018/05/29 04:38:29 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -861,6 +861,19 @@
        return in6m;
 }
 
+void
+in6_lookup_and_delete_multi(const struct in6_addr *addr,
+    const struct ifnet *ifp)
+{
+       struct in6_multi *in6m;
+
+       rw_enter(&in6_multilock, RW_WRITER);
+       in6m = in6_lookup_multi(addr, ifp);
+       if (in6m != NULL)
+               in6_delmulti_locked(in6m);
+       rw_exit(&in6_multilock);
+}
+
 bool
 in6_multi_group(const struct in6_addr *addr, const struct ifnet *ifp)
 {
diff -r 53096857192b -r 8831c7b236c9 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Tue May 29 04:37:58 2018 +0000
+++ b/sys/netinet6/nd6.c        Tue May 29 04:38:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.248 2018/05/01 07:21:39 maxv Exp $   */
+/*     $NetBSD: nd6.c,v 1.249 2018/05/29 04:38:29 ozaki-r Exp $        */
 /*     $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $   */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.248 2018/05/01 07:21:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.249 2018/05/29 04:38:29 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1606,18 +1606,14 @@
                if ((rt->rt_flags & RTF_ANNOUNCE) != 0 &&
                    (ifp->if_flags & IFF_MULTICAST) != 0) {
                        struct in6_addr llsol;
-                       struct in6_multi *in6m;
 
                        llsol = satocsin6(rt_getkey(rt))->sin6_addr;
                        llsol.s6_addr32[0] = htonl(0xff020000);
                        llsol.s6_addr32[1] = 0;
                        llsol.s6_addr32[2] = htonl(1);
                        llsol.s6_addr8[12] = 0xff;
-                       if (in6_setscope(&llsol, ifp, NULL) == 0) {
-                               in6m = in6_lookup_multi(&llsol, ifp);
-                               if (in6m)
-                                       in6_delmulti(in6m);
-                       }
+                       if (in6_setscope(&llsol, ifp, NULL) == 0)
+                               in6_lookup_and_delete_multi(&llsol, ifp);
                }
                break;
        }



Home | Main Index | Thread Index | Old Index