diff options
author | Dan Williams <dcbw@redhat.com> | 2013-11-07 01:05:04 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-11-08 16:46:44 -0600 |
commit | d6b9465b189207f8938d4b1e3738dd7431a707e8 (patch) | |
tree | 705b73a13817d8756c8e844f30c81623c08f71a1 | |
parent | 61744d41bb1cd8b994b36bcdce98b0991590cef0 (diff) | |
download | NetworkManager-d6b9465b189207f8938d4b1e3738dd7431a707e8.tar.gz |
core: find assumed connection masters
If an assumed connection should have a master (bridge port, bond slave,
etc) it needs to notify its master that it's a slave. Since slaves
are ordered after their masters at start, the master should already
have a generated connection which we can use as the master.
-rw-r--r-- | src/nm-manager.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 8b059cc7de..71f7b2bdb8 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -166,6 +166,7 @@ static NMActiveConnection *_new_active_connection (NMManager *self, static void policy_activating_device_changed (GObject *object, GParamSpec *pspec, gpointer user_data); static NMDevice *find_device_by_ip_iface (NMManager *self, const gchar *iface); +static NMDevice *find_device_by_iface (NMManager *self, const gchar *iface); static void rfkill_change_wifi (const char *desc, gboolean enabled); @@ -176,6 +177,12 @@ platform_link_added_cb (NMPlatform *platform, NMPlatformReason reason, gpointer user_data); +static gboolean find_master (NMManager *self, + NMConnection *connection, + NMDevice *device, + NMConnection **out_master_connection, + NMDevice **out_master_device); + #define SSD_POKE_INTERVAL 120 #define ORIGDEV_TAG "originating-device" @@ -1956,6 +1963,21 @@ add_device (NMManager *self, NMDevice *device, gboolean nm_created) subject = nm_auth_subject_new_internal (); active = _new_active_connection (self, connection, NULL, device, subject, &error); if (active) { + NMDevice *master = NULL; + NMActRequest *master_req; + + /* If the device is a slave or VLAN, find the master ActiveConnection */ + if (find_master (self, connection, device, NULL, &master) && master) { + master_req = nm_device_get_act_request (master); + if (master_req) + nm_active_connection_set_master (active, NM_ACTIVE_CONNECTION (master_req)); + else { + nm_log_warn (LOGD_DEVICE, "(%s): master device %s not activating!", + nm_device_get_iface (device), + nm_device_get_iface (master)); + } + } + nm_active_connection_set_assumed (active, TRUE); nm_active_connection_export (active); active_connection_add (self, active); |