diff options
author | Thomas Haller <thaller@redhat.com> | 2014-10-15 23:14:30 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-10-31 18:43:54 +0100 |
commit | ef663c58aa805432c9aafe3939d0b8844e12b201 (patch) | |
tree | e44228191cea9c8797f44d492961186b7f147981 | |
parent | 688758b404ce0adb0df4266bb4186cd50c849648 (diff) | |
download | NetworkManager-ef663c58aa805432c9aafe3939d0b8844e12b201.tar.gz |
dhcp: don't add special route to DHCP server when having direct route
When the DHCP server address is not on the same subnet, we used
to add a /32 route to the server IP address via the gateway.
Do not add this route, if we already got a direct route from DHCP.
https://bugzilla.gnome.org/show_bug.cgi?id=738590
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 3d7acbc42785a2ef2283a41a139c610e79a4edcf)
Conflicts:
src/dhcp-manager/nm-dhcp-utils.c
-rw-r--r-- | src/dhcp-manager/nm-dhcp-client.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c index 1f186f3256..0a541a0ed6 100644 --- a/src/dhcp-manager/nm-dhcp-client.c +++ b/src/dhcp-manager/nm-dhcp-client.c @@ -1220,13 +1220,13 @@ ip4_options_to_config (NMDHCPClient *self) str = g_hash_table_lookup (priv->options, "new_dhcp_server_identifier"); if (str) { if (inet_pton (AF_INET, str, &tmp_addr) > 0) { - NMPlatformIP4Route route; - guint32 mask = nm_utils_ip4_prefix_to_netmask (address.plen); nm_log_info (LOGD_DHCP4, " server identifier %s", str); - if ((tmp_addr & mask) != (address.address & mask)) { - /* DHCP server not on assigned subnet, route needed */ - memset (&route, 0, sizeof (route)); + 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 */ |