]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
ipv6nd: don't handle NA or RA if not active interface
authorRoy Marples <roy@marples.name>
Wed, 25 Oct 2017 10:45:25 +0000 (11:45 +0100)
committerRoy Marples <roy@marples.name>
Wed, 25 Oct 2017 10:45:25 +0000 (11:45 +0100)
This stops interfaces activated only for delegating to from
receiving these messages by default.

src/ipv6nd.c

index 4b2127ff4ded34bddaa4ec8944fd8e0da50e873a..a35381f7c4b79ddac1a82e4fdfc00447038ad7f1 100644 (file)
@@ -1559,15 +1559,18 @@ ipv6nd_handledata(void *arg)
                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) {