2004-09-28 Dan Williams <dcbw@redhat.com>
* src/NetworkManager.c src/NetworkManagerDevice.c src/NetworkManagerPolicy.c - Don't blow away an active wired connection on startup git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@177 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2004-09-28 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/NetworkManager.c
|
||||||
|
src/NetworkManagerDevice.c
|
||||||
|
src/NetworkManagerPolicy.c
|
||||||
|
- Don't blow away an active wired connection on startup
|
||||||
|
|
||||||
2004-09-28 Bryan Clark <clarkbw@cvs.gnome.org>
|
2004-09-28 Bryan Clark <clarkbw@cvs.gnome.org>
|
||||||
|
|
||||||
Changes from J5
|
Changes from J5
|
||||||
|
@@ -118,7 +118,14 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi, cons
|
|||||||
nm_device_get_iface (dev), nm_device_is_wireless (dev) ? "wireless" : "wired" );
|
nm_device_get_iface (dev), nm_device_is_wireless (dev) ? "wireless" : "wired" );
|
||||||
|
|
||||||
data->dev_list = g_slist_append (data->dev_list, dev);
|
data->dev_list = g_slist_append (data->dev_list, dev);
|
||||||
nm_device_deactivate (dev, TRUE);
|
|
||||||
|
/* We don't take down wired devices that are already set up when NetworkManager gets
|
||||||
|
* launched. Plays better with the system.
|
||||||
|
*
|
||||||
|
* FIXME: IPv6 here too
|
||||||
|
*/
|
||||||
|
if (!(data->starting_up && nm_device_is_wired (dev) && nm_device_get_ip4_address (dev)))
|
||||||
|
nm_device_deactivate (dev, TRUE);
|
||||||
|
|
||||||
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
||||||
|
|
||||||
@@ -452,6 +459,7 @@ static NMData *nm_data_new (gboolean enable_test_devices)
|
|||||||
|
|
||||||
data->state_modified = TRUE;
|
data->state_modified = TRUE;
|
||||||
data->enable_test_devices = enable_test_devices;
|
data->enable_test_devices = enable_test_devices;
|
||||||
|
data->starting_up = TRUE;
|
||||||
|
|
||||||
return (data);
|
return (data);
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ typedef struct NMData
|
|||||||
DBusConnection *dbus_connection;
|
DBusConnection *dbus_connection;
|
||||||
gboolean info_daemon_avail;
|
gboolean info_daemon_avail;
|
||||||
gboolean enable_test_devices;
|
gboolean enable_test_devices;
|
||||||
|
gboolean starting_up; /* Hack for not taking down an already-set-up wired device when we launch */
|
||||||
|
|
||||||
GSList *dev_list;
|
GSList *dev_list;
|
||||||
GMutex *dev_list_mutex;
|
GMutex *dev_list_mutex;
|
||||||
|
@@ -329,6 +329,7 @@ NMDevice *nm_device_new (const char *iface, gboolean test_dev, NMDeviceType test
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Grab IP config data for this device from the system configuration files */
|
/* Grab IP config data for this device from the system configuration files */
|
||||||
|
nm_device_update_ip4_address (dev);
|
||||||
nm_system_device_update_config_info (dev);
|
nm_system_device_update_config_info (dev);
|
||||||
|
|
||||||
/* Have to bring the device up before checking link status. */
|
/* Have to bring the device up before checking link status. */
|
||||||
@@ -585,8 +586,6 @@ char * nm_device_get_essid (NMDevice *dev)
|
|||||||
{
|
{
|
||||||
int iwlib_socket;
|
int iwlib_socket;
|
||||||
int err;
|
int err;
|
||||||
struct iwreq wreq;
|
|
||||||
char essid[IW_ESSID_MAX_SIZE + 1];
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, NULL);
|
g_return_val_if_fail (dev != NULL, NULL);
|
||||||
g_return_val_if_fail (nm_device_is_wireless (dev), NULL);
|
g_return_val_if_fail (nm_device_is_wireless (dev), NULL);
|
||||||
@@ -1093,6 +1092,20 @@ gboolean nm_device_activation_begin (NMDevice *dev)
|
|||||||
/* Ref the device so it doesn't go away while worker function is active */
|
/* Ref the device so it doesn't go away while worker function is active */
|
||||||
nm_device_ref (dev);
|
nm_device_ref (dev);
|
||||||
|
|
||||||
|
/* Don't attempt to actually activate if we are just starting NetworkManager and
|
||||||
|
* we are about to activate a wired device that's already configured. Plays nicer
|
||||||
|
* with the system when NM is started after a network is already set up.
|
||||||
|
*
|
||||||
|
* FIXME: IPv6 here too, and this really should not be here, it should be part of
|
||||||
|
* the policy, not the device code itself.
|
||||||
|
*/
|
||||||
|
if (data->starting_up && nm_device_is_wired (data->active_device) && nm_device_get_ip4_address (data->active_device))
|
||||||
|
{
|
||||||
|
dev->activating = FALSE;
|
||||||
|
dev->just_activated = TRUE;
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset communication flags between worker and main thread */
|
/* Reset communication flags between worker and main thread */
|
||||||
dev->activating = TRUE;
|
dev->activating = TRUE;
|
||||||
dev->just_activated = FALSE;
|
dev->just_activated = FALSE;
|
||||||
@@ -1130,7 +1143,6 @@ gboolean nm_device_activation_should_cancel (NMDevice *dev)
|
|||||||
syslog (LOG_DEBUG, "nm_device_activation_worker(%s): activation canceled.", nm_device_get_iface (dev));
|
syslog (LOG_DEBUG, "nm_device_activation_worker(%s): activation canceled.", nm_device_get_iface (dev));
|
||||||
dev->activating = FALSE;
|
dev->activating = FALSE;
|
||||||
dev->just_activated = FALSE;
|
dev->just_activated = FALSE;
|
||||||
nm_device_unref (dev);
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1365,7 +1377,10 @@ static gpointer nm_device_activation_worker (gpointer user_data)
|
|||||||
|
|
||||||
/* If we were told to quit activation, stop the thread and return */
|
/* If we were told to quit activation, stop the thread and return */
|
||||||
if (nm_device_activation_should_cancel (dev))
|
if (nm_device_activation_should_cancel (dev))
|
||||||
|
{
|
||||||
|
nm_device_unref (dev);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Since we've got a link, the encryption method must be good */
|
/* Since we've got a link, the encryption method must be good */
|
||||||
nm_ap_set_enc_method_good (nm_device_get_best_ap (dev), TRUE);
|
nm_ap_set_enc_method_good (nm_device_get_best_ap (dev), TRUE);
|
||||||
@@ -1399,7 +1414,10 @@ static gpointer nm_device_activation_worker (gpointer user_data)
|
|||||||
|
|
||||||
/* If we were told to quit activation, stop the thread and return */
|
/* If we were told to quit activation, stop the thread and return */
|
||||||
if (nm_device_activation_should_cancel (dev))
|
if (nm_device_activation_should_cancel (dev))
|
||||||
|
{
|
||||||
|
nm_device_unref (dev);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Make system aware of any new DNS settings from resolv.conf */
|
/* Make system aware of any new DNS settings from resolv.conf */
|
||||||
nm_system_update_dns ();
|
nm_system_update_dns ();
|
||||||
@@ -1407,7 +1425,10 @@ static gpointer nm_device_activation_worker (gpointer user_data)
|
|||||||
|
|
||||||
/* If we were told to quit activation, stop the thread and return */
|
/* If we were told to quit activation, stop the thread and return */
|
||||||
if (nm_device_activation_should_cancel (dev))
|
if (nm_device_activation_should_cancel (dev))
|
||||||
|
{
|
||||||
|
nm_device_unref (dev);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
dev->just_activated = TRUE;
|
dev->just_activated = TRUE;
|
||||||
syslog (LOG_DEBUG, "nm_device_activation_worker(%s): device activated", nm_device_get_iface (dev));
|
syslog (LOG_DEBUG, "nm_device_activation_worker(%s): device activated", nm_device_get_iface (dev));
|
||||||
|
@@ -329,5 +329,11 @@ gboolean nm_state_modification_monitor (gpointer user_data)
|
|||||||
syslog (LOG_INFO, "nm_state_modification_monitor() activated device %s", nm_device_get_iface (data->active_device));
|
syslog (LOG_INFO, "nm_state_modification_monitor() activated device %s", nm_device_get_iface (data->active_device));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear the starting up flag, so we will now take over and have our way with
|
||||||
|
* any device we find out about.
|
||||||
|
*/
|
||||||
|
if (data->starting_up)
|
||||||
|
data->starting_up = FALSE;
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user