summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2008-11-25 12:11:46 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2008-11-25 12:11:46 +0000
commitd773af5009dd3bda5ac659f8a49a399a950cfbe9 (patch)
tree3b01d77ed6d6268de15cb7118078a19d547ad6cf
parent6e975ccd45f058f67d5fc4be2f54b49f1e378170 (diff)
delay /etc/netstart until IPv6-DAD (dup-address-detection) is completed.
ok fries, hshoexer, claudio
-rw-r--r--etc/netstart7
-rw-r--r--sys/netinet6/in6.h7
-rw-r--r--sys/netinet6/in6_proto.c3
-rw-r--r--sys/netinet6/ip6_input.c4
-rw-r--r--sys/netinet6/ip6_var.h3
-rw-r--r--sys/netinet6/nd6_nbr.c7
6 files changed, 23 insertions, 8 deletions
diff --git a/etc/netstart b/etc/netstart
index f780259a65c..573c82dcdaa 100644
--- a/etc/netstart
+++ b/etc/netstart
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: netstart,v 1.123 2008/08/14 00:59:50 sthen Exp $
+# $OpenBSD: netstart,v 1.124 2008/11/25 12:11:44 markus Exp $
# Strip comments (and leading/trailing whitespace if IFS is set)
# from a file and spew to stdout
@@ -390,5 +390,8 @@ done
if [ "$ip6kernel" = "YES" ]; then
# this is to make sure DAD is completed before going further.
- sleep `sysctl -n net.inet6.ip6.dad_count`
+ count=0
+ while [ $((count++)) -lt 10 -a "x"`sysctl -n net.inet6.ip6.dad_pending` != "x0" ]; do
+ sleep 1
+ done
fi
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 33b0a2ee1a1..7cab2a6b4a0 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.h,v 1.46 2008/06/11 06:30:36 mcbride Exp $ */
+/* $OpenBSD: in6.h,v 1.47 2008/11/25 12:11:44 markus Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -618,7 +618,8 @@ struct ip6_mtuinfo {
#define IPV6CTL_MAXIFPREFIXES 46
#define IPV6CTL_MAXIFDEFROUTERS 47
#define IPV6CTL_MAXDYNROUTES 48
-#define IPV6CTL_MAXID 49
+#define IPV6CTL_DAD_PENDING 49
+#define IPV6CTL_MAXID 50
/* New entries should be added here from current IPV6CTL_MAXID value. */
/* to define items, should talk with KAME guys first, for *BSD compatibility */
@@ -673,6 +674,7 @@ struct ip6_mtuinfo {
{ "maxifprefixes", CTLTYPE_INT }, \
{ "maxifdefrouters", CTLTYPE_INT }, \
{ "maxdynroutes", CTLTYPE_INT }, \
+ { "dad_pending", CTLTYPE_INT }, \
}
#define IPV6CTL_VARS { \
@@ -725,6 +727,7 @@ struct ip6_mtuinfo {
&ip6_maxifprefixes, \
&ip6_maxifdefrouters, \
&ip6_maxdynroutes, \
+ NULL, \
}
#endif /* __BSD_VISIBLE */
diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c
index 79d5b2f6fa9..52aa3df8fb9 100644
--- a/sys/netinet6/in6_proto.c
+++ b/sys/netinet6/in6_proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_proto.c,v 1.56 2008/06/11 06:30:36 mcbride Exp $ */
+/* $OpenBSD: in6_proto.c,v 1.57 2008/11/25 12:11:45 markus Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
@@ -265,6 +265,7 @@ int ip6_maxfrags = 200;
int ip6_log_interval = 5;
int ip6_hdrnestlimit = 10; /* appropriate? */
int ip6_dad_count = 1; /* DupAddrDetectionTransmits */
+int ip6_dad_pending; /* number of currently running DADs */
int ip6_auto_flowlabel = 1;
int ip6_use_deprecated = 1; /* allow deprecated addr (RFC2462 5.5.4) */
int ip6_rr_prune = 5; /* router renumbering prefix
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index f5216ceaa5f..7302f7e345c 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.89 2008/11/02 10:37:29 claudio Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.90 2008/11/25 12:11:45 markus Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -1471,6 +1471,8 @@ ip6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
return sysctl_rdstring(oldp, oldlenp, newp, __KAME_VERSION);
case IPV6CTL_V6ONLY:
return sysctl_rdint(oldp, oldlenp, newp, ip6_v6only);
+ case IPV6CTL_DAD_PENDING:
+ return sysctl_rdint(oldp, oldlenp, newp, ip6_dad_pending);
case IPV6CTL_STATS:
if (newp != NULL)
return (EPERM);
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index c898be9f16f..96881a7a0e6 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_var.h,v 1.35 2008/09/03 08:41:57 mpf Exp $ */
+/* $OpenBSD: ip6_var.h,v 1.36 2008/11/25 12:11:45 markus Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
@@ -264,6 +264,7 @@ extern int ip6_log_interval;
extern time_t ip6_log_time;
extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */
extern int ip6_dad_count; /* DupAddrDetectionTransmits */
+extern int ip6_dad_pending; /* number of currently running DADs */
extern int ip6_auto_flowlabel;
extern int ip6_auto_linklocal;
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 5b604f3825e..213929cca6c 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.53 2008/10/01 21:17:06 claudio Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.54 2008/11/25 12:11:45 markus Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -1127,6 +1127,7 @@ nd6_dad_start(struct ifaddr *ifa, int *tick)
}
bzero(&dp->dad_timer_ch, sizeof(dp->dad_timer_ch));
TAILQ_INSERT_TAIL(&dadq, (struct dadq *)dp, dad_list);
+ ip6_dad_pending++;
nd6log((LOG_DEBUG, "%s: starting DAD for %s\n", ifa->ifa_ifp->if_xname,
ip6_sprintf(&ia->ia_addr.sin6_addr)));
@@ -1181,6 +1182,7 @@ nd6_dad_stop(struct ifaddr *ifa)
free(dp, M_IP6NDP);
dp = NULL;
IFAFREE(ifa);
+ ip6_dad_pending--;
}
static void
@@ -1226,6 +1228,7 @@ nd6_dad_timer(struct ifaddr *ifa)
free(dp, M_IP6NDP);
dp = NULL;
IFAFREE(ifa);
+ ip6_dad_pending--;
goto done;
}
@@ -1279,6 +1282,7 @@ nd6_dad_timer(struct ifaddr *ifa)
free(dp, M_IP6NDP);
dp = NULL;
IFAFREE(ifa);
+ ip6_dad_pending--;
}
}
@@ -1318,6 +1322,7 @@ nd6_dad_duplicated(struct ifaddr *ifa)
free(dp, M_IP6NDP);
dp = NULL;
IFAFREE(ifa);
+ ip6_dad_pending--;
}
static void