From: Roy Marples Date: Tue, 11 Aug 2015 09:24:41 +0000 (+0000) Subject: Don't do platform init or setting interface MTU if too small when X-Git-Tag: v6.9.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5df92dc5d42ae761fa945807c74bbbac4585e00;p=thirdparty%2Fdhcpcd.git Don't do platform init or setting interface MTU if too small when testing or dumping leases. --- diff --git a/if.c b/if.c index 2823d8ea..834e99b4 100644 --- a/if.c +++ b/if.c @@ -496,20 +496,23 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv) } } - /* Handle any platform init for the interface */ - if (if_init(ifp) == -1) { - logger(ifp->ctx, LOG_ERR, "%s: if_init: %m", p); - if_free(ifp); - continue; - } + if (!(ctx->options & (DHCPCD_DUMPLEASE | DHCPCD_TEST))) { + /* Handle any platform init for the interface */ + if (if_init(ifp) == -1) { + logger(ifp->ctx, LOG_ERR, "%s: if_init: %m", p); + if_free(ifp); + continue; + } - /* Ensure that the MTU is big enough for DHCP */ - if (if_getmtu(ifp) < MTU_MIN && - if_setmtu(ifp, MTU_MIN) == -1) - { - logger(ifp->ctx, LOG_ERR, "%s: set_mtu: %m", p); - if_free(ifp); - continue; + /* Ensure that the MTU is big enough for DHCP */ + if (if_getmtu(ifp) < MTU_MIN && + if_setmtu(ifp, MTU_MIN) == -1) + { + logger(ifp->ctx, LOG_ERR, + "%s: if_setmtu: %m", p); + if_free(ifp); + continue; + } } #ifdef SIOCGIFPRIORITY