]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Allow bad MTU values with warning to be able to connect to the machine. (#5954)
authorMatthias Greiner <magreiner@users.noreply.github.com>
Mon, 22 May 2017 01:11:25 +0000 (03:11 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 22 May 2017 01:11:25 +0000 (21:11 -0400)
Ensure the MTU value is valid. Emit a warning and ignore otherwise.

src/libsystemd-network/sd-dhcp-lease.c

index 5906151360604e99747f1b55b68a53507e84de4b..b4552aa35f9f7917eb7ea997d8f76d68a2040de4 100644 (file)
@@ -610,6 +610,11 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const void *option, void
                 r = lease_parse_u16(option, len, &lease->mtu, 68);
                 if (r < 0)
                         log_debug_errno(r, "Failed to parse MTU, ignoring: %m");
+                if (lease->mtu < DHCP_DEFAULT_MIN_SIZE) {
+                        log_warning("MTU value of %d too small. Using default MTU value of %d instead.", lease->mtu, DHCP_DEFAULT_MIN_SIZE);
+                        lease->mtu = DHCP_DEFAULT_MIN_SIZE;
+                }
+
                 break;
 
         case SD_DHCP_OPTION_DOMAIN_NAME: