diff options
author | Thomas Haller <thaller@redhat.com> | 2014-11-18 14:24:15 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-11-19 17:37:27 +0100 |
commit | 48974654c9a0ee462fe685ad50aec515811b14c3 (patch) | |
tree | 3c4b2efe2bdc973fb82aa274081d142c3f72a9dc | |
parent | 259e82b717ef5fcfd61ab584e2e2a3846b118250 (diff) | |
download | NetworkManager-48974654c9a0ee462fe685ad50aec515811b14c3.tar.gz |
fixup! device: only add default route when having any addresses
-rw-r--r-- | src/devices/nm-device.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index b505f3ed74..90a82b5fdd 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -238,7 +238,6 @@ typedef struct { IpState ip4_state; NMIP4Config * dev_ip4_config; /* Config from DHCP, PPP, LLv4, etc */ NMIP4Config * ext_ip4_config; /* Stuff added outside NM */ - gboolean ext_ip4_config_had_any_addresses; NMIP4Config * wwan_ip4_config; /* WWAN configuration */ struct { gboolean v4_has; @@ -274,7 +273,6 @@ typedef struct { NMIP6Config * vpn6_config; /* routes added by a VPN which uses this device */ NMIP6Config * wwan_ip6_config; NMIP6Config * ext_ip6_config; /* Stuff added outside NM */ - gboolean ext_ip6_config_had_any_addresses; gboolean nm_ipv6ll; /* TRUE if NM handles the device's IPv6LL address */ NMRDisc * rdisc; @@ -2810,7 +2808,7 @@ ip4_config_merge_and_apply (NMDevice *self, if (assumed) priv->default_route.v4_has = _device_get_default_route_from_platform (self, AF_INET, (NMPlatformIPRoute *) route); - else if ( (!commit && priv->ext_ip4_config_had_any_addresses) + else if ( (!commit && priv->ext_ip4_config && nm_ip4_config_get_num_addresses (priv->ext_ip4_config)) || ( commit && nm_ip4_config_get_num_addresses (composite))) { /* For managed interfaces, we can only configure a gateway, if either the external config indicates * that we already have addresses, or if we are about to commit any addresses. @@ -3364,7 +3362,7 @@ ip6_config_merge_and_apply (NMDevice *self, if (assumed) priv->default_route.v6_has = _device_get_default_route_from_platform (self, AF_INET6, (NMPlatformIPRoute *) route); - else if ( (!commit && priv->ext_ip6_config_had_any_addresses) + else if ( (!commit && priv->ext_ip6_config && nm_ip6_config_get_num_addresses (priv->ext_ip6_config)) || ( commit && nm_ip6_config_get_num_addresses (composite))) { /* For managed interfaces, we can only configure a gateway, if either the external config indicates * that we already have addresses, or if we are about to commit any addresses. @@ -6348,8 +6346,7 @@ update_ip_config (NMDevice *self, gboolean initial) /* IPv4 */ g_clear_object (&priv->ext_ip4_config); priv->ext_ip4_config = nm_ip4_config_capture (ifindex, capture_resolv_conf); - priv->ext_ip4_config_had_any_addresses = ( priv->ext_ip4_config - && nm_ip4_config_get_num_addresses (priv->ext_ip4_config) > 0); + if (priv->ext_ip4_config) { if (initial) { g_clear_object (&priv->dev_ip4_config); @@ -6368,8 +6365,6 @@ update_ip_config (NMDevice *self, gboolean initial) /* IPv6 */ g_clear_object (&priv->ext_ip6_config); priv->ext_ip6_config = nm_ip6_config_capture (ifindex, capture_resolv_conf, NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); - priv->ext_ip6_config_had_any_addresses = ( priv->ext_ip6_config - && nm_ip6_config_get_num_addresses (priv->ext_ip6_config) > 0); if (priv->ext_ip6_config) { /* Check this before modifying ext_ip6_config */ @@ -6969,9 +6964,6 @@ _cleanup_generic_post (NMDevice *self, gboolean deconfigure) g_clear_object (&priv->wwan_ip6_config); g_clear_object (&priv->ip6_config); - priv->ext_ip4_config_had_any_addresses = FALSE; - priv->ext_ip6_config_had_any_addresses = FALSE; - clear_act_request (self); /* Clear legacy IPv4 address property */ |