NetworkManager/0007-device-update-ext-conf-before-commit-rh1449873.patch

166 lines
8.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
From 8a7f6f2cd2c210a29daae39b1d0b0923d78d3ed0 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Sun, 21 May 2017 15:47:33 +0200
Subject: [PATCH] device: fix capture of device config in
ipX_config_merge_and_apply()
Use nm_device_get_ip_ifindex() to obtain the right ifindex for the
device. Fixes the following:
nm_platform_ip4_address_get_all: assertion 'ifindex > 0' failed
#0 _g_log_abort () from target:/lib64/libglib-2.0.so.0
#1 g_logv () from target:/lib64/libglib-2.0.so.0
#2 g_log () from target:/lib64/libglib-2.0.so.0
#3 nm_platform_ip4_address_get_all (self=self@entry=0x1181020, ifindex=ifindex@entry=0) at src/platform/nm-platform.c:2640
#4 nm_ip4_config_capture (platform=0x1181020, ifindex=ifindex@entry=0, capture_resolv_conf=capture_resolv_conf@entry=0) at src/nm-ip4-config.c:271
#5 ip4_config_merge_and_apply (self=self@entry=0x1254a70, config=config@entry=0x0, commit=commit@entry=1) at src/devices/nm-device.c:5447
#6 activate_stage5_ip4_config_commit (self=0x1254a70) at src/devices/nm-device.c:8299
#7 activation_source_handle_cb (self=0x1254a70, family=family@entry=2) at src/devices/nm-device.c:4421
#8 activation_source_handle_cb4 (user_data=<optimized out>) at src/devices/nm-device.c:4358
#9 g_idle_dispatch () from target:/lib64/libglib-2.0.so.0
#10 g_main_context_dispatch () from target:/lib64/libglib-2.0.so.0
#11 g_main_context_iterate.isra () from target:/lib64/libglib-2.0.so.0
#12 g_main_loop_run () from target:/lib64/libglib-2.0.so.0
#13 main (argc=<optimized out>, argv=<optimized out>) at src/main.c:435
Fixes: a21b8882cc9defc43248afc94bf59ca0f84f0d27
(cherry picked from commit 6389d637a7e8d20e037e4bd9cea917dfc372ef17)
(cherry picked from commit 4b6955095b4d857bccb265c22c22b2da2f382d45)
---
src/devices/nm-device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e61bde3..be37116 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5492,7 +5492,7 @@ ip4_config_merge_and_apply (NMDevice *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),
+ nm_device_get_ip_ifindex (self),
FALSE);
}
}
@@ -6236,7 +6236,7 @@ ip6_config_merge_and_apply (NMDevice *self,
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),
+ nm_device_get_ip_ifindex (self),
FALSE,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
if (priv->ext_ip6_config_captured)
--
2.9.3