From: Roy Marples Date: Tue, 27 Oct 2015 12:46:48 +0000 (+0000) Subject: Make socket init happen earlier as we need it for dump leases. X-Git-Tag: v6.9.4~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a42ed94b4edf9afc8fb2def0ca97581cbb9232b;p=thirdparty%2Fdhcpcd.git Make socket init happen earlier as we need it for dump leases. --- diff --git a/dhcpcd.c b/dhcpcd.c index ed47240e..d33fcfd3 100644 --- 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