]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP6: Fix prior to log an error
authorRoy Marples <roy@marples.name>
Wed, 27 Nov 2019 15:06:47 +0000 (15:06 +0000)
committerRoy Marples <roy@marples.name>
Wed, 27 Nov 2019 15:06:47 +0000 (15:06 +0000)
src/dhcp6.c

index 764e57e0735a952af555421cfdc235491c899c4c..cd67b9bbfc5b8bdc9d7f4c911aa36e3996d8797b 100644 (file)
@@ -3681,15 +3681,6 @@ dhcp6_activateinterfaces(struct interface *ifp)
 }
 #endif
 
-static int
-dhcp6_open(struct dhcpcd_ctx *ctx)
-{
-
-       if (ctx->dhcp6_fd == -1)
-               ctx->dhcp6_fd = dhcp6_openudp(0, NULL);
-       return ctx->dhcp6_fd;
-}
-
 static void
 dhcp6_start1(void *arg)
 {
@@ -3700,9 +3691,12 @@ dhcp6_start1(void *arg)
        size_t i;
        const struct dhcp_compat *dhc;
 
-       if (ctx->options & DHCPCD_MASTER) {
-               if (dhcp6_open(ctx) == -1)
+       if (ctx->options & DHCPCD_MASTER && ctx->dhcp6_fd == -1) {
+               ctx->dhcp6_fd = dhcp6_openudp(0, NULL);
+               if (ctx->dhcp6_fd == -1) {
+                       logerr(__func__);
                        return;
+               }
                eloop_event_add(ctx->eloop, ctx->dhcp6_fd, dhcp6_recvctx, ctx);
        }