summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Šimerda <psimerda@redhat.com>2013-08-14 19:02:00 +0200
committerPavel Šimerda <psimerda@redhat.com>2013-08-29 19:57:46 +0200
commit4e7be3b366b5ff9e8c07400d32f590d36220f1eb (patch)
treef2abf73c1d46950b5eb6f967f2583958e5f64ce6
parent7cc51c54760f1ca67db3aa091c9ca010c668d086 (diff)
downloadNetworkManager-4e7be3b366b5ff9e8c07400d32f590d36220f1eb.tar.gz
core: connection live reconfiguration upon nm-platform signals
-rw-r--r--src/devices/nm-device.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 1d6ac87d0d..167180c9f6 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1203,10 +1203,17 @@ link_changed_cb (NMPlatform *platform, int ifindex, NMPlatformLink *info, NMPlat
static void
link_changed (NMDevice *device, NMPlatformLink *info)
{
+ NMDeviceClass *klass = NM_DEVICE_GET_CLASS (device);
+ NMConnection *connection = nm_device_get_connection (device);
+
/* Update carrier from link event if applicable. */
if ( device_has_capability (device, NM_DEVICE_CAP_CARRIER_DETECT)
&& !device_has_capability (device, NM_DEVICE_CAP_NONSTANDARD_CARRIER))
nm_device_set_carrier (device, info->connected);
+
+ /* Update the runtime connection according to the current link status. */
+ if (connection && klass->update_connection)
+ klass->update_connection (device, connection);
}
static void
@@ -6081,7 +6088,9 @@ update_ip_config (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMDeviceStateReason ignored = NM_DEVICE_STATE_REASON_NONE;
- NMIP6Config *ip6_config = NULL;
+ gs_unref_object NMIP4Config *ip4_config = NULL;
+ gs_unref_object NMIP6Config *ip6_config = NULL;
+ NMConnection *connection = nm_device_get_connection (self);
int ifindex;
ifindex = nm_device_get_ip_ifindex (self);
@@ -6100,6 +6109,16 @@ update_ip_config (NMDevice *self)
ip6_config = nm_ip6_config_capture (ifindex);
nm_device_set_ip6_config (self, ip6_config, FALSE, &ignored);
g_clear_object (&ip6_config);
+
+ if (connection) {
+ NMSettingIP4Config *s_ip4 = nm_connection_get_setting_ip4_config (connection);
+ NMSettingIP6Config *s_ip6 = nm_connection_get_setting_ip6_config (connection);
+
+ g_assert (s_ip4 && s_ip6);
+
+ nm_ip4_config_update_setting (ip4_config, s_ip4);
+ nm_ip6_config_update_setting (ip6_config, s_ip6);
+ }
}
static gboolean