Commit 8c4b6c6a authored by Dan Williams's avatar Dan Williams
Browse files

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
parent e40b6041
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
......
......@@ -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;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment