Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 nd6_dad_duplicated takes the lock itself. Move ...



details:   https://anonhg.NetBSD.org/src/rev/6f7f7165cd5c
branches:  trunk
changeset: 819061:6f7f7165cd5c
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Nov 15 21:17:07 2016 +0000

description:
nd6_dad_duplicated takes the lock itself. Move it out of the critical
section.

diffstat:

 sys/netinet6/nd6_nbr.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (56 lines):

diff -r ce7a3cd8d0f1 -r 6f7f7165cd5c sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c    Tue Nov 15 20:59:11 2016 +0000
+++ b/sys/netinet6/nd6_nbr.c    Tue Nov 15 21:17:07 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_nbr.c,v 1.129 2016/10/31 04:16:25 ozaki-r Exp $    */
+/*     $NetBSD: nd6_nbr.c,v 1.130 2016/11/15 21:17:07 mlelstv Exp $    */
 /*     $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $        */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.129 2016/10/31 04:16:25 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.130 2016/11/15 21:17:07 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1229,6 +1229,7 @@
 {
        struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
        struct dadq *dp;
+       int duplicate = 0;
 
 #ifndef NET_MPSAFE
        mutex_enter(softnet_lock);
@@ -1286,10 +1287,6 @@
                 * We have transmitted sufficient number of DAD packets.
                 * See what we've got.
                 */
-               int duplicate;
-
-               duplicate = 0;
-
                if (dp->dad_na_icount) {
                        /*
                         * the check is in nd6_dad_na_input(),
@@ -1306,7 +1303,6 @@
                if (duplicate) {
                        /* (*dp) will be freed in nd6_dad_duplicated() */
                        dp = NULL;
-                       nd6_dad_duplicated(ifa);
                } else {
                        /*
                         * We are done with DAD.  No NA came, no NS came.
@@ -1329,6 +1325,10 @@
 
 done:
        mutex_exit(&nd6_dad_lock);
+
+       if (duplicate)
+               nd6_dad_duplicated(ifa);
+
 #ifndef NET_MPSAFE
        KERNEL_UNLOCK_ONE(NULL);
        mutex_exit(softnet_lock);



Home | Main Index | Thread Index | Old Index