]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Make socket init happen earlier as we need it for dump leases.
authorRoy Marples <roy@marples.name>
Tue, 27 Oct 2015 12:46:48 +0000 (12:46 +0000)
committerRoy Marples <roy@marples.name>
Tue, 27 Oct 2015 12:46:48 +0000 (12:46 +0000)
dhcpcd.c

index ed47240e31cf3e2efee3e8f716dd45a441e9634b..d33fcfd3c250ebb4f5411df32af2c25e51491ae6 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1578,6 +1578,13 @@ main(int argc, char **argv)
                goto exit_failure;
        }
 
+       /* Open our persistent sockets.
+        * This is needed early for dumping leases on valid interfaces. */
+       if (if_opensockets(&ctx) == -1) {
+               logger(&ctx, LOG_ERR, "if_opensockets: %m");
+               goto exit_failure;
+       }
+
        if (ctx.options & DHCPCD_DUMPLEASE) {
                if (optind != argc - 1) {
                        logger(&ctx, LOG_ERR,
@@ -1777,11 +1784,8 @@ main(int argc, char **argv)
        if (ctx.ifc == 1 && !(ctx.options & DHCPCD_BACKGROUND))
                ctx.options |= DHCPCD_WAITIP;
 
-       /* Open our persistent sockets. */
-       if (if_opensockets(&ctx) == -1) {
-               logger(&ctx, LOG_ERR, "if_opensockets: %m");
-               goto exit_failure;
-       }
+       /* Start handling kernel messages for interfaces, addreses and
+        * routes. */
        eloop_event_add(ctx.eloop, ctx.link_fd, handle_link, &ctx, NULL, NULL);
 
        /* Start any dev listening plugin which may want to