summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-09-16 05:12:45 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-09-16 14:20:38 +0200
commit8f92ead6e2a9082d5aa4a885680308b4516d70ae (patch)
tree005df0964280d40400fc11243a9f59d60b79d845
parent2a391348b6906a728d68ef5758b6bf102318986a (diff)
downloadNetworkManager-8f92ead6e2a9082d5aa4a885680308b4516d70ae.tar.gz
device: fix crash reapplying connection to slave devices
Slave devices don't have IPv4 and IPv6 configuration and so special care must be taken when comparing their methods. https://bugzilla.redhat.com/show_bug.cgi?id=1376446
-rw-r--r--src/devices/nm-device.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e8deeb7b46..243836f8fc 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -7819,6 +7819,7 @@ nm_device_reactivate_ip4_config (NMDevice *self,
NMSettingIPConfig *s_ip4_new)
{
NMDevicePrivate *priv;
+ const char *method_old, *method_new;
g_return_if_fail (NM_IS_DEVICE (self));
priv = NM_DEVICE_GET_PRIVATE (self);
@@ -7831,8 +7832,14 @@ nm_device_reactivate_ip4_config (NMDevice *self,
s_ip4_new,
nm_device_get_ip4_route_metric (self));
- if (strcmp (nm_setting_ip_config_get_method (s_ip4_new),
- nm_setting_ip_config_get_method (s_ip4_old))) {
+ 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 (!nm_streq0 (method_old, method_new)) {
_cleanup_ip4_pre (self, CLEANUP_TYPE_DECONFIGURE);
_set_ip_state (self, AF_INET, IP_WAIT);
if (!nm_device_activate_stage3_ip4_start (self))
@@ -7850,6 +7857,7 @@ nm_device_reactivate_ip6_config (NMDevice *self,
NMSettingIPConfig *s_ip6_new)
{
NMDevicePrivate *priv;
+ const char *method_old, *method_new;
g_return_if_fail (NM_IS_DEVICE (self));
priv = NM_DEVICE_GET_PRIVATE (self);
@@ -7862,8 +7870,14 @@ nm_device_reactivate_ip6_config (NMDevice *self,
s_ip6_new,
nm_device_get_ip6_route_metric (self));
- if (strcmp (nm_setting_ip_config_get_method (s_ip6_new),
- nm_setting_ip_config_get_method (s_ip6_old))) {
+ 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 (!nm_streq0 (method_old, method_new)) {
_cleanup_ip6_pre (self, CLEANUP_TYPE_DECONFIGURE);
_set_ip_state (self, AF_INET6, IP_WAIT);
if (!nm_device_activate_stage3_ip6_start (self))