2005-05-15 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerDevice.[ch]
	  src/NetworkManagerPolicy.c
	  src/NetworkManager.c
	  src/nm-dbus-nm.c
		- Remove the "just_added" parameter from nm_device_deactivate().  We no
			longer send the DeviceNoLongerActive signal unconditionally, but only
			when the device is actually active.

	* dispatcher-daemon/NetworkManagerDispatcher.c
		- (nmd_execute_scripts): convert to GLib directory functions from opendir(),
			and simplify the logic
		- (nmd_get_device_name): copy value from dbus reply so we don't segfault when
			we free it later on

	* initscript/RedHat/Makefile.am
	  initscript/RedHat/NetworkManagerDispatcher
		- Add initscript for NetworkManagerDispatcher


	Patch from Bill Moss:
	* dispatcher-daemon/NetworkManagerDispatcher.c
		- Remove IP4AddressChange signal code including nmd_get_device_ip4_address()

	* src/NetworkManagerDbus.c
		- (nm_dbus_signal_device_ip4_address_change): remove.  If the device goes up,
			and DeviceNowActive gets signaled, then the device has a new IP address
			anyway.  There's no need for a separate signal.

	* src/NetworkManagerDevice.c
		- (nm_device_update_ip4_address): Don't send IP4AddressChange signal

	* src/NetworkManagerPolicy.c
		- (nm_policy_activation_finish): Send DeviceNowActive signal when the device
			activates successfully.  This kind of went missing when I reworked the
			activation code.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@634 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2005-05-16 01:28:45 +00:00
parent eaf1a33b0d
commit c1069ccac5
11 changed files with 192 additions and 192 deletions

View File

@@ -1,3 +1,41 @@
2005-05-15 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerDevice.[ch]
src/NetworkManagerPolicy.c
src/NetworkManager.c
src/nm-dbus-nm.c
- Remove the "just_added" parameter from nm_device_deactivate(). We no
longer send the DeviceNoLongerActive signal unconditionally, but only
when the device is actually active.
* dispatcher-daemon/NetworkManagerDispatcher.c
- (nmd_execute_scripts): convert to GLib directory functions from opendir(),
and simplify the logic
- (nmd_get_device_name): copy value from dbus reply so we don't segfault when
we free it later on
* initscript/RedHat/Makefile.am
initscript/RedHat/NetworkManagerDispatcher
- Add initscript for NetworkManagerDispatcher
Patch from Bill Moss:
* dispatcher-daemon/NetworkManagerDispatcher.c
- Remove IP4AddressChange signal code including nmd_get_device_ip4_address()
* src/NetworkManagerDbus.c
- (nm_dbus_signal_device_ip4_address_change): remove. If the device goes up,
and DeviceNowActive gets signaled, then the device has a new IP address
anyway. There's no need for a separate signal.
* src/NetworkManagerDevice.c
- (nm_device_update_ip4_address): Don't send IP4AddressChange signal
* src/NetworkManagerPolicy.c
- (nm_policy_activation_finish): Send DeviceNowActive signal when the device
activates successfully. This kind of went missing when I reworked the
activation code.
2005-05-15 Dan Williams <dcbw@redhat.com> 2005-05-15 Dan Williams <dcbw@redhat.com>
* configure.in * configure.in

View File

