mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 05:50:12 +01:00
dhcp: don't add route to DHCP4 server
This basically reverts commit31fe84e467"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:31fe84e467https://bugzilla.redhat.com/show_bug.cgi?id=1448987 (cherry picked from commit36e97f5d7b)
This commit is contained in:
parent
8ca05e9fd2
commit
cbf5a776f7
1 changed files with 0 additions and 37 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue