From 9e32ee785660e06a748fe73ee5fb745ca324805b Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 9 Sep 2004 21:34:40 +0000 Subject: [PATCH] 2004-09-09 Dan Williams * panel-applet/NMWirelessAppletDbus.c - Pull fresh devices and networks from NM when wireless networks change. Provides faster feedback of a forced wireless network * src/NetworkManagerDbus.c - Return error when "getMaxQuality" is called on a wired device - Make best_ap freezing actually work again, and signal cancellation of activation if there's already a device activation when the user freezes the best_ap * src/NetworkManagerDevice.c - Don't clear out the best_ap for wireless devices when the link goes down, that's done elsewhere - Kill any dhcp daemons when cancelling device activation since they may be stuck waiting for a DHCP address, and since we're cancelling activation we don't care about that anymore * src/NetworkManagerPolicy.c - Make sure to unref the device we ref earlier (we refed it to make sure it stuck around during device activation and such) - If we were going to change the best device, but its activating currently (and therefore the change didn't occur due to the check earlier) we mark the state changed to we come back to it later when device activation has canceled and its no longer activating * src/backends/NetworkManagerRedHat.c - SIGKILL dhcp daemons rather than SIGTERM-ing them git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@143 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 30 +++++++++++++++++++++++++++++ panel-applet/NMWirelessAppletDbus.c | 1 + src/NetworkManagerDbus.c | 15 ++++++++++++++- src/NetworkManagerDevice.c | 8 ++++---- src/NetworkManagerPolicy.c | 8 ++++++++ src/backends/NetworkManagerRedHat.c | 2 +- 6 files changed, 58 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7558b1d258..2fcb0bb4a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2004-09-09 Dan Williams + + * panel-applet/NMWirelessAppletDbus.c + - Pull fresh devices and networks from NM when wireless networks + change. Provides faster feedback of a forced wireless network + + * src/NetworkManagerDbus.c + - Return error when "getMaxQuality" is called on a wired device + - Make best_ap freezing actually work again, and signal cancellation + of activation if there's already a device activation when the user + freezes the best_ap + + * src/NetworkManagerDevice.c + - Don't clear out the best_ap for wireless devices when the link goes + down, that's done elsewhere + - Kill any dhcp daemons when cancelling device activation since they + may be stuck waiting for a DHCP address, and since we're cancelling + activation we don't care about that anymore + + * src/NetworkManagerPolicy.c + - Make sure to unref the device we ref earlier (we refed it to make sure + it stuck around during device activation and such) + - If we were going to change the best device, but its activating currently + (and therefore the change didn't occur due to the check earlier) + we mark the state changed to we come back to it later when device + activation has canceled and its no longer activating + + * src/backends/NetworkManagerRedHat.c + - SIGKILL dhcp daemons rather than SIGTERM-ing them + 2004-09-09 Bryan Clark * info-daemon/passphrase.glade: diff --git a/panel-applet/NMWirelessAppletDbus.c b/panel-applet/NMWirelessAppletDbus.c index 160b890dce..d2543510f2 100644 --- a/panel-applet/NMWirelessAppletDbus.c +++ b/panel-applet/NMWirelessAppletDbus.c @@ -1133,6 +1133,7 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa || dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating")) { nmwa_dbus_update_network_state (applet); + nmwa_dbus_update_devices (applet); nmwa_dbus_update_active_device (applet); } else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DevicesChanged")) diff --git a/src/NetworkManagerDbus.c b/src/NetworkManagerDbus.c index 7f36d15841..d74c2c520f 100644 --- a/src/NetworkManagerDbus.c +++ b/src/NetworkManagerDbus.c @@ -1030,7 +1030,18 @@ static DBusMessage *nm_dbus_devices_handle_request (DBusConnection *connection, else if (strcmp ("getIP4Address", request) == 0) dbus_message_append_args (reply_message, DBUS_TYPE_UINT32, nm_device_get_ip4_address (dev), DBUS_TYPE_INVALID); else if (strcmp ("getMaxQuality", request) == 0) + { + /* Only wireless devices have an active network */ + if (!nm_device_is_wireless (dev)) + { + dbus_message_unref (reply_message); + reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotWireless", + "Wired devices cannot have wireless networks."); + return (reply_message); + } + dbus_message_append_args (reply_message, DBUS_TYPE_UINT32, nm_device_get_max_quality (dev), DBUS_TYPE_INVALID); + } else if (strcmp ("getActiveNetwork", request) == 0) { NMAccessPoint *ap; @@ -1186,8 +1197,10 @@ static DBusHandlerResult nm_dbus_nm_message_handler (DBusConnection *connection, if ((ap = nm_ap_list_get_ap_by_essid (nm_device_ap_list_get (data->active_device), network))) { syslog (LOG_DEBUG, "Forcing AP '%s'", nm_ap_get_essid (ap)); - nm_device_freeze_best_ap (data->active_device); nm_device_set_best_ap (data->active_device, ap); + nm_device_freeze_best_ap (data->active_device); + if (nm_device_activating (data->active_device)) + nm_device_activation_signal_cancel (data->active_device); nm_data_mark_state_changed (data); } dbus_free (network); diff --git a/src/NetworkManagerDevice.c b/src/NetworkManagerDevice.c index 89dc7fe126..5df09d998a 100644 --- a/src/NetworkManagerDevice.c +++ b/src/NetworkManagerDevice.c @@ -443,8 +443,6 @@ void nm_device_set_link_active (NMDevice *dev, const gboolean link_active) g_return_if_fail (dev != NULL); dev->link_active = link_active; - if (!link_active && nm_device_is_wireless (dev)) - nm_device_set_best_ap (dev, NULL); } @@ -1252,7 +1250,7 @@ static gpointer nm_device_activation_worker (gpointer user_data) /* If we were told to quit activation, stop the thread and return */ if (nm_device_activation_cancel_if_needed (dev)) - return; + return (NULL); /* 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); @@ -1353,8 +1351,9 @@ void nm_device_activation_signal_cancel (NMDevice *dev) if (dev->activating) { - syslog (LOG_DEBUG, "nm_device_activation_signal_cancel(%s): canceled", nm_device_get_iface (dev)); + syslog (LOG_DEBUG, "nm_device_activation_signal_cancel(%s): cancelling", nm_device_get_iface (dev)); dev->quit_activation = TRUE; + nm_system_kill_all_dhcp_daemons (); /* dhcp daemons will block, so have to kill them to return control */ } } @@ -1715,6 +1714,7 @@ void nm_device_update_best_ap (NMDevice *dev) { nm_device_bring_down (dev); nm_device_set_essid (dev, ""); + nm_device_set_enc_key (dev, NULL); nm_device_bring_up (dev); } } diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index 9f25c175d8..384afd0383 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -301,6 +301,14 @@ gboolean nm_state_modification_monitor (gpointer user_data) } } + if (best_dev) + { + if (nm_device_activating (best_dev)) + nm_data_mark_state_changed (data); + + nm_device_unref (best_dev); + } + nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__); } else diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c index 0280d2c21d..6e34b2c818 100644 --- a/src/backends/NetworkManagerRedHat.c +++ b/src/backends/NetworkManagerRedHat.c @@ -109,7 +109,7 @@ void nm_system_device_stop_dhcp (NMDevice *dev) n_pid = atoi (s_pid); if (n_pid > 0) - kill (n_pid, SIGTERM); + kill (n_pid, SIGKILL); } g_free (buf); }