]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Now that we set MTU for routes instead of using a hook script,
authorRoy Marples <roy@marples.name>
Mon, 31 Aug 2015 10:26:49 +0000 (10:26 +0000)
committerRoy Marples <roy@marples.name>
Mon, 31 Aug 2015 10:26:49 +0000 (10:26 +0000)
we need to read static interface_mtu (or static mtu) and use that if
available.

dhcp.c
if-options.c
if-options.h

diff --git a/dhcp.c b/dhcp.c
index c84516d586b595fcfc868abd6e19aa1b451de9ec..a3b9306c3c4a89c042ef931bcc00e590fc8e1c0e 100644 (file)
--- 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) ||
index e998617a0d819a5463388975cfc874d3dcf5ccbc..a74fd1316d8e85413efe423aaa21f245d8b0e196 100644 (file)
@@ -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) {
index 0bb247eee068dfb17e8ab49349ca96044aebf606..984496f95a6b53a232db22583986cb33f06ed971 100644 (file)
@@ -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;