1 diff -urN NetworkManager/ChangeLog NetworkManager-SVN/ChangeLog
2 --- NetworkManager/ChangeLog 2007-09-08 00:09:05.000000000 +0200
3 +++ NetworkManager-SVN/ChangeLog 2007-09-08 00:07:08.000000000 +0200
5 +2007-08-30 Dan Williams <dcbw@redhat.com>
8 + - Include config.h to get defines for endiannes (gnome.org #420216)
10 +2007-07-26 Dan Williams <dcbw@redhat.com>
12 + Patch from Bernhard Miklautz <bernhard.miklautz@shacknet.at>
14 + * src/NetworkManagerSystem.c
15 + - (nm_system_device_set_ip4_route): don't add the route if it's on the
16 + same subnet (#437396)
18 +2007-07-26 Dan Williams <dcbw@redhat.com>
20 + * src/nm-device-802-11-wireless.c
21 + - (real_start): I hate orinoco; apparently has trouble scanning too soon
22 + after being brought up, so do the initial scan a bit later.
24 +2007-06-27 Dan Williams <dcbw@redhat.com>
26 + * src/NetworkManager.c
27 + - (nm_hal_init): set hardware RF to enabled if no killswitches are found
28 + after the initial discovery
30 +2007-06-21 Dan Williams <dcbw@redhat.com>
32 + More fixes for Fedora #194124, gnome.org #354565
34 + * src/nm-device-802-3-ethernet.c
35 + - (real_act_stage1_prepare): new function; fail activation if device
38 + * src/NetworkManagerPolicy.c
39 + - (nm_policy_activation_finish): ensure device is actually activated
40 + before sending out signals. Fixes a race where device cancellation
41 + would be processed right after finish was scheduled, but not run.
42 + - (nm_policy_device_change_check, nm_policy_schedule_device_change_check):
43 + ensure device change check GSource ID is locked across threads;
44 + allow interruption of activation of 802.3 ethernet devices that no
45 + longer have an active link, and ensure that 802.3 ethernet devices
46 + have an active link before starting activation
48 +2007-06-21 Dan Williams <dcbw@redhat.com>
50 + Add HAL-based rfkill support, based on a patch from Benjamin Kahn.
52 + * src/NetworkManagerDbus.[ch]
53 + - (nm_dbus_signal_wireless_enabled): new function, emit signals when
54 + wireless enabled status changes
57 + - (nm_dbus_nm_set_wireless_enabled): handle hardware rfkill correctly;
58 + send errors when hardware switch overrides user request, and send
59 + signals when wireless enabled state changes
60 + - (nm_dbus_nm_get_wireless_enabled): send additional 'hardware rf enabled'
61 + argument in method reply
63 + * src/NetworkManager.c
64 + - (handle_killswitch_pcall_done, nm_killswitch_getpower_reply_cb,
65 + nm_poll_killswitches, nm_add_killswitch_device,
66 + nm_add_initial_killswitch_devices): new functions; detect and handle
67 + hardware killswitches exported by HAL. Unfortunately we have to
68 + poll the switches because HAL doesn't support signals for killswitches
70 + - (nm_hal_device_new_capability): detect killswitches added asynchronously
71 + - (nm_hal_init): look for killswitches when connecting to HAL
72 + - (nm_hal_deinit): dispose of killswitches when deiniting HAL data
74 + * src/NetworkManagerMain.h
75 + - Add bits to track killswitches
77 +2007-06-12 Dan Williams <dcbw@redhat.com>
80 + - (real_act_stage3_ip_config_start): sometimes the device gets downed
81 + during the wpa_supplicant association. Ensure the device is up
82 + before it's used for IP configuration.
84 +2007-06-07 Dan Williams <dcbw@redhat.com>
86 + Patch from Jon Nettleton <jon.nettleton@gmail.com>
88 + * src/nm-device-802-11-wireless.c:
89 + - (real_act_stage2_config): sleep 1 second to allow link status
92 +2007-06-07 Dan Williams <dcbw@redhat.com>
94 + * (nm_device_802_3_ethernet_link_activated,
95 + nm_device_802_3_ethernet_link_deactivated): fix ethernet link detection
96 + behavior due to races between the netlink code and when the
97 + device thread recognizes the change. Checking the link state
98 + before scheduling the change even on the device thread is wrong.
99 + (gnome.org #354565, rh #194124)
101 +2007-04-25 Dan Williams <dcbw@redhat.com>
103 + * initscript/RedHat/NetworkManager.in: remove trailing backslash
104 + (gnome.org #432401)
106 2007-04-18 Tambet Ingo <tambet@ximian.com>
108 * src/nm-dbus-nmi.c (nm_dbus_get_user_key_for_network_cb): Update the security
109 diff -urN NetworkManager/libnm-util/sha1.c NetworkManager-SVN/libnm-util/sha1.c
110 --- NetworkManager/libnm-util/sha1.c 2007-09-08 00:09:05.000000000 +0200
111 +++ NetworkManager-SVN/libnm-util/sha1.c 2007-09-08 00:07:00.000000000 +0200
113 * See README and COPYING for more details.
116 +#ifdef HAVE_CONFIG_H
123 diff -urN NetworkManager/src/NetworkManager.c NetworkManager-SVN/src/NetworkManager.c
124 --- NetworkManager/src/NetworkManager.c 2007-09-08 00:09:05.000000000 +0200
125 +++ NetworkManager-SVN/src/NetworkManager.c 2007-09-08 00:06:44.000000000 +0200
128 static gboolean sigterm_pipe_handler (GIOChannel *src, GIOCondition condition, gpointer data);
129 static void nm_data_free (NMData *data);
130 +static gboolean nm_poll_killswitches(gpointer user_data);
133 * nm_get_device_interface_from_hal
134 @@ -274,6 +275,183 @@
138 +static void handle_killswitch_pcall_done (NMData *data, DBusPendingCall * pcall)
141 + gboolean now_enabled = FALSE;
142 + gboolean now_disabled = FALSE;
144 + data->ks_pcall_list = g_slist_remove (data->ks_pcall_list, pcall);
145 + if (g_slist_length (data->ks_pcall_list) > 0)
146 + return; /* not done with all killswitches yet */
148 + if (data->hw_rf_enabled != data->tmp_hw_rf_enabled) {
149 + nm_info ("Wireless now %s by radio killswitch",
150 + data->tmp_hw_rf_enabled ? "enabled" : "disabled");
151 + if (data->tmp_hw_rf_enabled)
152 + now_enabled = TRUE;
154 + now_disabled = TRUE;
156 + data->hw_rf_enabled = data->tmp_hw_rf_enabled;
159 + if (data->hw_rf_enabled == data->wireless_enabled)
162 + /* Only re-enabled wireless if killswitch just changed, otherwise
163 + * ignore hardware rf enabled state.
165 + if (now_enabled && !data->wireless_enabled) {
166 + data->wireless_enabled = TRUE;
167 + nm_policy_schedule_device_change_check (data);
168 + nm_dbus_signal_wireless_enabled (data);
169 + } else if (!data->hw_rf_enabled && data->wireless_enabled) {
172 + /* Deactivate all wireless devices and force them down so they
173 + * turn off their radios.
175 + nm_lock_mutex (data->dev_list_mutex, __FUNCTION__);
176 + for (elt = data->dev_list; elt; elt = g_slist_next (elt)) {
177 + NMDevice * dev = (NMDevice *) elt->data;
178 + if (nm_device_is_802_11_wireless (dev)) {
179 + nm_device_deactivate (dev);
180 + nm_device_bring_down (dev);
183 + nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
185 + data->wireless_enabled = FALSE;
186 + nm_policy_schedule_device_change_check (data);
187 + nm_dbus_signal_wireless_enabled (data);
191 + /* Schedule another killswitch poll */
192 + source = g_timeout_source_new (6000);
193 + g_source_set_callback (source, nm_poll_killswitches, data, NULL);
194 + g_source_attach (source, data->main_context);
195 + g_source_unref (source);
198 +static void nm_killswitch_getpower_reply_cb (DBusPendingCall *pcall, NMData * data)
201 + DBusMessage * reply = NULL;
204 + g_return_if_fail (pcall != NULL);
205 + g_return_if_fail (data != NULL);
207 + if (!dbus_pending_call_get_completed (pcall))
210 + if (!(reply = dbus_pending_call_steal_reply (pcall)))
213 + if (message_is_error (reply)) {
214 + dbus_error_init (&err);
215 + dbus_set_error_from_message (&err, reply);
216 + nm_info ("Error getting killswitch power: %s - %s", err.name, err.message);
217 + dbus_error_free (&err);
221 + if (!dbus_message_get_args (reply, &err, DBUS_TYPE_UINT32, &status, DBUS_TYPE_INVALID)) {
222 + nm_info ("Error getting killswitch power arguments: %s - %s", err.name, err.message);
223 + dbus_error_free (&err);
228 + data->tmp_hw_rf_enabled = FALSE;
232 + dbus_message_unref (reply);
234 + handle_killswitch_pcall_done (data, pcall);
235 + dbus_pending_call_unref (pcall);
239 +static gboolean nm_poll_killswitches (gpointer user_data)
241 + NMData * data = (NMData *) user_data;
242 + DBusConnection * connection = data->dbus_connection;
245 + g_return_val_if_fail (data != NULL, FALSE);
247 + data->tmp_hw_rf_enabled = TRUE;
249 + for (elt = data->killswitch_list; elt; elt = g_slist_next (elt))
251 + DBusPendingCall * pcall;
252 + DBusMessage * message;
254 + message = dbus_message_new_method_call ("org.freedesktop.Hal",
256 + "org.freedesktop.Hal.Device.KillSwitch",
258 + if (!dbus_connection_send_with_reply (connection, message, &pcall, 5000)) {
259 + nm_warning ("%s(): could not send dbus message", __func__);
260 + } else if (!pcall) {
261 + nm_warning ("%s(): could not send dbus message; pcall was NULL", __func__);
263 + dbus_pending_call_set_notify (pcall,
264 + (DBusPendingCallNotifyFunction) nm_killswitch_getpower_reply_cb,
267 + data->ks_pcall_list = g_slist_append (data->ks_pcall_list, pcall);
269 + dbus_message_unref (message);
276 + * nm_add_killswitch_device
278 + * Adds a killswitch device to the list
281 +static void nm_add_killswitch_device (NMData * data, const char * udi)
286 + type = libhal_device_get_property_string (data->hal_ctx, udi, "killswitch.type", NULL);
290 + if (strcmp (type, "wlan") != 0)
293 + /* see if it's already in the list */
294 + for (elt = data->killswitch_list; elt; elt = g_slist_next (elt)) {
295 + const char * list_udi = (const char *) elt->data;
296 + if (strcmp (list_udi, udi) == 0)
300 + /* Start polling switches if this is the first switch we've found */
301 + if (g_slist_length (data->killswitch_list) == 0) {
302 + GSource * source = g_idle_source_new ();
303 + g_source_set_callback (source, nm_poll_killswitches, data, NULL);
304 + g_source_attach (source, data->main_context);
305 + g_source_unref (source);
308 + data->killswitch_list = g_slist_append (data->killswitch_list, g_strdup (udi));
309 + nm_info ("Found radio killswitch %s", udi);
312 + libhal_free_string (type);
316 * nm_hal_device_new_capability
319 NMData *data = (NMData *)libhal_ctx_get_user_data (ctx);
321 g_return_if_fail (data != NULL);
322 + g_return_if_fail (capability != NULL);
324 - /*nm_debug ("nm_hal_device_new_capability() called with udi = %s, capability = %s", udi, capability );*/
326 - if (capability && ((strcmp (capability, "net.80203") == 0) || (strcmp (capability, "net.80211") == 0)))
327 + if (((strcmp (capability, "net.80203") == 0) || (strcmp (capability, "net.80211") == 0)))
335 + else if (strcmp (capability, "killswitch") == 0)
337 + nm_add_killswitch_device (data, udi);
343 libhal_free_string_array (net_devices);
346 +void nm_add_initial_killswitch_devices (NMData * data)
352 + g_return_if_fail (data != NULL);
354 + dbus_error_init (&error);
355 + udis = libhal_find_device_by_capability (data->hal_ctx, "killswitch", &num_udis, &error);
359 + if (dbus_error_is_set (&error)) {
360 + nm_warning("Could not find killswitch devices: %s", error.message);
361 + dbus_error_free (&error);
365 + for (i = 0; i < num_udis; i++)
366 + nm_add_killswitch_device (data, udis[i]);
367 + libhal_free_string_array (udis);
372 * nm_state_change_signal_broadcast
373 @@ -616,28 +821,39 @@
374 g_return_if_fail (data != NULL);
376 if ((data->hal_ctx = nm_get_hal_ctx (data)))
378 + nm_add_initial_killswitch_devices (data);
379 nm_add_initial_devices (data);
382 + /* If there weren't any killswitches, mark hardware RF to on */
383 + if (g_slist_length (data->killswitch_list) == 0)
384 + data->hw_rf_enabled = TRUE;
388 void nm_hal_deinit (NMData *data)
392 g_return_if_fail (data != NULL);
397 + if (!data->hal_ctx)
400 - dbus_error_init (&error);
401 - libhal_ctx_shutdown (data->hal_ctx, &error);
402 - if (dbus_error_is_set (&error))
404 - nm_warning ("libhal shutdown failed - %s", error.message);
405 - dbus_error_free (&error);
407 - libhal_ctx_free (data->hal_ctx);
408 - data->hal_ctx = NULL;
409 + g_slist_foreach (data->killswitch_list, (GFunc) g_free, NULL);
410 + g_slist_free (data->killswitch_list);
411 + data->killswitch_list = NULL;
413 + dbus_error_init (&error);
414 + libhal_ctx_shutdown (data->hal_ctx, &error);
415 + if (dbus_error_is_set (&error))
417 + nm_warning ("libhal shutdown failed - %s", error.message);
418 + dbus_error_free (&error);
420 + libhal_ctx_free (data->hal_ctx);
421 + data->hal_ctx = NULL;
425 diff -urN NetworkManager/src/NetworkManagerDbus.c NetworkManager-SVN/src/NetworkManagerDbus.c
426 --- NetworkManager/src/NetworkManagerDbus.c 2007-09-08 00:09:05.000000000 +0200
427 +++ NetworkManager-SVN/src/NetworkManagerDbus.c 2007-09-08 00:06:44.000000000 +0200
432 +void nm_dbus_signal_wireless_enabled (NMData * data)
434 + DBusMessage * message;
436 + g_return_if_fail (data != NULL);
437 + g_return_if_fail (data->dbus_connection != NULL);
439 + if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "WirelessEnabled")))
441 + nm_warning ("%s(): Not enough memory for new dbus message!", __func__);
445 + dbus_message_append_args (message,
446 + DBUS_TYPE_BOOLEAN, &data->wireless_enabled,
447 + DBUS_TYPE_BOOLEAN, &data->hw_rf_enabled,
448 + DBUS_TYPE_INVALID);
449 + if (!dbus_connection_send (data->dbus_connection, message, NULL))
450 + nm_warning ("%s(): Could not emit the WirelessEnabled signal!", __func__);
452 + dbus_message_unref (message);
456 * nm_dbus_signal_filter
458 diff -urN NetworkManager/src/NetworkManagerDbus.h NetworkManager-SVN/src/NetworkManagerDbus.h
459 --- NetworkManager/src/NetworkManagerDbus.h 2007-09-08 00:09:05.000000000 +0200
460 +++ NetworkManager-SVN/src/NetworkManagerDbus.h 2007-09-08 00:06:44.000000000 +0200
463 void nm_dbus_signal_wireless_network_change (DBusConnection *connection, NMDevice80211Wireless *dev, NMAccessPoint *ap, NMNetworkStatus status, gint strength);
464 void nm_dbus_signal_device_strength_change (DBusConnection *connection, NMDevice80211Wireless *dev, gint strength);
465 +void nm_dbus_signal_wireless_enabled (NMData * data);
467 NMDevice * nm_dbus_get_device_from_escaped_object_path (NMData *data, const char *path);
469 diff -urN NetworkManager/src/NetworkManagerMain.h NetworkManager-SVN/src/NetworkManagerMain.h
470 --- NetworkManager/src/NetworkManagerMain.h 2007-09-08 00:09:05.000000000 +0200
471 +++ NetworkManager-SVN/src/NetworkManagerMain.h 2007-09-08 00:06:44.000000000 +0200
474 GMutex * dev_list_mutex;
476 + gboolean hw_rf_enabled;
477 gboolean wireless_enabled;
478 gboolean modem_active;
481 GSList * dialup_list;
482 GMutex * dialup_list_mutex;
484 + GSList * killswitch_list;
485 + GSList * ks_pcall_list; /* track killswitch D-Bus pending calls */
486 + gboolean tmp_hw_rf_enabled;
488 struct NMAccessPointList *allowed_ap_list;
489 struct NMAccessPointList *invalid_ap_list;
491 diff -urN NetworkManager/src/NetworkManagerPolicy.c NetworkManager-SVN/src/NetworkManagerPolicy.c
492 --- NetworkManager/src/NetworkManagerPolicy.c 2007-09-08 00:09:05.000000000 +0200
493 +++ NetworkManager-SVN/src/NetworkManagerPolicy.c 2007-09-08 00:06:44.000000000 +0200
495 NMDevice *dev = NULL;
497 NMAccessPoint * ap = NULL;
498 + NMActRequest * dev_req;
500 g_return_val_if_fail (req != NULL, FALSE);
503 dev = nm_act_request_get_dev (req);
506 + /* Ensure that inactive devices don't get the activated signal
507 + * sent due to race conditions.
509 + dev_req = nm_device_get_act_request (dev);
510 + if (!dev_req || (dev_req != req))
513 if (nm_device_is_802_11_wireless (dev))
514 ap = nm_act_request_get_ap (req);
516 @@ -265,14 +273,16 @@
520 - nm_info ("AUTO: Best wired device = %s, best wireless device = %s (%s)", best_wired_dev ? nm_device_get_iface (best_wired_dev) : "(null)",
521 - best_wireless_dev ? nm_device_get_iface (best_wireless_dev) : "(null)", (best_wireless_dev && *ap) ? nm_ap_get_essid (*ap) : "null" );
522 + nm_info ("AUTO: Best wired device = %s, best wireless device = %s (%s)", best_wired_dev ? nm_device_get_iface (NM_DEVICE (best_wired_dev)) : "(null)",
523 + best_wireless_dev ? nm_device_get_iface (NM_DEVICE (best_wireless_dev)) : "(null)", (best_wireless_dev && *ap) ? nm_ap_get_essid (*ap) : "null" );
526 return highest_priority_dev;
530 +static GStaticMutex dcc_mutex = G_STATIC_MUTEX_INIT;
533 * nm_policy_device_change_check
537 g_return_val_if_fail (data != NULL, FALSE);
539 + g_static_mutex_lock (&dcc_mutex);
540 data->dev_change_check_idle_id = 0;
541 + g_static_mutex_unlock (&dcc_mutex);
543 old_dev = nm_get_active_device (data);
545 @@ -303,11 +315,19 @@
549 + gboolean has_link = TRUE;
550 guint32 caps = nm_device_get_capabilities (old_dev);
552 + /* Ensure ethernet devices have a link before starting activation,
553 + * partially works around Fedora #194124.
555 + if (nm_device_is_802_3_ethernet (old_dev))
556 + has_link = nm_device_has_active_link (old_dev);
558 /* Don't interrupt a currently activating device. */
559 if ( nm_device_is_activating (old_dev)
560 - && !nm_device_can_interrupt_activation (old_dev))
561 + && !nm_device_can_interrupt_activation (old_dev)
564 nm_info ("Old device '%s' activating, won't change.", nm_device_get_iface (old_dev));
566 @@ -425,12 +445,35 @@
567 if (do_switch && (nm_device_is_802_3_ethernet (new_dev) || (nm_device_is_802_11_wireless (new_dev) && ap)))
569 NMActRequest * act_req = NULL;
570 + gboolean has_link = TRUE;
572 + /* Ensure ethernet devices have a link before starting activation,
573 + * partially works around Fedora #194124.
575 + if (nm_device_is_802_3_ethernet (new_dev))
576 + has_link = nm_device_has_active_link (new_dev);
578 - if ((act_req = nm_act_request_new (data, new_dev, ap, FALSE)))
581 + if ((act_req = nm_act_request_new (data, new_dev, ap, FALSE)))
583 + nm_info ("Will activate connection '%s%s%s'.",
584 + nm_device_get_iface (new_dev),
586 + ap ? nm_ap_get_essid (ap) : "");
587 + nm_policy_schedule_device_activation (act_req);
588 + nm_act_request_unref (act_req);
592 + nm_info ("Error creating activation request for %s",
593 + nm_device_get_iface (new_dev));
598 - nm_info ("Will activate connection '%s%s%s'.", nm_device_get_iface (new_dev), ap ? "/" : "", ap ? nm_ap_get_essid (ap) : "");
599 - nm_policy_schedule_device_activation (act_req);
600 - nm_act_request_unref (act_req);
601 + nm_info ("Won't activate %s because it no longer has a link.",
602 + nm_device_get_iface (new_dev));
608 void nm_policy_schedule_device_change_check (NMData *data)
610 - static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
612 g_return_if_fail (data != NULL);
614 - g_static_mutex_lock (&mutex);
615 + g_static_mutex_lock (&dcc_mutex);
617 if (data->dev_change_check_idle_id == 0)
620 data->dev_change_check_idle_id = g_source_attach (source, data->main_context);
621 g_source_unref (source);
624 - g_static_mutex_unlock (&mutex);
625 + g_static_mutex_unlock (&dcc_mutex);
629 diff -urN NetworkManager/src/NetworkManagerSystem.c NetworkManager-SVN/src/NetworkManagerSystem.c
630 --- NetworkManager/src/NetworkManagerSystem.c 2007-09-08 00:09:05.000000000 +0200
631 +++ NetworkManager-SVN/src/NetworkManagerSystem.c 2007-09-08 00:06:44.000000000 +0200
633 struct sockaddr_in *p;
636 + NMIP4Config * config = NULL;
638 iface = nm_device_get_iface (dev);
641 if (ip4_gateway == 0)
645 + * Do not add the route if the destination is on the same subnet.
647 + config = nm_device_get_ip4_config(dev);
649 + ((guint32)ip4_dest & nm_ip4_config_get_netmask(config)) ==
650 + (nm_ip4_config_get_address(config) & nm_ip4_config_get_netmask(config)))
653 if ((sk = nm_dev_sock_open (dev, NETWORK_CONTROL, __FUNCTION__, NULL)) == NULL)
656 diff -urN NetworkManager/src/nm-ap-security-wpa-eap.c NetworkManager-SVN/src/nm-ap-security-wpa-eap.c
657 --- NetworkManager/src/nm-ap-security-wpa-eap.c 2007-09-08 00:09:05.000000000 +0200
658 +++ NetworkManager-SVN/src/nm-ap-security-wpa-eap.c 2007-09-08 00:06:44.000000000 +0200
660 NMAPSecurityWPA_EAP * security = NULL;
665 char * identity = NULL;
666 char * passwd = NULL;
667 diff -urN NetworkManager/src/nm-dbus-nm.c NetworkManager-SVN/src/nm-dbus-nm.c
668 --- NetworkManager/src/nm-dbus-nm.c 2007-09-08 00:09:05.000000000 +0200
669 +++ NetworkManager-SVN/src/nm-dbus-nm.c 2007-09-08 00:06:44.000000000 +0200
670 @@ -483,52 +483,83 @@
674 -static DBusMessage *nm_dbus_nm_set_wireless_enabled (DBusConnection *connection, DBusMessage *message, NMDbusCBData *data)
675 +static DBusMessage *nm_dbus_nm_set_wireless_enabled (DBusConnection *connection, DBusMessage *message, NMDbusCBData *cb_data)
677 gboolean enabled = FALSE;
681 + DBusMessage * ret = NULL;
683 - g_return_val_if_fail (data && data->data && connection && message, NULL);
684 + g_return_val_if_fail (cb_data && cb_data->data && connection && message, NULL);
686 dbus_error_init (&err);
687 if (!dbus_message_get_args (message, &err, DBUS_TYPE_BOOLEAN, &enabled, DBUS_TYPE_INVALID))
691 - app_data = data->data;
692 - app_data->wireless_enabled = enabled;
693 + data = cb_data->data;
694 + if (enabled == data->wireless_enabled)
697 + /* Hardware rfkill overrides whatever user wants */
698 + if (!data->hw_rf_enabled) {
699 + nm_info ("User request to %s wireless overridden by radio killswitch.",
700 + enabled ? "enable" : "disable");
705 + /* Return error if user tries to re-enable wireless, or just ignore
706 + * a disable wireless request when wireless is already disabled.
709 + ret = nm_dbus_create_error_message (message,
711 + "DisabledBySystem",
712 + "Wireless disabled by hardware switch.");
717 - /* Physically down all wireless devices */
718 - nm_lock_mutex (app_data->dev_list_mutex, __FUNCTION__);
719 - for (elt = app_data->dev_list; elt; elt = g_slist_next (elt))
721 - NMDevice *dev = (NMDevice *)(elt->data);
722 - if (nm_device_is_802_11_wireless (dev))
724 + nm_info ("User request to %s wireless.", enabled ? "enable" : "disable");
726 + data->wireless_enabled = enabled;
727 + if (!data->wireless_enabled) {
730 + /* Deactivate all wireless devices and force them down so they
731 + * turn off their radios.
733 + nm_lock_mutex (data->dev_list_mutex, __FUNCTION__);
734 + for (elt = data->dev_list; elt; elt = g_slist_next (elt)) {
735 + NMDevice * dev = (NMDevice *) elt->data;
736 + if (nm_device_is_802_11_wireless (dev)) {
737 nm_device_deactivate (dev);
738 nm_device_bring_down (dev);
741 - nm_unlock_mutex (app_data->dev_list_mutex, __FUNCTION__);
742 + nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
745 - nm_policy_schedule_device_change_check (data->data);
746 + nm_policy_schedule_device_change_check (data);
747 + nm_dbus_signal_wireless_enabled (data);
754 -static DBusMessage *nm_dbus_nm_get_wireless_enabled (DBusConnection *connection, DBusMessage *message, NMDbusCBData *data)
755 +static DBusMessage *nm_dbus_nm_get_wireless_enabled (DBusConnection *connection, DBusMessage *message, NMDbusCBData *cb_data)
758 DBusMessage *reply = NULL;
760 - g_return_val_if_fail (data && data->data && connection && message, NULL);
761 + g_return_val_if_fail (cb_data && connection && message, NULL);
763 - if ((reply = dbus_message_new_method_return (message)))
764 - dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &data->data->wireless_enabled, DBUS_TYPE_INVALID);
765 + data = cb_data->data;
766 + g_return_val_if_fail (data != NULL, NULL);
768 + if ((reply = dbus_message_new_method_return (message))) {
769 + dbus_message_append_args (reply,
770 + DBUS_TYPE_BOOLEAN, &data->wireless_enabled,
771 + DBUS_TYPE_BOOLEAN, &data->hw_rf_enabled,
772 + DBUS_TYPE_INVALID);
777 diff -urN NetworkManager/src/nm-device-802-11-wireless.c NetworkManager-SVN/src/nm-device-802-11-wireless.c
778 --- NetworkManager/src/nm-device-802-11-wireless.c 2007-09-08 00:09:05.000000000 +0200
779 +++ NetworkManager-SVN/src/nm-device-802-11-wireless.c 2007-09-08 00:06:44.000000000 +0200
781 /* Start the scanning timeout for devices that can do scanning */
782 if (nm_device_get_capabilities (dev) & NM_DEVICE_CAP_WIRELESS_SCAN)
784 - self->priv->pending_scan = g_idle_source_new ();
785 + /* Stupid orinoco has problems scanning immediately after being up,
786 + * so wait a bit before triggering a scan.
788 + self->priv->pending_scan = g_timeout_source_new (600);
789 g_source_set_callback (self->priv->pending_scan,
790 nm_device_802_11_wireless_scan,
792 @@ -2981,6 +2984,9 @@
793 return NM_ACT_STAGE_RETURN_POSTPONE;
796 + /* Some cards are dumb. Wait a second */
799 iface = nm_device_get_iface (dev);
800 if (!supplicant_exec (self))
802 @@ -3446,10 +3452,9 @@
803 char *genie, *gpos, *gend, *custom;
804 NMAccessPoint *ap = NULL;
808 struct iw_event iwe_buf, *iwe = &iwe_buf;
809 struct stream_descr stream;
810 - struct wireless_scan * wscan = NULL;
813 g_return_val_if_fail (dev != NULL, FALSE);
814 diff -urN NetworkManager/src/nm-device-802-3-ethernet.c NetworkManager-SVN/src/nm-device-802-3-ethernet.c
815 --- NetworkManager/src/nm-device-802-3-ethernet.c 2007-09-08 00:09:05.000000000 +0200
816 +++ NetworkManager-SVN/src/nm-device-802-3-ethernet.c 2007-09-08 00:06:44.000000000 +0200
817 @@ -108,18 +108,16 @@
819 NMDevice8023Ethernet *self)
823 /* Make sure signal is for us */
824 if (NM_DEVICE (self) != NM_DEVICE (obj))
827 - if (!nm_device_has_active_link (NM_DEVICE (self)))
829 - GSource * source = g_idle_source_new ();
831 - g_source_set_callback (source, (GSourceFunc) link_activated_helper, self, NULL);
832 - g_source_attach (source, nm_device_get_main_context (NM_DEVICE (self)));
833 - g_source_unref (source);
835 + source = g_idle_source_new ();
836 + g_source_set_callback (source, (GSourceFunc) link_activated_helper, self, NULL);
837 + g_source_attach (source, nm_device_get_main_context (NM_DEVICE (self)));
838 + g_source_unref (source);
842 @@ -135,18 +133,16 @@
844 NMDevice8023Ethernet *self)
848 /* Make sure signal is for us */
849 if (NM_DEVICE (self) != NM_DEVICE (obj))
852 - if (nm_device_has_active_link (NM_DEVICE (self)))
854 - GSource * source = g_idle_source_new ();
856 - g_source_set_callback (source, (GSourceFunc) link_deactivated_helper, self, NULL);
857 - g_source_attach (source, nm_device_get_main_context (NM_DEVICE (self)));
858 - g_source_unref (source);
860 + source = g_idle_source_new ();
861 + g_source_set_callback (source, (GSourceFunc) link_deactivated_helper, self, NULL);
862 + g_source_attach (source, nm_device_get_main_context (NM_DEVICE (self)));
863 + g_source_unref (source);
872 +static NMActStageReturn
873 +real_act_stage1_prepare (NMDevice *dev, NMActRequest *req)
875 + NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
876 + NMDevice8023EthernetClass * klass;
877 + NMDeviceClass * parent_class;
879 + /* Ensure ethernet devices have a link before going further with activation,
880 + * partially works around Fedora #194124.
882 + if (!nm_device_has_active_link (dev))
883 + return NM_ACT_STAGE_RETURN_FAILURE;
885 + /* Chain up to parent */
886 + klass = NM_DEVICE_802_3_ETHERNET_GET_CLASS (self);
887 + parent_class = NM_DEVICE_CLASS (g_type_class_peek_parent (klass));
888 + return parent_class->act_stage1_prepare (dev, req);
892 nm_device_802_3_ethernet_dispose (GObject *object)
895 parent_class->get_generic_capabilities = real_get_generic_capabilities;
896 parent_class->init = real_init;
897 parent_class->update_link = real_update_link;
898 + parent_class->act_stage1_prepare = real_act_stage1_prepare;
900 g_type_class_add_private (object_class, sizeof (NMDevice8023EthernetPrivate));
902 diff -urN NetworkManager/src/nm-device.c NetworkManager-SVN/src/nm-device.c
903 --- NetworkManager/src/nm-device.c 2007-09-08 00:09:05.000000000 +0200
904 +++ NetworkManager-SVN/src/nm-device.c 2007-09-08 00:06:44.000000000 +0200
906 data = nm_act_request_get_data (req);
909 + /* Sometimes the device gets downed by wpa_supplicant; in any case, make
910 + * sure it's up before anything tries to use it.
912 + if (!nm_device_is_up (self))
913 + nm_device_bring_up (self);
915 /* DHCP devices try DHCP, non-DHCP default to SUCCESS */
916 if (nm_device_get_use_dhcp (self))