]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile on BSD
authorRoy Marples <roy@marples.name>
Wed, 12 Feb 2014 09:25:58 +0000 (09:25 +0000)
committerRoy Marples <roy@marples.name>
Wed, 12 Feb 2014 09:25:58 +0000 (09:25 +0000)
dhcpcd.c
dhcpcd.h
platform-bsd.c

index aedeb7535bbd88478185065d291c9a548701bde8..0a684c73ddf665e82b85c64f4b0954a11be3a147 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1115,11 +1115,13 @@ main(int argc, char **argv)
        pidfile = NULL;
        ifo = NULL;
        ctx.cffile = CONFIG;
-       ctx.pid_fd = -1;
-       ctx.control_fd = -1;
+       ctx.pid_fd = ctx.control_fd = ctx.link_fd = -1;
+#ifdef PLUGIN_DEV
        ctx.dev_fd = -1;
-       ctx.link_fd = -1;
+#endif
+#ifdef INET
        ctx.udp_fd = -1;
+#endif
        i = 0;
        while ((opt = getopt_long(argc, argv, IF_OPTS, cf_options, &oi)) != -1)
        {
index dd326ddc10691cb2c2d2e303cf5d24ffdf74c831..895c3e933b198a786aa4d9983de8df9628098dde 100644 (file)
--- a/dhcpcd.h
+++ b/dhcpcd.h
@@ -117,7 +117,10 @@ struct dhcpcd_ctx {
 #ifdef __linux__
        char **ra_restore;
        ssize_t ra_restore_len;
-#endif /* __linux__ */
+#else /* __linux__ */
+       int ra_global;
+       int ra_kernel_set;
+#endif
 #endif /* INET6 */
 
 #ifdef PLUGIN_DEV
@@ -126,8 +129,6 @@ struct dhcpcd_ctx {
        struct dev *dev;
        void *dev_handle;
 #endif
-
-
 };
 
 extern const int handle_sigs[];
index ba44b68e2eeaffd6c0d265dc8014f08d2e348702..925b74ea709139f82ddee3fdab9ea40e7a31dcc7 100644 (file)
@@ -88,12 +88,11 @@ inet6_sysctl(int code, int val, int action)
        return val;
 }
 
-static int kernel_ra_set;
 void
 restore_kernel_ra(struct dhcpcd_ctx *ctx)
 {
 
-       if (kernel_ra_set == 0 || ctx->options & DHCPCD_FORKED)
+       if (ctx->ra_kernel_set == 0 || ctx->options & DHCPCD_FORKED)
                return;
        syslog(LOG_INFO, "restoring Kernel IPv6 RA support");
        if (set_inet6_sysctl(IPV6CTL_ACCEPT_RTADV, 1) == -1)
@@ -119,15 +118,14 @@ ipv6_ra_flush(void)
 }
 
 int
-check_ipv6(const char *ifname, int own)
+check_ipv6(struct dhcpcd_ctx *ctx, const char *ifname, int own)
 {
-       static int global_ra = 0;
        int ra;
 
        /* BSD doesn't support these values per iface, so just return
         * the global ra setting */
        if (ifname)
-               return global_ra;
+               return ctx->ra_global;
 
        ra = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
        if (ra == -1)
@@ -142,7 +140,7 @@ check_ipv6(const char *ifname, int own)
                        return ra;
                }
                ra = 0;
-               kernel_ra_set = 1;
+               ctx->ra_kernel_set = 1;
 
                /* Flush the kernel knowledge of advertised routers
                 * and prefixes so the kernel does not expire prefixes
@@ -150,7 +148,7 @@ check_ipv6(const char *ifname, int own)
                ipv6_ra_flush();
        }
        if (ifname == NULL)
-               global_ra = ra;
+               ctx->ra_global = ra;
 
        return ra;
 }