Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109253400
D10943.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D10943.diff
View Options
Index: head/sys/netinet6/nd6_nbr.c
===================================================================
--- head/sys/netinet6/nd6_nbr.c
+++ head/sys/netinet6/nd6_nbr.c
@@ -1120,6 +1120,7 @@
#define ND_OPT_NONCE_LEN32 \
((ND_OPT_NONCE_LEN + sizeof(uint32_t) - 1)/sizeof(uint32_t))
uint32_t dad_nonce[ND_OPT_NONCE_LEN32];
+ bool dad_ondadq; /* on dadq? Protected by DADQ_WLOCK. */
};
static VNET_DEFINE(TAILQ_HEAD(, dadq), dadq);
@@ -1138,6 +1139,7 @@
DADQ_WLOCK();
TAILQ_INSERT_TAIL(&V_dadq, dp, dad_list);
+ dp->dad_ondadq = true;
DADQ_WUNLOCK();
}
@@ -1146,9 +1148,17 @@
{
DADQ_WLOCK();
- TAILQ_REMOVE(&V_dadq, dp, dad_list);
- DADQ_WUNLOCK();
- nd6_dad_rele(dp);
+ if (dp->dad_ondadq) {
+ /*
+ * Remove dp from the dadq and release the dadq's
+ * reference.
+ */
+ TAILQ_REMOVE(&V_dadq, dp, dad_list);
+ dp->dad_ondadq = false;
+ DADQ_WUNLOCK();
+ nd6_dad_rele(dp);
+ } else
+ DADQ_WUNLOCK();
}
static struct dadq *
@@ -1281,6 +1291,8 @@
dp->dad_ns_icount = dp->dad_na_icount = 0;
dp->dad_ns_ocount = dp->dad_ns_tcount = 0;
dp->dad_ns_lcount = dp->dad_loopbackprobe = 0;
+
+ /* Add this to the dadq and add a reference for the dadq. */
refcount_init(&dp->dad_refcnt, 1);
nd6_dad_add(dp);
nd6_dad_starttimer(dp, delay, 0);
@@ -1301,17 +1313,9 @@
}
nd6_dad_stoptimer(dp);
-
- /*
- * The DAD queue entry may have been removed by nd6_dad_timer() while
- * we were waiting for it to stop, so re-do the lookup.
- */
- nd6_dad_rele(dp);
- dp = nd6_dad_find(ifa, NULL);
- if (dp == NULL)
- return;
-
nd6_dad_del(dp);
+
+ /* Release this function's reference, acquired by nd6_dad_find(). */
nd6_dad_rele(dp);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 3, 4:00 PM (21 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16437672
Default Alt Text
D10943.diff (1 KB)
Attached To
Mode
D10943: Static analysis: Improve DAD deletion code
Attached
Detach File
Event Timeline
Log In to Comment