dcavalca / rpms / systemd

Forked from rpms/systemd 4 months ago
Clone
Blob Blame History Raw
From 557d5e9fecff500b010a9be44dda1ae000f45039 Mon Sep 17 00:00:00 2001
From: Matthias Greiner <magreiner@users.noreply.github.com>
Date: Mon, 22 May 2017 03:11:25 +0200
Subject: [PATCH] Allow bad MTU values with warning to be able to connect to
 the machine. (#5954)

Ensure the MTU value is valid. Emit a warning and ignore otherwise.

(cherry picked from commit 955d99edc7991386a36e3d33924cc584931fde91)
---
 src/libsystemd-network/sd-dhcp-lease.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 7fed55c5fc..565ec4cbe4 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -594,6 +594,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: