]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
We should not set a maximum message size bigger than what we can
authorRoy Marples <roy@marples.name>
Sat, 6 Mar 2010 17:46:01 +0000 (17:46 +0000)
committerRoy Marples <roy@marples.name>
Sat, 6 Mar 2010 17:46:01 +0000 (17:46 +0000)
actually handle.

dhcp.c

diff --git a/dhcp.c b/dhcp.c
index df9f1f434801ea2b9d544dfc70277b639f467cc3..fa740a89036ed42c8e94af0c73705b9bc32f40ff 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -925,6 +925,11 @@ make_message(struct dhcp_message **message,
                if (sz < MTU_MIN) {
                        if (set_mtu(iface->name, MTU_MIN) == 0)
                                sz = MTU_MIN;
+               } else if (sz > MTU_MAX) {
+                       /* Even though our MTU could be greater than
+                        * MTU_MAX (1500) dhcpcd does not presently
+                        * handle DHCP packets any bigger. */
+                       sz = MTU_MAX;
                }
                sz = htons(sz);
                memcpy(p, &sz, 2);