@@ -35,27 +35,20 @@
#include <dirent.h> #include <dirent.h>
#include <string.h> #include <string.h>
#include "NetworkManager.h"
#include "nm-utils.h" #include "nm-utils.h"
#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager"
#define NM_DBUS_PATH "/org/freedesktop/NetworkManager"
#define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager"
enum NMDAction enum NMDAction
{ {
NMD_DEVICE_DONT_KNOW, NMD_DEVICE_DONT_KNOW,
NMD_DEVICE_NOW_INACTIVE, NMD_DEVICE_NOW_INACTIVE,
NMD_DEVICE_NOW_ACTIVE, NMD_DEVICE_NOW_ACTIVE,
NMD_DEVICE_IP4_ADDRESS_CHANGE
}; };
typedef enum NMDAction NMDAction; typedef enum NMDAction NMDAction;
#define NIPQUAD(addr) ((unsigned char)(addr)), \
((unsigned char)(addr>>8)), \ #define NM_SCRIPT_DIR "/etc/NetworkManager/dispatcher.d"
((unsigned char)(addr>>16)), \
((unsigned char)(addr>>24))
/* /*
* nmd_execute_scripts * nmd_execute_scripts
@@ -63,27 +56,31 @@ typedef enum NMDAction NMDAction;
* Call scripts in /etc/NetworkManager.d when devices go down or up * Call scripts in /etc/NetworkManager.d when devices go down or up
* *
*/ */
void nmd_execute_scripts (NMDAction action, char *iface_name, guint32 new_ip4_address) void nmd_execute_scripts (NMDAction action, char *iface_name)
{ {
DIR *dir = opendir ("/etc/NetworkManager.d"); GDir * dir;
struct dirent *ent; const char * file_name;
const char * char_act;
if (!dir) if (action == NMD_DEVICE_NOW_ACTIVE)
char_act = "up";
else if (action == NMD_DEVICE_NOW_INACTIVE)
char_act = "down";
else
return;
if (!(dir = g_dir_open (NM_SCRIPT_DIR, 0, NULL)))
{ {
nm_warning ("nmd_execute_scripts(): opendir() could not open /etc/NetworkManager.d. errno = %d", errno); nm_warning ("nmd_execute_scripts(): opendir() could not open '" NM_SCRIPT_DIR "'. errno = %d", errno);
return; return;
} }
do while ((file_name = g_dir_read_name (dir)))
{
errno = 0;
if ((ent = readdir (dir)) != NULL)
{ {
char * file_path = g_strdup_printf (NM_SCRIPT_DIR"/%s", file_name);
struct stat s; struct stat s;
char path[500];
snprintf (path, 499, "/etc/NetworkManager.d/%s", ent->d_name); if ((file_name[0] != '.') && (stat (file_path, &s) == 0))
if ((ent->d_name[0] != '.') && (stat (path, &s) == 0))
{ {
/* FIXME /* FIXME
* We should check the permissions and only execute files that * We should check the permissions and only execute files that
@@ -92,25 +89,18 @@ void nmd_execute_scripts (NMDAction action, char *iface_name, guint32 new_ip4_ad
if (S_ISREG (s.st_mode) && !S_ISLNK (s.st_mode) && (s.st_uid == 0)) if (S_ISREG (s.st_mode) && !S_ISLNK (s.st_mode) && (s.st_uid == 0))
{ {
int x; int x;
char cmd[500]; char *cmd;
if ((action == NMD_DEVICE_NOW_INACTIVE) || (action == NMD_DEVICE_NOW_ACTIVE)) cmd = g_strdup_printf ("%s %s %s", file_path, iface_name, char_act);
{
snprintf (cmd, 499, "%s %s %s", path, iface_name,
(action == NMD_DEVICE_NOW_INACTIVE ? "down" :
(action == NMD_DEVICE_NOW_ACTIVE ? "up" : "error")));
}
else if (action == NMD_DEVICE_IP4_ADDRESS_CHANGE)
{
snprintf (cmd, 499, "%s %s %u.%u.%u.%u", path, iface_name, NIPQUAD (new_ip4_address));
}
x = system (cmd); x = system (cmd);
g_free (cmd);
} }
} }
}
} while (ent);
closedir (dir); g_free (file_path);
}
g_dir_close (dir);
} }
@@ -121,94 +111,40 @@ void nmd_execute_scripts (NMDAction action, char *iface_name, guint32 new_ip4_ad
*/ */
char * nmd_get_device_name (DBusConnection *connection, char *path) char * nmd_get_device_name (DBusConnection *connection, char *path)
{ {
DBusMessage *message; DBusMessage * message;
DBusMessage *reply; DBusMessage * reply;
DBusError error; DBusError error;
char *dev_name = NULL; char * dbus_dev_name = NULL;
char * dev_name = NULL;
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE, "getName"))) if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE, "getName")))
{ {
nm_warning ("Couldn't allocate the dbus message"); nm_warning ("Couldn't allocate the dbus message");
return (NULL); return NULL;
} }
dbus_error_init (&error); dbus_error_init (&error);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error); reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
dbus_message_unref (message);
if (dbus_error_is_set (&error)) if (dbus_error_is_set (&error))
{ {
nm_warning ("%s raised: %s", error.name, error.message); nm_warning ("%s raised: %s", error.name, error.message);
dbus_message_unref (message); dbus_error_free (&error);
return (NULL); return NULL;
}
if (reply == NULL)
{
nm_warning ("dbus reply message was NULL" );
dbus_message_unref (message);
return (NULL);
} }
/* now analyze reply */ /* now analyze reply */
dbus_error_init (&error); if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &dbus_dev_name, DBUS_TYPE_INVALID))
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &dev_name, DBUS_TYPE_INVALID))
{ {
nm_warning ("There was an error getting the device name from NetworkManager." ); nm_warning ("There was an error getting the device name from NetworkManager." );
dev_name = NULL; dev_name = NULL;
} }
else
dev_name = g_strdup (dbus_dev_name);
dbus_message_unref (reply); dbus_message_unref (reply);
dbus_message_unref (message);
return (dev_name); return dev_name;
}
/*
* nmd_get_device_ip4_address
*
* Queries NetworkManager for the IPv4 address of a device, specified by a device path
*/
guint32 nmd_get_device_ip4_address (DBusConnection *connection, char *path)
{
DBusMessage *message;
DBusMessage *reply;
DBusError error;
guint32 address;
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE, "getIP4Address")))
{
nm_warning ("Couldn't allocate the dbus message");
return (0);
}
dbus_error_init (&error);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
if (dbus_error_is_set (&error))
{
nm_warning ("%s raised: %s", error.name, error.message);
dbus_message_unref (message);
return (0);
}
if (reply == NULL)
{
nm_warning ("dbus reply message was NULL" );
dbus_message_unref (message);
return (0);
}
/* now analyze reply */
dbus_error_init (&error);
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &address, DBUS_TYPE_INVALID))
{
nm_warning ("There was an error getting the device's IPv4 address from NetworkManager." );
address = 0;
}
dbus_message_unref (reply);
dbus_message_unref (message);
return (address);
} }
@@ -228,9 +164,7 @@ static DBusHandlerResult nmd_dbus_filter (DBusConnection *connection, DBusMessag
dbus_error_init (&error); dbus_error_init (&error);
object_path = dbus_message_get_path (message); object_path = dbus_message_get_path (message);
if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceIP4AddressChange")) if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
action = NMD_DEVICE_IP4_ADDRESS_CHANGE;
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
action = NMD_DEVICE_NOW_INACTIVE; action = NMD_DEVICE_NOW_INACTIVE;
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive")) else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive"))
action = NMD_DEVICE_NOW_ACTIVE; action = NMD_DEVICE_NOW_ACTIVE;
@@ -239,30 +173,23 @@ static DBusHandlerResult nmd_dbus_filter (DBusConnection *connection, DBusMessag
{ {
if (dbus_message_get_args (message, &error, DBUS_TYPE_OBJECT_PATH, &dev_object_path, DBUS_TYPE_INVALID)) if (dbus_message_get_args (message, &error, DBUS_TYPE_OBJECT_PATH, &dev_object_path, DBUS_TYPE_INVALID))
{ {
char * dev_iface_name; char * dev_iface_name = NULL;
guint32 dev_ip4_address;
dev_object_path = nm_dbus_unescape_object_path (dev_object_path); dev_object_path = nm_dbus_unescape_object_path (dev_object_path);
if (dev_object_path)
dev_ip4_address = nmd_get_device_ip4_address (connection, dev_object_path);
dev_iface_name = nmd_get_device_name (connection, dev_object_path); dev_iface_name = nmd_get_device_name (connection, dev_object_path);
if (action == NMD_DEVICE_NOW_ACTIVE || action == NMD_DEVICE_NOW_INACTIVE) if (dev_object_path && dev_iface_name)
{ {
nm_info ("Device %s (%s) is now %s.", dev_object_path, dev_iface_name, nm_info ("Device %s (%s) is now %s.", dev_object_path, dev_iface_name,
(action == NMD_DEVICE_NOW_INACTIVE ? "down" : (action == NMD_DEVICE_NOW_INACTIVE ? "down" :
(action == NMD_DEVICE_NOW_ACTIVE ? "up" : "error"))); (action == NMD_DEVICE_NOW_ACTIVE ? "up" : "error")));
}
else if (action == NMD_DEVICE_IP4_ADDRESS_CHANGE) nmd_execute_scripts (action, dev_iface_name);
{
nm_info ("Device %s (%s) now has address %u.%u.%u.%u", dev_object_path, dev_iface_name,
NIPQUAD(dev_ip4_address));
} }
nmd_execute_scripts (action, dev_iface_name, dev_ip4_address);
g_free (dev_iface_name);
g_free (dev_object_path); g_free (dev_object_path);
g_free (dev_iface_name);
handled = TRUE; handled = TRUE;
} }

View File

@@ -1,5 +1,5 @@
EXTRA_DIST = NetworkManager EXTRA_DIST = NetworkManager NetworkManagerDispatcher
initddir = $(sysconfdir)/rc.d/init.d initddir = $(sysconfdir)/rc.d/init.d
initd_SCRIPTS = NetworkManager initd_SCRIPTS = NetworkManager NetworkManagerDispatcher

View File

@@ -0,0 +1,74 @@
#!/bin/sh
#
# NetworkManager: NetworkManagerDispatcher daemon
#
# chkconfig: - 98 02
# description: This daemon automatically runs scripts when NetworkManager \
# changes the network state.
#
# processname: NetworkManagerDispatcher
# pidfile: /var/run/NetworkManagerDispatcher.pid
#
# Sanity checks.
[ -x /usr/bin/NetworkManagerDispatcher ] || exit 1
# Source function library.
. /etc/rc.d/init.d/functions
# so we can rearrange this easily
processname=NetworkManagerDispatcher
servicename=NetworkManagerDispatcher
pidfile=/var/run/NetworkManagerDispatcher.pid
RETVAL=0
start()
{
echo -n $"Starting NetworkManagerDispatcher daemon: "
daemon --check $servicename $processname
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename && echo `/sbin/pidof $processname` > $pidfile
}
stop()
{
echo -n $"Stopping NetworkManagerDispatcher daemon: "
killproc $servicename -TERM
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$servicename
rm -f $pidfile
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $processname
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$servicename ]; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
;;
esac
exit $RETVAL

View File

@@ -131,7 +131,7 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi, cons
nm_device_is_wireless (dev) ? "wireless" : "wired", nm_device_get_iface (dev)); nm_device_is_wireless (dev) ? "wireless" : "wired", nm_device_get_iface (dev));
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); nm_device_deactivate (dev);
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__); nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
@@ -176,7 +176,7 @@ void nm_remove_device_from_list (NMData *data, const char *udi)
if (dev && (nm_null_safe_strcmp (nm_device_get_udi (dev), udi) == 0)) if (dev && (nm_null_safe_strcmp (nm_device_get_udi (dev), udi) == 0))
{ {
nm_device_set_removed (dev, TRUE); nm_device_set_removed (dev, TRUE);
nm_device_deactivate (dev, FALSE); nm_device_deactivate (dev);
nm_device_worker_thread_stop (dev); nm_device_worker_thread_stop (dev);
nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_REMOVED); nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_REMOVED);
@@ -451,7 +451,7 @@ static void device_stop_and_free (NMDevice *dev, gpointer user_data)
g_return_if_fail (dev != NULL); g_return_if_fail (dev != NULL);
nm_device_set_removed (dev, TRUE); nm_device_set_removed (dev, TRUE);
nm_device_deactivate (dev, FALSE); nm_device_deactivate (dev);
nm_device_unref (dev); nm_device_unref (dev);
} }

