]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Move IPv6 RA checking and disabling kernel RA higher up the chain.
authorRoy Marples <roy@marples.name>
Tue, 19 Feb 2013 16:05:12 +0000 (16:05 +0000)
committerRoy Marples <roy@marples.name>
Tue, 19 Feb 2013 16:05:12 +0000 (16:05 +0000)
dhcpcd.c
platform-bsd.c
platform-linux.c

index fd6851223967c832d02e5a836ed14176ef06bf8d..b4724c2041c5fb9840fe6d4e6bd3530a9ebb92bb 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -307,8 +307,8 @@ configure_interface1(struct interface *ifp)
                ifp->metric = ifo->metric;
 
        /* We want to disable kernel interface RA as early as possible. */
-       if (options & DHCPCD_IPV6RS && ifo->options & DHCPCD_IPV6RS) {
-               if (check_ipv6(ifp->name) != 1)
+       if (ifo->options & DHCPCD_IPV6RS) {
+               if (check_ipv6(NULL) != 1 || check_ipv6(ifp->name) != 1)
                        ifo->options &= ~DHCPCD_IPV6RS;
        }
 
@@ -475,9 +475,6 @@ init_state(struct interface *ifp, int argc, char **argv)
                syslog(LOG_ERR, "ipv4_init: %m");
                ifo->options &= ~DHCPCD_IPV4;
        }
-
-       if (ifo->options & DHCPCD_IPV6RS && !check_ipv6(NULL))
-               ifo->options &= ~DHCPCD_IPV6RS;
        if (ifo->options & DHCPCD_IPV6RS && ipv6_init() == -1) {
                syslog(LOG_ERR, "ipv6_init: %m");
                ifo->options &= ~DHCPCD_IPV6RS;
index 192e888b06ef5ebccb101ef0a0581b750a363672..76d83fe81c02b7c4f6b34fce19a6e3b9d04699e1 100644 (file)
@@ -92,12 +92,17 @@ restore_kernel_ra(void)
 int
 check_ipv6(const char *ifname)
 {
+       static int ipv6_checked = 0;
        int r;
 
        /* BSD doesn't support these values per iface, so just return 1 */
        if (ifname)
                return 1;
 
+       if (ipv6_checked)
+               return 1;
+       ipv6_checked = 1;
+
        r = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
        if (r == -1)
                /* The sysctl probably doesn't exist, but this isn't an
index ece22c4ffe53a82773d52d928ddeaa5aeb11b565..f074cfc6f66a306f29c3bec66414a78c8319c1d1 100644 (file)
@@ -175,10 +175,14 @@ restore_kernel_ra(void)
 int
 check_ipv6(const char *ifname)
 {
+       static int ipv6_checked = 0;
        int r, ex, i;
        char path[256], *p, **nrest;
 
        if (ifname == NULL) {
+               if (ipv6_checked)
+                       return 1;
+               ipv6_checked = 1;
                ifname = "all";
                ex = 1;
        } else