Blob Blame History Raw
From 16419a5467ca7bf9408030316cf12bc31cdd2e33 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 26 Jan 2015 15:34:02 +0100
Subject: [PATCH] device: schedule queued_ip_config_change() after constructing
 device

During queued_ip_config_change(), we eventually call update_ip_config()
and ip4_config_merge_and_apply(). These functions read the IP configuration
from platform and setup the private ip4_config instance.

Trigger this initialization after constructing the device to setup
the IP configuration.

Before, for unmanaged devices we would not call ip4_config_merge_and_apply()
until the first platform change event.

Note that in the worst case we do some unnecessary work due to this,
because queued_ip_config_change() must already be robust to be called
at any time.

(cherry picked from commit ddac52a61e838b6f2b7e103e2f94276c6dc41037)
---
 src/devices/nm-device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 1c75790..dd8fd8f 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8067,6 +8067,9 @@ constructor (GType type,
 	g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP6_ROUTE_CHANGED, G_CALLBACK (device_ip_changed), self);
 	g_signal_connect (platform, NM_PLATFORM_SIGNAL_LINK_CHANGED, G_CALLBACK (link_changed_cb), self);
 
+	/* trigger initial ip config change to initialize ip-config */
+	priv->queued_ip_config_id = g_idle_add (queued_ip_config_change, self);
+
 	if (nm_platform_check_support_user_ipv6ll ()) {
 		int ip_ifindex = nm_device_get_ip_ifindex (self);
 
-- 
1.9.3