View File

@@ -343,42 +343,6 @@ void nm_dbus_signal_state_change (DBusConnection *connection, NMData *data)
dbus_message_unref (message); dbus_message_unref (message);
} }
/*
* nm_dbus_signal_device_ip4_address_change
*
* Notifies the bus that a particular device's IPv4 address changed.
*
*/
void nm_dbus_signal_device_ip4_address_change (DBusConnection *connection, NMDevice *dev)
{
DBusMessage *message;
gchar *dev_path;
g_return_if_fail (connection != NULL);
g_return_if_fail (dev != NULL);
if (!(dev_path = nm_dbus_get_object_path_for_device (dev)))
return;
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceIP4AddressChange");
if (!message)
{
nm_warning ("nm_dbus_signal_device_ip4_address_change(): Not enough memory for new dbus message!");
g_free (dev_path);
return;
}
dbus_message_append_args (message, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_INVALID);
g_free (dev_path);
if (!dbus_connection_send (connection, message, NULL))
nm_warning ("nm_dbus_signal_device_ip4_address_change(): Could not raise the IP4AddressChange signal!");
dbus_message_unref (message);
}
/* /*
* nm_dbus_signal_wireless_network_change * nm_dbus_signal_wireless_network_change
* *

View File

@@ -64,8 +64,6 @@ void nm_dbus_schedule_device_status_change_signal (NMData *data, NMDevice *dev
void nm_dbus_signal_state_change (DBusConnection *connection, NMData *data); void nm_dbus_signal_state_change (DBusConnection *connection, NMData *data);
void nm_dbus_signal_device_ip4_address_change(DBusConnection *connection, NMDevice *dev);
void nm_dbus_signal_wireless_network_change (DBusConnection *connection, NMDevice *dev, NMAccessPoint *ap, NMNetworkStatus status, gint8 strength); void nm_dbus_signal_wireless_network_change (DBusConnection *connection, NMDevice *dev, NMAccessPoint *ap, NMNetworkStatus status, gint8 strength);
void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMActRequest *req); void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMActRequest *req);

View File

@@ -676,7 +676,7 @@ void nm_device_set_link_active (NMDevice *dev, const gboolean link_active)
/* Deactivate a currently active device */ /* Deactivate a currently active device */
if (!link_active && nm_device_get_act_request (dev)) if (!link_active && nm_device_get_act_request (dev))
{ {
nm_device_deactivate (dev, FALSE); nm_device_deactivate (dev);
nm_policy_schedule_device_change_check (dev->app_data); nm_policy_schedule_device_change_check (dev->app_data);
} }
else if (link_active && !nm_device_get_act_request (dev)) else if (link_active && !nm_device_get_act_request (dev))
@@ -1485,13 +1485,8 @@ void nm_device_update_ip4_address (NMDevice *dev)
return; return;
new_address = ((struct sockaddr_in *)(&req.ifr_addr))->sin_addr.s_addr; new_address = ((struct sockaddr_in *)(&req.ifr_addr))->sin_addr.s_addr;
/* If the new address is different, send an IP4AddressChanged signal on the bus */
if (new_address != nm_device_get_ip4_address (dev)) if (new_address != nm_device_get_ip4_address (dev))
{
nm_dbus_signal_device_ip4_address_change (dev->app_data->dbus_connection, dev);
dev->ip4_address = new_address; dev->ip4_address = new_address;
}
} }
@@ -3121,7 +3116,7 @@ void nm_device_activation_cancel (NMDevice *dev)
* Remove a device's routing table entries and IP address. * Remove a device's routing table entries and IP address.
* *
*/ */
gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added) gboolean nm_device_deactivate (NMDevice *dev)
{ {
NMIP4Config * config; NMIP4Config * config;
@@ -3130,6 +3125,12 @@ gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added)
nm_info ("Deactivating device %s.", nm_device_get_iface (dev)); nm_info ("Deactivating device %s.", nm_device_get_iface (dev));
if (dev->act_request)
{
/* Only send if the device is actually active */
nm_dbus_schedule_device_status_change_signal (dev->app_data, dev, NULL, DEVICE_NO_LONGER_ACTIVE);
}
if (nm_device_is_activating (dev)) if (nm_device_is_activating (dev))
nm_device_activation_cancel (dev); nm_device_activation_cancel (dev);
@@ -3141,7 +3142,7 @@ gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added)
} }
if (nm_device_get_driver_support_level (dev) == NM_DRIVER_UNSUPPORTED) if (nm_device_get_driver_support_level (dev) == NM_DRIVER_UNSUPPORTED)
return (TRUE); return TRUE;
nm_vpn_manager_deactivate_vpn_connection (dev->app_data->vpn_manager); nm_vpn_manager_deactivate_vpn_connection (dev->app_data->vpn_manager);
@@ -3158,9 +3159,6 @@ gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added)
nm_system_device_flush_addresses (dev); nm_system_device_flush_addresses (dev);
nm_device_update_ip4_address (dev); nm_device_update_ip4_address (dev);
if (!just_added)
nm_dbus_schedule_device_status_change_signal (dev->app_data, dev, NULL, DEVICE_NO_LONGER_ACTIVE);
/* Clean up stuff, don't leave the card associated */ /* Clean up stuff, don't leave the card associated */
if (nm_device_is_wireless (dev)) if (nm_device_is_wireless (dev))
{ {

View File

@@ -101,7 +101,7 @@ void nm_device_activate_schedule_stage4_ip_config_timeout (NMActRequest *req);
void nm_device_activation_cancel (NMDevice *dev); void nm_device_activation_cancel (NMDevice *dev);
gboolean nm_device_activation_should_cancel (NMDevice *dev); gboolean nm_device_activation_should_cancel (NMDevice *dev);
gboolean nm_device_is_activating (NMDevice *dev); gboolean nm_device_is_activating (NMDevice *dev);
gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added); gboolean nm_device_deactivate (NMDevice *dev);
NMAccessPoint *nm_device_wireless_get_activation_ap (NMDevice *dev, const char *essid, const char *key, NMEncKeyType key_type); NMAccessPoint *nm_device_wireless_get_activation_ap (NMDevice *dev, const char *essid, const char *key, NMEncKeyType key_type);

View File

@@ -74,6 +74,7 @@ gboolean nm_policy_activation_finish (NMActRequest *req)
} }
nm_info ("Activation (%s) successful, device activated.", nm_device_get_iface (dev)); nm_info ("Activation (%s) successful, device activated.", nm_device_get_iface (dev));
nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_NOW_ACTIVE);
nm_schedule_state_change_signal_broadcast (data); nm_schedule_state_change_signal_broadcast (data);
out: out:
@@ -154,7 +155,7 @@ static gboolean nm_policy_activation_failed (NMActRequest *req)
nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_ACTIVATION_FAILED); nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_ACTIVATION_FAILED);
} }
nm_device_deactivate (dev, FALSE); nm_device_deactivate (dev);
nm_schedule_state_change_signal_broadcast (data); nm_schedule_state_change_signal_broadcast (data);
nm_policy_schedule_device_change_check (data); nm_policy_schedule_device_change_check (data);
@@ -372,7 +373,7 @@ static gboolean nm_policy_device_change_check (NMData *data)
{ {
/* Terminate current connection */ /* Terminate current connection */
nm_info ("SWITCH: terminating current connection '%s' because it's no longer valid.", nm_device_get_iface (old_dev)); nm_info ("SWITCH: terminating current connection '%s' because it's no longer valid.", nm_device_get_iface (old_dev));
nm_device_deactivate (old_dev, FALSE); nm_device_deactivate (old_dev);
do_switch = TRUE; do_switch = TRUE;
} }
else if (old_dev && new_dev) else if (old_dev && new_dev)
@@ -466,7 +467,7 @@ static gboolean nm_policy_device_activation (NMActRequest *req)
g_assert (data); g_assert (data);
if ((old_dev = nm_get_active_device (data))) if ((old_dev = nm_get_active_device (data)))
nm_device_deactivate (old_dev, FALSE); nm_device_deactivate (old_dev);
new_dev = nm_act_request_get_dev (req); new_dev = nm_act_request_get_dev (req);
if (nm_device_is_activating (new_dev)) if (nm_device_is_activating (new_dev))

