]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
If no IPv6 proc or sysctl entries exist for RA or forward, assume it's OK.
authorRoy Marples <roy@marples.name>
Fri, 7 Dec 2012 09:43:56 +0000 (09:43 +0000)
committerRoy Marples <roy@marples.name>
Fri, 7 Dec 2012 09:43:56 +0000 (09:43 +0000)
dhcpcd.c
platform-bsd.c
platform-linux.c

index 238491930ffe5d99821e437a0398f418ffa8de70..2c8ffd103a863626a39052256c9c27d42ff08501 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -2105,7 +2105,8 @@ main(int argc, char **argv)
                ipv6rsfd = ipv6rs_open();
                if (ipv6rsfd == -1) {
                        syslog(LOG_ERR, "ipv6rs: %m");
-                       options &= ~DHCPCD_IPV6RS;
+                       options &= ~(DHCPCD_IPV6RS |
+                           DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT);
                } else {
                        eloop_event_add(ipv6rsfd, ipv6rs_handledata, NULL);
 //                     atexit(restore_rtadv);
index 9eaaf52468cf46dddddeeeb22a5a9bcc2575f199..0a23acb3791bdab360f9d21495459562c6223ddd 100644 (file)
@@ -90,14 +90,19 @@ restore_kernel_ra(void)
 int
 check_ipv6(const char *ifname)
 {
-       int val;
+       int r;
 
        /* BSD doesn't support these values per iface, so just return 1 */
        if (ifname)
                return 1;
 
-       val = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
-       if (val == 0)
+       r = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
+       if (r == -1)
+               /* The sysctl probably doesn't exist, but this isn't an
+                * error as such so just log it and continue */
+               syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+                   "IPV6CTL_ACCEPT_RTADV: %m");
+       else if (r == 0)
                options |= DHCPCD_IPV6RA_OWN;
        else if (options & DHCPCD_IPV6RA_OWN) {
                syslog(LOG_INFO, "disabling Kernel IPv6 RA support");
@@ -107,8 +112,14 @@ check_ipv6(const char *ifname)
                }
                atexit(restore_kernel_ra);
        }
-return 1;
-       if (get_inet6_sysctl(IPV6CTL_FORWARDING) != 0) {
+
+       r = get_inet6_sysctl(IPV6CTL_FORWARDING);
+       if (r == -1)
+               /* The sysctl probably doesn't exist, but this isn't an
+                * error as such so just log it and continue */
+               syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+                   "IPV6CTL_FORWARDING: %m");
+       else if (r != 0) {
                syslog(LOG_WARNING,
                    "Kernel is configured as a router, not a host");
                return 0;
index 3ac2db9e5b422f1d0b8f168ac2e400d46a3e3def..e42f8dd89e6bc49a41b220813846e82192468a87 100644 (file)
@@ -185,7 +185,12 @@ check_ipv6(const char *ifname)
 
        snprintf(path, sizeof(path), "%s/%s/accept_ra", prefix, ifname);
        r = check_proc_int(path);
-       if (r == 0)
+       if (r == -1)
+               /* The sysctl probably doesn't exist, but this isn't an
+                * error as such so just log it and continue */
+               syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+                   "%s: %m", path);
+       else if (r == 0)
                options |= DHCPCD_IPV6RA_OWN;
        else if (options & DHCPCD_IPV6RA_OWN) {
                syslog(LOG_INFO, "%s: disabling Kernel IPv6 RA support",
@@ -213,7 +218,13 @@ check_ipv6(const char *ifname)
        if (r != 2) {
                snprintf(path, sizeof(path), "%s/%s/forwarding",
                    prefix, ifname);
-               if (check_proc_int(path) != 0) {
+               r = check_proc_int(path);
+               if (r == -1) {
+                       /* The sysctl probably doesn't exist, but this isn't an
+                        * error as such so just log it and continue */
+                       syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+                           "%s: %m", path);
+               } else if (r != 0) {
                        syslog(LOG_WARNING,
                            "%s: configured as a router, not a host", ifname);
                        return 0;