2004-06-24 Dan Williams <dcbw@redhat.com>

* NetworkManager.c
	    - Spacing cleanups
	    - Flush device routes and ip addresses when added to the device list

	* NetworkManagerDbus.c
	    - Spacing cleanups
	    - Add missing returns in the two signal functions

	* NetworkManagerPolicy.c
	    - Spacing and variable cleanups


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@10 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2004-06-24 18:20:48 +00:00
parent 873738b61b
commit 80f835caed
4 changed files with 42 additions and 17 deletions

View file

@ -1,3 +1,16 @@
2004-06-24 Dan Williams <dcbw@redhat.com>
* NetworkManager.c
- Spacing cleanups
- Flush device routes and ip addresses when added to the device list
* NetworkManagerDbus.c
- Spacing cleanups
- Add missing returns in the two signal functions
* NetworkManagerPolicy.c
- Spacing and variable cleanups
2004-06-24 Dan Williams <dcbw@redhat.com>
* Makefile.am
@ -6,18 +19,20 @@
dispatcher-daemon/Makefile.am
dispatcher-daemon/Makefile.in
dispatcher-daemon/NetworkManagerDispatcher.c
Add a daemon that receives signals from NetworkManager
and will (eventually) call scripts in /etc/somewhere
when devices go up or down.
- Add a daemon that receives signals from NetworkManager
and will (eventually) call scripts in /etc/somewhere
when devices go up or down.
* NetworkManager.c
NetworkManagerDbus.c
Spacing cleanups.
- Spacing cleanups
- Flush device routes and ip addresses when added to the device list
* NetworkManagerDbus.c
- Spacing cleanups
- Add missing returns in the two signal functions
* NetworkManagerPolicy.c
- Spacing and variable cleanups
- Rename nm_policy_switch_interface->nm_policy_switch_device
- nm_policy_switch_device():
Use kill (pid) instead of system ("kill <pid>")

View file

@ -90,6 +90,8 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi)
*/
if (nm_try_acquire_mutex (data->dev_list_mutex, __FUNCTION__))
{
unsigned char buf[500];
NM_DEBUG_PRINT_3( "nm_create_device_and_add_to_list() adding udi='%s', iface='%s', iface_type=%s\n",
nm_device_get_udi (dev), nm_device_get_iface (dev), nm_device_get_iface_type (dev) == NM_IFACE_TYPE_WIRELESS_ETHERNET ? "wireless" : "wired" );
@ -109,6 +111,15 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi)
if (!nm_device_is_up (dev))
nm_device_bring_up (dev);
}
/* Remove routing table entries */
snprintf (buf, 500, "/sbin/ip route flush dev %s", nm_device_get_iface (dev));
system (buf);
/* Remove ip address */
snprintf (buf, 500, "/sbin/ip address flush dev %s", nm_device_get_iface (dev));
system (buf);
success = TRUE;
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);

View file

@ -370,6 +370,7 @@ void nm_dbus_signal_device_no_longer_active (DBusConnection *connection, NMDevic
if (!message)
{
NM_DEBUG_PRINT ("nm_dbus_signal_device_no_longer_active(): Not enough memory for new dbus message!\n");
return;
}
nm_dbus_get_object_path_from_device (dev, object_path, 100, FALSE);
@ -398,6 +399,7 @@ void nm_dbus_signal_device_now_active (DBusConnection *connection, NMDevice *dev
if (!message)
{
NM_DEBUG_PRINT ("nm_dbus_signal_device_now_active(): Not enough memory for new dbus message!\n");
return;
}
nm_dbus_get_object_path_from_device (dev, object_path, 100, FALSE);

View file

@ -171,7 +171,7 @@ static void nm_policy_switch_device (NMData *data, NMDevice *switch_to_dev, NMDe
gboolean nm_state_modification_monitor (gpointer user_data)
{
NMData *data = (NMData *)user_data;
gboolean modified = FALSE;
gboolean modified = FALSE;
g_return_val_if_fail (data != NULL, TRUE);
@ -192,7 +192,6 @@ gboolean nm_state_modification_monitor (gpointer user_data)
if (nm_try_acquire_mutex (data->dev_list_mutex, __FUNCTION__))
{
GSList *element = data->dev_list;
NMDevice *dev = NULL;
NMDevice *best_wired_dev = NULL;
guint best_wired_prio = 0;
NMDevice *best_wireless_dev = NULL;
@ -203,9 +202,10 @@ gboolean nm_state_modification_monitor (gpointer user_data)
while (element)
{
guint priority = 0;
guint iface_type;
gboolean link_active;
NMDevice *dev = NULL;
guint iface_type;
gboolean link_active;
guint prio = 0;
dev = (NMDevice *)(element->data);
@ -214,8 +214,6 @@ gboolean nm_state_modification_monitor (gpointer user_data)
if (iface_type == NM_IFACE_TYPE_WIRED_ETHERNET)
{
guint prio = 0;
if (link_active)
prio += 1;
@ -223,6 +221,7 @@ gboolean nm_state_modification_monitor (gpointer user_data)
&& (dev == data->active_device)
&& link_active)
prio += 1;
if (prio > best_wired_prio)
{
best_wired_dev = dev;
@ -231,8 +230,6 @@ gboolean nm_state_modification_monitor (gpointer user_data)
}
else if (iface_type == NM_IFACE_TYPE_WIRELESS_ETHERNET)
{
guint prio = 0;
if (link_active)
prio += 1;