On Sun, Nov 27, 2022 at 11:12:30PM +0300, Vitaliy Makkoveev wrote:
> dad_init should go away too.
Thanks for pointing out the obvious.
---
The list of IPv6 addresses to perfom Duplicate Address Detection on is
entirely static to nd6_nbr.c; ttatically initialise it so `dad_init'
can go.
nd6_dad_find() keeps returning NULL on an initialised but empty list,
so nd6_dad_stop() keeps returning early.
Feedback? Objection? OK?
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 0597c8d0d9a..0248c12f1ad 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -62,7 +62,8 @@
#include <netinet/ip_carp.h>
#endif
-TAILQ_HEAD(dadq_head, dadq);
+static TAILQ_HEAD(, dadq) dadq =
+ TAILQ_HEAD_INITIALIZER(dadq); /* list of addresses to run DAD on */
struct dadq {
TAILQ_ENTRY(dadq) dad_list;
struct ifaddr *dad_ifa;
@@ -1036,9 +1037,6 @@ nd6_ifptomac(struct ifnet *ifp)
}
}
-static struct dadq_head dadq;
-static int dad_init = 0;
-
struct dadq *
nd6_dad_find(struct ifaddr *ifa)
{
@@ -1078,11 +1076,6 @@ nd6_dad_start(struct ifaddr *ifa)
NET_ASSERT_LOCKED();
- if (!dad_init) {
- TAILQ_INIT(&dadq);
- dad_init++;
- }
-
/*
* If we don't need DAD, don't do it.
* There are several cases:
@@ -1140,8 +1133,6 @@ nd6_dad_stop(struct ifaddr *ifa)
{
struct dadq *dp;
- if (!dad_init)
- return;
dp = nd6_dad_find(ifa);
if (!dp) {
/* DAD wasn't started yet */