[PATCH 7/7] bonding: Auto activate slaves when a master enters prepare state
Reset the auto retries of all slave connections when their master connection enter prepare state and schedule all of the slaves for activation if not pending yet. Slaves are initially scheduled for activation together with their master but depending on how long it takes for the master connection to appear the slave activation requests may already have run out of attempts. Resetting the retries counter ensures that all slaves are properly activated when a master is brought up. Signed-off-by: Thomas Graf --- src/nm-policy.c | 39 +++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/src/nm-policy.c b/src/nm-policy.c index 69e65a6..4d31189 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1022,6 +1022,38 @@ get_device_connection (NMDevice *device) return req ? nm_act_request_get_connection (req) : NULL; } +static void schedule_activate_all (NMPolicy *policy); + +static void +activate_slave_connections (NMPolicy *policy, NMConnection *connection, +NMDevice *device) +{ + const char *master_device; + GSList *connections, *iter; + + master_device = nm_device_get_iface (device); + g_assert (master_device); + + connections = nm_settings_get_connections (policy->settings); + for (iter = connections; iter; iter = g_slist_next (iter)) { + NMConnection *slave; + NMSettingConnection *s_slave_con; + + slave = NM_CONNECTION (iter->data); + g_assert (slave); + + s_slave_con = nm_connection_get_setting_connection (slave); + g_assert (s_slave_con); + + if (!g_strcmp0 (nm_setting_connection_get_master (s_slave_con), master_device)) + set_connection_auto_retries (slave, RETRIES_DEFAULT); + } + + g_slist_free (connections); + + schedule_activate_all (policy); +} + static void device_state_changed (NMDevice *device, NMDeviceState new_state, @@ -,6 +1143,13 @@ device_state_changed (NMDevice *device, update_routing_and_dns (policy, FALSE); schedule_activate_check (policy, device, 0); break; + + case NM_DEVICE_STATE_PREPARE: + /* Reset auto-connect retries of all slaves and schedule them for +* activation. */ + activate_slave_connections (policy, connection, device); + break; + default: break; } -- 1.7.7.3 ___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Auto-activate
On Tue, 2008-06-03 at 08:28 +0200, Helmut Schaa wrote: > Am Mo 02 Jun 2008 17:00:24 CEST schrieb Dan Williams <[EMAIL PROTECTED]>: > > > On Sun, 2008-06-01 at 21:34 +0200, Will Stephenson wrote: > >> What needs to be done to get NM to autoconnect a wireless connection on > >> UserSettingsService startup? I can see KNM responding to GetSettings with > >> autoconnect=true, but NM then seems to ignore the connection. I am going > >> to > >> put some debug in NetworkManagerPolicy.c but could someone (Dan hopefully) > >> elaborate the way it should work, from a client's point of view? > > > > For wifi, look in nm-device-802-11-wireless.c, > > real_get_best_auto_connection(). That loops through all connections, > > and will match connections based on: > > > > a) if it's a wireless connection > > b) if it's autoconnect > > c) if it's got a wireless setting > > d) if it has a MAC address, if that MAC matches the device's MAC > > e) if there's a compatible AP in the device's scan list > > > > I'd suspect (e) first here actually. There may be a bug in the AP > > matching code, or the connection may just be wrong for the AP you're > > trying to connect to. If the call to nm_ap_check_compatible() for your > > AP is returning FALSE, get the iwlist output for the AP and then drill > > down into that function and see why it's returning FALSE. It's probably > > in the security stuff. > > The issue is related to (e). It's the same issue as in the mail I've > send you some days ago regarding "cipher preselection". NM will refuse > to autoconnect to a wireless connection if no ciphers are specified. > > I just worked around this issue by specifying default ciphers in KNM. Should probably file a bug about this in bugzilla so we don't forget about it. Should be fixed eventually. Dan ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Auto-activate
Am Mo 02 Jun 2008 17:00:24 CEST schrieb Dan Williams <[EMAIL PROTECTED]>: > On Sun, 2008-06-01 at 21:34 +0200, Will Stephenson wrote: >> What needs to be done to get NM to autoconnect a wireless connection on >> UserSettingsService startup? I can see KNM responding to GetSettings with >> autoconnect=true, but NM then seems to ignore the connection. I am going to >> put some debug in NetworkManagerPolicy.c but could someone (Dan hopefully) >> elaborate the way it should work, from a client's point of view? > > For wifi, look in nm-device-802-11-wireless.c, > real_get_best_auto_connection(). That loops through all connections, > and will match connections based on: > > a) if it's a wireless connection > b) if it's autoconnect > c) if it's got a wireless setting > d) if it has a MAC address, if that MAC matches the device's MAC > e) if there's a compatible AP in the device's scan list > > I'd suspect (e) first here actually. There may be a bug in the AP > matching code, or the connection may just be wrong for the AP you're > trying to connect to. If the call to nm_ap_check_compatible() for your > AP is returning FALSE, get the iwlist output for the AP and then drill > down into that function and see why it's returning FALSE. It's probably > in the security stuff. The issue is related to (e). It's the same issue as in the mail I've send you some days ago regarding "cipher preselection". NM will refuse to autoconnect to a wireless connection if no ciphers are specified. I just worked around this issue by specifying default ciphers in KNM. Helmut ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Auto-activate
On Sun, 2008-06-01 at 21:34 +0200, Will Stephenson wrote: > What needs to be done to get NM to autoconnect a wireless connection on > UserSettingsService startup? I can see KNM responding to GetSettings with > autoconnect=true, but NM then seems to ignore the connection. I am going to > put some debug in NetworkManagerPolicy.c but could someone (Dan hopefully) > elaborate the way it should work, from a client's point of view? For wifi, look in nm-device-802-11-wireless.c, real_get_best_auto_connection(). That loops through all connections, and will match connections based on: a) if it's a wireless connection b) if it's autoconnect c) if it's got a wireless setting d) if it has a MAC address, if that MAC matches the device's MAC e) if there's a compatible AP in the device's scan list I'd suspect (e) first here actually. There may be a bug in the AP matching code, or the connection may just be wrong for the AP you're trying to connect to. If the call to nm_ap_check_compatible() for your AP is returning FALSE, get the iwlist output for the AP and then drill down into that function and see why it's returning FALSE. It's probably in the security stuff. Dan ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Auto-activate
What needs to be done to get NM to autoconnect a wireless connection on UserSettingsService startup? I can see KNM responding to GetSettings with autoconnect=true, but NM then seems to ignore the connection. I am going to put some debug in NetworkManagerPolicy.c but could someone (Dan hopefully) elaborate the way it should work, from a client's point of view? Will ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list