From: Roy Marples Date: Mon, 31 Aug 2015 10:26:49 +0000 (+0000) Subject: Now that we set MTU for routes instead of using a hook script, X-Git-Tag: v6.9.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afcd7cbd9905debdcd157d011552d65b59aed8ef;p=thirdparty%2Fdhcpcd.git Now that we set MTU for routes instead of using a hook script, we need to read static interface_mtu (or static mtu) and use that if available. --- diff --git a/dhcp.c b/dhcp.c index c84516d5..a3b9306c 100644 --- a/dhcp.c +++ b/dhcp.c @@ -712,6 +712,8 @@ dhcp_get_mtu(const struct interface *ifp) const struct dhcp_message *dhcp; uint16_t mtu; + if (ifp->options->mtu) + return (uint16_t)ifp->options->mtu; mtu = 0; /* bogus gcc warning */ if ((dhcp = D_CSTATE(ifp)->new) == NULL || has_option_mask(ifp->options->nomask, DHO_MTU) || diff --git a/if-options.c b/if-options.c index e998617a..a74fd131 100644 --- a/if-options.c +++ b/if-options.c @@ -1098,6 +1098,16 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, return -1; } TAILQ_INSERT_TAIL(ifo->routes, rt, next); + } else if (strncmp(arg, "interface_mtu=", + strlen("interface_mtu=")) == 0 || + strncmp(arg, "mtu=", strlen("mtu=")) == 0) + { + ifo->mtu = (unsigned int)strtou(p, NULL, 0, + MTU_MIN, MTU_MAX, &e); + if (e) { + logger(ctx, LOG_ERR, "invalid MTU %s", p); + return -1; + } } else { dl = 0; if (ifo->config != NULL) { diff --git a/if-options.h b/if-options.h index 0bb247ee..984496f9 100644 --- a/if-options.h +++ b/if-options.h @@ -172,6 +172,7 @@ struct if_options { struct in_addr req_addr; struct in_addr req_mask; struct rt_head *routes; + unsigned int mtu; char **config; char **environ;