summaryrefslogtreecommitdiffstats
path: root/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2015-08-11 09:24:41 +0000
committerRoy Marples <roy@marples.name>2015-08-11 09:24:41 +0000
commitb5df92dc5d42ae761fa945807c74bbbac4585e00 (patch)
tree5a0b1701bc2fce75206c9c32bf2ba1078a9bf90b /if.c
parentd433a3789b26da8671240423e7cf366d1b1ab2bf (diff)
downloaddhcpcd-b5df92dc5d42ae761fa945807c74bbbac4585e00.tar.xz
Don't do platform init or setting interface MTU if too small when
testing or dumping leases.
Diffstat (limited to 'if.c')
-rw-r--r--if.c29
1 files changed, 16 insertions, 13 deletions
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