changeset 4174:79133872da0b draft

ipv6nd: don't handle NA or RA if not active interface This stops interfaces activated only for delegating to from receiving these messages by default.
author Roy Marples <roy@marples.name>
date Wed, 25 Oct 2017 11:45:25 +0100
parents e336de0ca5ae
children 2a14528ebe96
files src/ipv6nd.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ipv6nd.c	Wed Oct 25 09:15:10 2017 +0100
+++ b/src/ipv6nd.c	Wed Oct 25 11:45:25 2017 +0100
@@ -1559,15 +1559,18 @@
 		return;
 	}
 
+	/* Find the receiving interface */
 	TAILQ_FOREACH(ifp, ctx->ifaces, next) {
-		if (ifp->active &&
-		    ifp->index == (unsigned int)pkt.ipi6_ifindex) {
-			if (!(ifp->options->options & DHCPCD_IPV6))
-				return;
+		if (ifp->index == (unsigned int)pkt.ipi6_ifindex)
 			break;
-		}
 	}
 
+	/* Don't do anything if the user hasn't configured it. */
+	if (ifp != NULL &&
+	    (ifp->active != IF_ACTIVE_USER ||
+	    !(ifp->options->options & DHCPCD_IPV6)))
+		return;
+
 	icp = (struct icmp6_hdr *)ctx->rcvhdr.msg_iov[0].iov_base;
 	if (icp->icmp6_code == 0) {
 		switch(icp->icmp6_type) {