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