]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't do platform init or setting interface MTU if too small when
authorRoy Marples <roy@marples.name>
Tue, 11 Aug 2015 09:24:41 +0000 (09:24 +0000)
committerRoy Marples <roy@marples.name>
Tue, 11 Aug 2015 09:24:41 +0000 (09:24 +0000)
testing or dumping leases.

if.c

diff --git a/if.c b/if.c
index 2823d8ea57ed9cf393a3a83087277a469f7da258..834e99b4a01c1adf35af9ca1ef3e2bced291fb83 100644 (file)
--- 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