Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Revert "Get rid of unnecessary splsoftnet" (v1....



details:   https://anonhg.NetBSD.org/src/rev/2ae2679411b9
branches:  trunk
changeset: 359030:2ae2679411b9
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Jan 26 06:37:21 2018 +0000

description:
Revert "Get rid of unnecessary splsoftnet" (v1.133)

It's not always true that softnet_lock is held these places.
See PR kern/52947.

diffstat:

 sys/netinet6/nd6_rtr.c |  27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diffs (110 lines):

diff -r 75bc7768305b -r 2ae2679411b9 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c    Fri Jan 26 05:29:43 2018 +0000
+++ b/sys/netinet6/nd6_rtr.c    Fri Jan 26 06:37:21 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_rtr.c,v 1.136 2017/12/15 04:03:46 ozaki-r Exp $    */
+/*     $NetBSD: nd6_rtr.c,v 1.137 2018/01/26 06:37:21 ozaki-r Exp $    */
 /*     $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $        */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.136 2017/12/15 04:03:46 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.137 2018/01/26 06:37:21 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -469,6 +469,7 @@
                struct sockaddr_in6 sin6;
                struct sockaddr sa;
        } def, mask, gate;
+       int s;
        int error;
 
        memset(&def, 0, sizeof(def));
@@ -483,15 +484,14 @@
        gate.sin6.sin6_scope_id = 0;    /* XXX */
 #endif
 
-#ifndef NET_MPSAFE
-       KASSERT(mutex_owned(softnet_lock));
-#endif
+       s = splsoftnet();
        error = rtrequest_newmsg(RTM_ADD, &def.sa, &gate.sa, &mask.sa,
            RTF_GATEWAY);
        if (error == 0) {
                nd6_numroutes++;
                newdr->installed = 1;
        }
+       splx(s);
        return;
 }
 
@@ -957,7 +957,7 @@
        struct nd_prefix **newp)
 {
        struct nd_prefix *newpr = NULL;
-       int i;
+       int i, s;
        int error;
        struct in6_ifextra *ext = prc->ndprc_ifp->if_afdata[AF_INET6];
 
@@ -997,8 +997,10 @@
                    newpr->ndpr_mask.s6_addr32[i];
        }
 
+       s = splsoftnet();
        /* link ndpr_entry to nd_prefix list */
        ND_PREFIX_LIST_INSERT_HEAD(newpr);
+       splx(s);
 
        /* ND_OPT_PI_FLAG_ONLINK processing */
        if (newpr->ndpr_raf_onlink) {
@@ -1066,6 +1068,7 @@
 nd6_prelist_remove(struct nd_prefix *pr)
 {
        struct nd_pfxrouter *pfr, *next;
+       int s;
        struct in6_ifextra *ext = pr->ndpr_ifp->if_afdata[AF_INET6];
 
        ND6_ASSERT_WLOCK();
@@ -1073,6 +1076,7 @@
 
        nd6_invalidate_prefix(pr);
 
+       s = splsoftnet();
        /* unlink ndpr_entry from nd_prefix list */
        ND_PREFIX_LIST_REMOVE(pr);
 
@@ -1090,6 +1094,7 @@
                            "%s\n", pr->ndpr_ifp->if_xname);
                }
        }
+       splx(s);
 
        free(pr, M_IP6NDP);
 
@@ -2218,16 +2223,16 @@
 void
 nd6_rt_flush(struct in6_addr *gateway, struct ifnet *ifp)
 {
-
-#ifndef NET_MPSAFE
-       KASSERT(mutex_owned(softnet_lock));
-#endif
+       int s = splsoftnet();
 
        /* We'll care only link-local addresses */
-       if (!IN6_IS_ADDR_LINKLOCAL(gateway))
+       if (!IN6_IS_ADDR_LINKLOCAL(gateway)) {
+               splx(s);
                return;
+       }
 
        rt_delete_matched_entries(AF_INET6, rt6_deleteroute_matcher, gateway);
+       splx(s);
 }
 
 static int



Home | Main Index | Thread Index | Old Index