NetworkManager/0007-device-update-ext-conf...

109 lines
5.2 KiB
Diff

From b870115d83ddb2f7091e7b5e1f65b64261c53557 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Fri, 12 May 2017 12:00:20 +0200
Subject: [PATCH 1/2] device: update external configuration before commit
If the platform signaled that the external configuration changed (and
thus update_ipX_config() is scheduled) and we are doing a commit of
the new configuration, update priv->ext_ipX_config. Without this, the
commit will remove addresses added externally but not yet captured in
the external configuration.
https://bugzilla.redhat.com/show_bug.cgi?id=1449873
(cherry picked from commit a21b8882cc9defc43248afc94bf59ca0f84f0d27)
(cherry picked from commit bf5407992f54440b586e1d0b3792f93eb2c464f3)
---
src/devices/nm-device.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8540b4c..87cd296 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5487,8 +5487,15 @@ ip4_config_merge_and_apply (NMDevice *self,
composite = nm_ip4_config_new (nm_device_get_ip_ifindex (self));
init_ip4_config_dns_priority (self, composite);
- if (commit)
+ if (commit) {
ensure_con_ip4_config (self);
+ if (priv->queued_ip4_config_id) {
+ g_clear_object (&priv->ext_ip4_config);
+ priv->ext_ip4_config = nm_ip4_config_capture (nm_device_get_platform (self),
+ nm_device_get_ifindex (self),
+ FALSE);
+ }
+ }
if (priv->dev_ip4_config) {
nm_ip4_config_merge (composite, priv->dev_ip4_config,
@@ -6223,8 +6230,18 @@ ip6_config_merge_and_apply (NMDevice *self,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
init_ip6_config_dns_priority (self, composite);
- if (commit)
+ if (commit) {
ensure_con_ip6_config (self);
+ if (priv->queued_ip6_config_id) {
+ g_clear_object (&priv->ext_ip6_config);
+ g_clear_object (&priv->ext_ip6_config_captured);
+ priv->ext_ip6_config_captured = nm_ip6_config_capture (nm_device_get_platform (self),
+ nm_device_get_ifindex (self),
+ FALSE,
+ NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
+ priv->ext_ip6_config = nm_ip6_config_new_cloned (priv->ext_ip6_config_captured);
+ }
+ }
/* Merge all the IP configs into the composite config */
if (priv->ac_ip6_config) {
--
2.9.3
From 2d0d1643e59f4ac935e2288a02da8774b6b237dc Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 17 May 2017 09:46:22 +0200
Subject: [PATCH 2/2] device: fix crash in ip6_config_merge_and_apply()
nm_ip6_config_capture() returns NULL for slaves. Fixes the following:
nm_ip6_config_new_cloned: assertion 'NM_IS_IP6_CONFIG (src)' failed
#0 g_logv () at /lib64/libglib-2.0.so.0
#1 g_log () at /lib64/libglib-2.0.so.0
#2 nm_ip6_config_new_cloned (src=0x0) at src/nm-ip6-config.c:2272
#3 ip6_config_merge_and_apply (self=self@entry=0x200d8f0, commit=commit@entry=1) at src/devices/nm-device.c:6192
#4 nm_device_bring_up (self=self@entry=0x200d8f0, block=block@entry=1, no_firmware=no_firmware@entry=0x0) at src/devices/nm-device.c:10369
#5 _hw_addr_set (self=self@entry=0x200d8f0, addr=addr@entry=0x2095ea0 "6A:1C:00:2A:68:7C", operation=operation@entry=0x64f8ba "set", detail=detail@entry=0x67369d "restore") at src/devices/nm-device.c:13225
#6 nm_device_hw_addr_set (self=self@entry=0x200d8f0, addr=addr@entry=0x2095ea0 "6A:1C:00:2A:68:7C", detail=detail@entry=0x67369d "restore", set_permanent=set_permanent@entry=0) at src/devices/nm-device.c:13255
#7 release_slave (device=0x200d8f0, slave=0x1ef2990, configure=<optimized out>) at src/devices/nm-device-bond.c:463
#8 nm_device_master_release_one_slave (self=self@entry=0x200d8f0, slave=slave@entry=0x1ef2990, configure=1, reason=reason@entry=NM_DEVICE_STATE_REASON_CONNECTION_REMOVED) at src/devices/nm-device.c:2041
#9 slave_state_changed (slave=0x1ef2990, slave_new_state=NM_DEVICE_STATE_DEACTIVATING, slave_old_state=NM_DEVICE_STATE_ACTIVATED, reason=NM_DEVICE_STATE_REASON_CONNECTION_REMOVED, self=0x200d8f0)
at src/devices/nm-device.c:3366
...
Fixes: a21b8882cc9defc43248afc94bf59ca0f84f0d27
(cherry picked from commit 1e78f50b8e5e24d13547b478165170117c1ac8ae)
(cherry picked from commit bf28e0845fa38cdd3556fb61a7e725ac42a7d50a)
---
src/devices/nm-device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 87cd296..b14dc49 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6239,7 +6239,8 @@ ip6_config_merge_and_apply (NMDevice *self,
nm_device_get_ifindex (self),
FALSE,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
- priv->ext_ip6_config = nm_ip6_config_new_cloned (priv->ext_ip6_config_captured);
+ if (priv->ext_ip6_config_captured)
+ priv->ext_ip6_config = nm_ip6_config_new_cloned (priv->ext_ip6_config_captured);
}
}
--
2.9.3