View File

@@ -162,7 +162,7 @@ static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DB
goto out; goto out;
} }
nm_device_deactivate (dev, FALSE); nm_device_deactivate (dev);
nm_schedule_state_change_signal_broadcast (data->data); nm_schedule_state_change_signal_broadcast (data->data);
@@ -378,7 +378,7 @@ static DBusMessage *nm_dbus_nm_set_wireless_enabled (DBusConnection *connection,
NMDevice *dev = (NMDevice *)(elt->data); NMDevice *dev = (NMDevice *)(elt->data);
if (nm_device_is_wireless (dev)) if (nm_device_is_wireless (dev))
{ {
nm_device_deactivate (dev, FALSE); nm_device_deactivate (dev);
nm_device_bring_down (dev); nm_device_bring_down (dev);
} }
} }
@@ -419,7 +419,7 @@ static DBusMessage *nm_dbus_nm_sleep (DBusConnection *connection, DBusMessage *m
{ {
NMDevice *dev = (NMDevice *)(elt->data); NMDevice *dev = (NMDevice *)(elt->data);
nm_device_deactivate (dev, FALSE); nm_device_deactivate (dev);
nm_device_bring_down (dev); nm_device_bring_down (dev);
} }
nm_unlock_mutex (app_data->dev_list_mutex, __FUNCTION__); nm_unlock_mutex (app_data->dev_list_mutex, __FUNCTION__);