teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0052-Allow-bad-MTU-values-with-warning-to-be-able-to-conn.patch

Zbigniew Jędrzejewski-Szmek f4a676
From 557d5e9fecff500b010a9be44dda1ae000f45039 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek f4a676
From: Matthias Greiner <magreiner@users.noreply.github.com>
Zbigniew Jędrzejewski-Szmek f4a676
Date: Mon, 22 May 2017 03:11:25 +0200
Zbigniew Jędrzejewski-Szmek f4a676
Subject: [PATCH] Allow bad MTU values with warning to be able to connect to
Zbigniew Jędrzejewski-Szmek f4a676
 the machine. (#5954)
Zbigniew Jędrzejewski-Szmek f4a676
Zbigniew Jędrzejewski-Szmek f4a676
Ensure the MTU value is valid. Emit a warning and ignore otherwise.
Zbigniew Jędrzejewski-Szmek f4a676
Zbigniew Jędrzejewski-Szmek f4a676
(cherry picked from commit 955d99edc7991386a36e3d33924cc584931fde91)
Zbigniew Jędrzejewski-Szmek f4a676
---
Zbigniew Jędrzejewski-Szmek f4a676
 src/libsystemd-network/sd-dhcp-lease.c | 5 +++++
Zbigniew Jędrzejewski-Szmek f4a676
 1 file changed, 5 insertions(+)
Zbigniew Jędrzejewski-Szmek f4a676
Zbigniew Jędrzejewski-Szmek f4a676
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
Zbigniew Jędrzejewski-Szmek f4a676
index 7fed55c5fc..565ec4cbe4 100644
Zbigniew Jędrzejewski-Szmek f4a676
--- a/src/libsystemd-network/sd-dhcp-lease.c
Zbigniew Jędrzejewski-Szmek f4a676
+++ b/src/libsystemd-network/sd-dhcp-lease.c
Zbigniew Jędrzejewski-Szmek f4a676
@@ -594,6 +594,11 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const void *option, void
Zbigniew Jędrzejewski-Szmek f4a676
                 r = lease_parse_u16(option, len, &lease->mtu, 68);
Zbigniew Jędrzejewski-Szmek f4a676
                 if (r < 0)
Zbigniew Jędrzejewski-Szmek f4a676
                         log_debug_errno(r, "Failed to parse MTU, ignoring: %m");
Zbigniew Jędrzejewski-Szmek f4a676
+                if (lease->mtu < DHCP_DEFAULT_MIN_SIZE) {
Zbigniew Jędrzejewski-Szmek f4a676
+                        log_warning("MTU value of %d too small. Using default MTU value of %d instead.", lease->mtu, DHCP_DEFAULT_MIN_SIZE);
Zbigniew Jędrzejewski-Szmek f4a676
+                        lease->mtu = DHCP_DEFAULT_MIN_SIZE;
Zbigniew Jędrzejewski-Szmek f4a676
+                }
Zbigniew Jędrzejewski-Szmek f4a676
+
Zbigniew Jędrzejewski-Szmek f4a676
                 break;
Zbigniew Jędrzejewski-Szmek f4a676
 
Zbigniew Jędrzejewski-Szmek f4a676
         case SD_DHCP_OPTION_DOMAIN_NAME: