Blame SOURCES/0006-dhcp-don-t-add-route-to-DHCP4-server-rh1448987.patch

fc9aca
From bed605f5bd8524779b3cf3d3e02baf06a76f4054 Mon Sep 17 00:00:00 2001
fc9aca
From: Beniamino Galvani <bgalvani@redhat.com>
fc9aca
Date: Wed, 10 May 2017 16:17:48 +0200
fc9aca
Subject: [PATCH] dhcp: don't add route to DHCP4 server
fc9aca
fc9aca
This basically reverts commit 31fe84e46773 "core: Add host route for
fc9aca
DHCP4 server if outside assigned subnet (bgo #721767)" because the
fc9aca
additional route added by NM does more harm than good.
fc9aca
fc9aca
First, the code does not consider routes pushed by the server and thus
fc9aca
it can add a route conflicting with the ones from the network
fc9aca
administrator.
fc9aca
fc9aca
Second, there is no specification on what a DHCP client should do when
fc9aca
the server is not reachable via unicast, and adding arbitrary logic
fc9aca
into the client is likely to break things in specific cases. If
fc9aca
network administrators want to make the DHCP server reachable from a
fc9aca
client in a different subnet, they should push proper routes with the
fc9aca
lease.
fc9aca
fc9aca
In any case, if the DHCP server is not reachable through unicast,
fc9aca
before the lease expiration (after timeout T2) the client will resort
fc9aca
to broadcast and so there won't be any network disruption; the renewal
fc9aca
will only happen at a later time.
fc9aca
fc9aca
Fixes: 31fe84e467732463eabc8f70c2a419008e7a227c
fc9aca
fc9aca
https://bugzilla.redhat.com/show_bug.cgi?id=1448987
fc9aca
(cherry picked from commit 36e97f5d7beba7ab5446c2b7c6c22523b1bca476)
fc9aca
(cherry picked from commit cbf5a776f72d1895405b71f45a74cf4fe9046dae)
fc9aca
---
fc9aca
 src/dhcp/nm-dhcp-utils.c | 37 -------------------------------------
fc9aca
 1 file changed, 37 deletions(-)
fc9aca
fc9aca
diff --git a/src/dhcp/nm-dhcp-utils.c b/src/dhcp/nm-dhcp-utils.c
fc9aca
index e020ca3..e55a21b 100644
fc9aca
--- a/src/dhcp/nm-dhcp-utils.c
fc9aca
+++ b/src/dhcp/nm-dhcp-utils.c
fc9aca
@@ -450,43 +450,6 @@ nm_dhcp_utils_ip4_config_from_options (int ifindex,
fc9aca
 		}
fc9aca
 	}
fc9aca
 
fc9aca
-	/*
fc9aca
-	 * RFC 2132, section 9.7
fc9aca
-	 *   DHCP clients use the contents of the 'server identifier' field
fc9aca
-	 *   as the destination address for any DHCP messages unicast to
fc9aca
-	 *   the DHCP server.
fc9aca
-	 *
fc9aca
-	 * Some ISP's provide leases from central servers that are on
fc9aca
-	 * different subnets that the address offered.  If the host
fc9aca
-	 * does not configure the interface as the default route, the
fc9aca
-	 * dhcp server may not be reachable via unicast, and a host
fc9aca
-	 * specific route is needed.
fc9aca
-	 **/
fc9aca
-	str = g_hash_table_lookup (options, "dhcp_server_identifier");
fc9aca
-	if (str) {
fc9aca
-		if (inet_pton (AF_INET, str, &tmp_addr) > 0) {
fc9aca
-
fc9aca
-			_LOG2I (LOGD_DHCP4, iface, "  server identifier %s", str);
fc9aca
-			if (   nm_utils_ip4_address_clear_host_address(tmp_addr, address.plen) != nm_utils_ip4_address_clear_host_address(address.address, address.plen)
fc9aca
-			    && !nm_ip4_config_get_direct_route_for_host (ip4_config, tmp_addr)) {
fc9aca
-				/* DHCP server not on assigned subnet and the no direct route was returned. Add route */
fc9aca
-				NMPlatformIP4Route route = { 0 };
fc9aca
-
fc9aca
-				route.network = tmp_addr;
fc9aca
-				route.plen = 32;
fc9aca
-				/* this will be a device route if gwaddr is 0 */
fc9aca
-				route.gateway = gwaddr;
fc9aca
-				route.rt_source = NM_IP_CONFIG_SOURCE_DHCP;
fc9aca
-				route.metric = priority;
fc9aca
-				nm_ip4_config_add_route (ip4_config, &route);
fc9aca
-				_LOG2D (LOGD_IP, iface, "adding route for server identifier: %s",
fc9aca
-				        nm_platform_ip4_route_to_string (&route, NULL, 0));
fc9aca
-			}
fc9aca
-		}
fc9aca
-		else
fc9aca
-			_LOG2W (LOGD_DHCP4, iface, "ignoring invalid server identifier '%s'", str);
fc9aca
-	}
fc9aca
-
fc9aca
 	str = g_hash_table_lookup (options, "dhcp_lease_time");
fc9aca
 	if (str) {
fc9aca
 		address.lifetime = address.preferred = strtoul (str, NULL, 10);
fc9aca
-- 
fc9aca
2.9.3
fc9aca