Commit 6197c27f authored by Thomas Haller's avatar Thomas Haller

device,default-route-manager: merge branch 'th/default-route-resync'

parents c2dc1c6f 82bfb6c4
......@@ -121,7 +121,7 @@ parent_hwaddr_maybe_changed (NMDevice *parent,
*/
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6)
nm_device_reactivate_ip6_config (NM_DEVICE (self), s_ip6, s_ip6);
nm_device_reactivate_ip6_config (NM_DEVICE (self), s_ip6, s_ip6, FALSE);
}
}
......
......@@ -302,6 +302,9 @@ typedef struct _NMDevicePrivate {
bool up:1; /* IFF_UP */
bool v4_commit_first_time:1;
bool v6_commit_first_time:1;
/* Generic DHCP stuff */
guint32 dhcp_timeout;
char * dhcp_anycast_address;
......@@ -332,9 +335,6 @@ typedef struct _NMDevicePrivate {
NMPlatformIP6Route v6;
} default_route;
bool v4_commit_first_time;
bool v6_commit_first_time;
/* DHCPv4 tracking */
struct {
NMDhcpClient * client;
......@@ -8418,7 +8418,8 @@ _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name,
void
nm_device_reactivate_ip4_config (NMDevice *self,
NMSettingIPConfig *s_ip4_old,
NMSettingIPConfig *s_ip4_new)
NMSettingIPConfig *s_ip4_new,
gboolean force_restart)
{
NMDevicePrivate *priv;
const char *method_old, *method_new;
......@@ -8434,14 +8435,17 @@ nm_device_reactivate_ip4_config (NMDevice *self,
s_ip4_new,
nm_device_get_ip4_route_metric (self));
method_old = s_ip4_old ?
nm_setting_ip_config_get_method (s_ip4_old) :
NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
method_new = s_ip4_new ?
nm_setting_ip_config_get_method (s_ip4_new) :
NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
if (!force_restart) {
method_old = s_ip4_old
? nm_setting_ip_config_get_method (s_ip4_old)
: NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
method_new = s_ip4_new
? nm_setting_ip_config_get_method (s_ip4_new)
: NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
force_restart = !nm_streq0 (method_old, method_new);
}
if (!nm_streq0 (method_old, method_new)) {
if (force_restart) {
_cleanup_ip4_pre (self, CLEANUP_TYPE_DECONFIGURE);
_set_ip_state (self, AF_INET, IP_WAIT);
if (!nm_device_activate_stage3_ip4_start (self))
......@@ -8456,7 +8460,8 @@ nm_device_reactivate_ip4_config (NMDevice *self,
void
nm_device_reactivate_ip6_config (NMDevice *self,
NMSettingIPConfig *s_ip6_old,
NMSettingIPConfig *s_ip6_new)
NMSettingIPConfig *s_ip6_new,
gboolean force_restart)
{
NMDevicePrivate *priv;
const char *method_old, *method_new;
......@@ -8472,14 +8477,17 @@ nm_device_reactivate_ip6_config (NMDevice *self,
s_ip6_new,
nm_device_get_ip6_route_metric (self));
method_old = s_ip6_old ?
nm_setting_ip_config_get_method (s_ip6_old) :
NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
method_new = s_ip6_new ?
nm_setting_ip_config_get_method (s_ip6_new) :
NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
if (!force_restart) {
method_old = s_ip6_old
? nm_setting_ip_config_get_method (s_ip6_old)
: NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
method_new = s_ip6_new
? nm_setting_ip_config_get_method (s_ip6_new)
: NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
force_restart = !nm_streq0 (method_old, method_new);
}
if (!nm_streq0 (method_old, method_new)) {
if (force_restart) {
_cleanup_ip6_pre (self, CLEANUP_TYPE_DECONFIGURE);
_set_ip_state (self, AF_INET6, IP_WAIT);
if (!nm_device_activate_stage3_ip6_start (self))
......@@ -8676,6 +8684,9 @@ check_and_reapply_connection (NMDevice *self,
} else
con_old = con_new = applied;
priv->v4_commit_first_time = TRUE;
priv->v6_commit_first_time = TRUE;
/**************************************************************************
* Reapply changes
*************************************************************************/
......@@ -8690,8 +8701,8 @@ check_and_reapply_connection (NMDevice *self,
s_ip6_old = nm_connection_get_setting_ip6_config (con_old);
s_ip6_new = nm_connection_get_setting_ip6_config (con_new);
nm_device_reactivate_ip4_config (self, s_ip4_old, s_ip4_new);
nm_device_reactivate_ip6_config (self, s_ip6_old, s_ip6_new);
nm_device_reactivate_ip4_config (self, s_ip4_old, s_ip4_new, TRUE);
nm_device_reactivate_ip6_config (self, s_ip6_old, s_ip6_new, TRUE);
reactivate_proxy_config (self);
......
......@@ -657,10 +657,12 @@ void nm_device_update_firewall_zone (NMDevice *self);
void nm_device_update_metered (NMDevice *self);
void nm_device_reactivate_ip4_config (NMDevice *device,
NMSettingIPConfig *s_ip4_old,
NMSettingIPConfig *s_ip4_new);
NMSettingIPConfig *s_ip4_new,
gboolean force_restart);
void nm_device_reactivate_ip6_config (NMDevice *device,
NMSettingIPConfig *s_ip6_old,
NMSettingIPConfig *s_ip6_new);
NMSettingIPConfig *s_ip6_new,
gboolean force_restart);
gboolean nm_device_update_hw_address (NMDevice *self);
void nm_device_update_initial_hw_address (NMDevice *self);
......
This diff is collapsed.
......@@ -61,4 +61,7 @@ NMIP6Config *nm_default_route_manager_ip6_get_best_config (NMDefaultRouteManager
NMDevice **out_device,
NMVpnConnection **out_vpn);
gboolean nm_default_route_manager_resync (NMDefaultRouteManager *self,
int af_family);
#endif /* NM_DEFAULT_ROUTE_MANAGER_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment