summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2005-08-17 04:23:25 +0000
committerDan Williams <dcbw@redhat.com>2005-08-17 04:23:25 +0000
commit8c4b6c6a91e0675002e7a06e77039ffb47645a99 (patch)
tree9ea3c88526e19e2cd382f3768ca7f8167649e087
parente40b6041c2f59af194b70c87049262866add7257 (diff)
2005-08-17 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerPolicy.c - (nm_policy_device_change_check): clarify switching rules if both new and old devices are valid; mainly, don't switch away from user-requested wireless connection back to a wired one git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@859 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
-rw-r--r--ChangeLog8
-rw-r--r--src/NetworkManagerPolicy.c45
2 files changed, 41 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 357d9cafb2..00c80432da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2005-08-17 Dan Williams <dcbw@redhat.com>
+ * src/NetworkManagerPolicy.c
+ - (nm_policy_device_change_check): clarify switching rules if
+ both new and old devices are valid; mainly, don't switch
+ away from user-requested wireless connection back to a wired
+ one
+
+2005-08-17 Dan Williams <dcbw@redhat.com>
+
* gnome/applet/Makefile.am
- Relocate the applet to /usr/bin since it is no longer
executed by anything, but directly by the user
diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c
index 6a02326142..7f847d4668 100644
--- a/src/NetworkManagerPolicy.c
+++ b/src/NetworkManagerPolicy.c
@@ -386,23 +386,44 @@ static gboolean nm_policy_device_change_check (NMData *data)
}
else if (old_dev && new_dev)
{
- if (old_dev != new_dev)
+ NMActRequest * old_act_req = nm_device_get_act_request (old_dev);
+ gboolean old_user_requested = nm_act_request_get_user_requested (old_act_req);
+
+ if (nm_device_is_wired (old_dev))
{
- nm_info ("SWITCH: found better connection '%s' than current connection '%s'.", nm_device_get_iface (new_dev), nm_device_get_iface (old_dev));
- do_switch = TRUE;
+ /* Only switch if the old device was not user requested, and we are either switching to
+ * a new device. Note that new_dev will never be wireless since automatic device picking
+ * above will prefer a wired device to a wireless device.
+ */
+ if (!old_user_requested && (new_dev != old_dev))
+ {
+ nm_info ("SWITCH: found better connection '%s' than current connection '%s'.", nm_device_get_iface (new_dev), nm_device_get_iface (old_dev));
+ do_switch = TRUE;
+ }
}
- else if ((old_dev == new_dev) && nm_device_is_wireless (new_dev))
+ else if (nm_device_is_wireless (old_dev))
{
- NMAccessPoint *old_ap = nm_act_request_get_ap (nm_device_get_act_request (old_dev));
-
- /* Stick with the current access point unless we don't have a link to it anymore */
+ /* Only switch if the old device's wireless config is invalid */
+ if (nm_device_is_wireless (new_dev))
+ {
+ NMAccessPoint *old_ap = nm_act_request_get_ap (old_act_req);
+ const char * old_essid = nm_ap_get_essid (old_ap);
+ const char * new_essid = nm_ap_get_essid (ap);
- /* Schedule new activation if the currently associated access point is not the "best" one */
- if (strcmp (nm_ap_get_essid (old_ap), nm_ap_get_essid (ap)) != 0)
+ /* Schedule new activation if the currently associated access point is not the "best" one
+ * or we've lost the link to the old access point.
+ */
+ if ((strcmp (old_essid, new_essid) != 0) || !nm_device_has_active_link (old_dev))
+ {
+ nm_info ("SWITCH: found better connection '%s/%s' than current connection '%s/%s'.", nm_device_get_iface (new_dev),
+ new_essid, nm_device_get_iface (old_dev), old_essid);
+ do_switch = TRUE;
+ }
+ }
+ else if (nm_device_is_wired (new_dev))
{
- nm_info ("SWITCH: found better connection '%s/%s' than current connection '%s/%s'.", nm_device_get_iface (new_dev), nm_ap_get_essid (ap),
- nm_device_get_iface (old_dev), nm_ap_get_essid (old_ap));
- do_switch = TRUE;
+ if (!nm_device_has_active_link (old_dev))
+ do_switch = TRUE;
}
}
}