changeset 2398:6e036b78cd84 draft

Only fork when the RA has a RDNSS option AND a valid prefix OR no DHCPv6 instruction.
author Roy Marples <roy@marples.name>
date Tue, 18 Mar 2014 23:03:07 +0000
parents 56327846c5dd
children ee26aa91aa8a
files dhcpcd.conf.5.in ipv6nd.c
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dhcpcd.conf.5.in	Fri Mar 14 10:48:14 2014 +0000
+++ b/dhcpcd.conf.5.in	Tue Mar 18 23:03:07 2014 +0000
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 30, 2014
+.Dd March 18, 2014
 .Dt DHCPCD.CONF 5
 .Os
 .Sh NAME
@@ -284,7 +284,7 @@
 receives an IPv6 RA,
 .Nm dhcpcd
 will only fork to the background if the RA contains at least one unexpired
-RDNSS option.
+RDNSS option and a valid prefix or no DHCPv6 instruction.
 Set this option so to make
 .Nm dhcpcd
 always fork on an RA.
--- a/ipv6nd.c	Fri Mar 14 10:48:14 2014 +0000
+++ b/ipv6nd.c	Tue Mar 18 23:03:07 2014 +0000
@@ -431,15 +431,17 @@
 static int
 ipv6nd_scriptrun(struct ra *rap)
 {
-	int hasdns;
+	int hasdns, hasaddress, pid;
 	struct ipv6_addr *ap;
 	const struct ra_opt *rao;
 
+	hasaddress = 0;
 	/* If all addresses have completed DAD run the script */
 	TAILQ_FOREACH(ap, &rap->addrs, next) {
 		if ((ap->flags & (IPV6_AF_ONLINK | IPV6_AF_AUTOCONF)) ==
 		    (IPV6_AF_ONLINK | IPV6_AF_AUTOCONF))
 		{
+			hasaddress = 1;
 			if (!(ap->flags & IPV6_AF_DADCOMPLETED) &&
 			    ipv6_findaddr(ap->iface, &ap->addr))
 				ap->flags |= IPV6_AF_DADCOMPLETED;
@@ -470,8 +472,10 @@
 	}
 
 	script_runreason(rap->iface, "ROUTERADVERT");
-	if (hasdns)
-		hasdns = daemonise(rap->iface->ctx);
+	pid = 0;
+	if (hasdns && (hasaddress ||
+	    !(rap->flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER))))
+		pid = daemonise(rap->iface->ctx);
 #if 0
 	else if (options & DHCPCD_DAEMONISE &&
 	    !(options & DHCPCD_DAEMONISED) && new_data)
@@ -481,7 +485,7 @@
 		    ifp->name);
 }
 #endif
-	return hasdns;
+	return pid;
 }
 
 static void