summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-11-28 13:08:54 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-11-28 13:08:54 +0000
commitd9c1d0e39781348b11c52a6e3a7c5d29d077a96a (patch)
treee97e5c20f51918ecb2cdd6c2a6c9d8bc435bc030
parent1814ce17c56a447bff7f904627e3f60ee249d1ca (diff)
Statically initialise DAD list, remove obsolete dad_init
The list of IPv6 addresses to perfom Duplicate Address Detection on is local to nd6_nbr.c; statically 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 OK mvs
-rw-r--r--sys/netinet6/nd6_nbr.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 353ad74ff60..403e7c5188d 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.135 2022/11/27 15:31:36 kn Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.136 2022/11/28 13:08:53 kn Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -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 */