[arch-commits] CVS update of extra/daemons/networkmanager (5 files)
Jan de Groot
jgc at archlinux.org
Wed Jul 25 18:05:47 UTC 2007
Date: Wednesday, July 25, 2007 @ 14:05:47
Author: jgc
Path: /home/cvs-extra/extra/daemons/networkmanager
Added: dbus-hal-policy.patch (1.1)
dont-tear-down-upped-interfaces.patch (1.1)
dont-up-notwired-interfaces.patch (1.1)
fix-ethernet-link-detection-races.patch (1.1)
Modified: PKGBUILD (1.10 -> 1.11)
upgpkg: networkmanager 0.6.5-2
Use some patches from debian/ubuntu to fix several bugs in networkmanager
-----------------------------------------+
PKGBUILD | 31 +++-
dbus-hal-policy.patch | 14 ++
dont-tear-down-upped-interfaces.patch | 158 +++++++++++++++++++++++
dont-up-notwired-interfaces.patch | 199 ++++++++++++++++++++++++++++++
fix-ethernet-link-detection-races.patch | 63 +++++++++
5 files changed, 457 insertions(+), 8 deletions(-)
Index: extra/daemons/networkmanager/PKGBUILD
diff -u extra/daemons/networkmanager/PKGBUILD:1.10 extra/daemons/networkmanager/PKGBUILD:1.11
--- extra/daemons/networkmanager/PKGBUILD:1.10 Thu Apr 26 13:18:50 2007
+++ extra/daemons/networkmanager/PKGBUILD Wed Jul 25 14:05:47 2007
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD,v 1.10 2007/04/26 17:18:50 jgc Exp $
+# $Id: PKGBUILD,v 1.11 2007/07/25 18:05:47 jgc Exp $
# Maintainer: Jan de Groot <jgc at archlinxu.org>
# Contri-butor: Wael Nasreddine <gandalf at siemens-mobiles.org>
# Contributor: Tor Krill <tor at krill.nu>
@@ -7,28 +7,43 @@
pkgname=networkmanager
pkgver=0.6.5
-pkgrel=1
+pkgrel=2
pkgdesc="Network Management daemon"
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.gnome.org/projects/NetworkManager/"
-depends=('wireless_tools' 'iproute' 'dhcdbd' 'hal>=0.5.9' 'libnl'
- 'wpa_supplicant>=0.5.0' "libnetworkmanager>=${pkgver}")
+depends=('wireless_tools' 'iproute' 'dhcdbd' 'hal>=0.5.9.1' 'libnl'
+ 'wpa_supplicant>=0.5.8' "libnetworkmanager>=${pkgver}")
makedepends=('pkgconfig' 'perlxml')
-options=('nolibtool')
+options=('!libtool')
source=(http://ftp.gnome.org/pub/GNOME/sources/NetworkManager/0.6/NetworkManager-${pkgver}.tar.bz2
networkmanager-initscript.patch
+ dbus-hal-policy.patch
+ dont-tear-down-upped-interfaces.patch
+ dont-up-notwired-interfaces.patch
+ fix-ethernet-link-detection-races.patch
+ networkmanager-initscript.patch
NetworkManager.conf
ntpdate
netfs)
-md5sums=('b827d300eb28458f6588eb843cba418d' 'beb3738b1bd05d171f0e06f8a3306b56'
- '0a010bd3f35344325a7dbf3bfa697bfe' '9a3b8da1efac158d91bb9fc699736b03'
+md5sums=('b827d300eb28458f6588eb843cba418d'
+ 'beb3738b1bd05d171f0e06f8a3306b56'
+ '2f208e80adcd558ccbcb57344f842691'
+ 'a6af8522d2fdd59ba7a0e4b04c19a405'
+ '4e88282faf2b41d757f9aca72c1a249f'
+ 'de72f700fdfec464d05d6296822d0e6c'
+ 'beb3738b1bd05d171f0e06f8a3306b56'
+ '0a010bd3f35344325a7dbf3bfa697bfe'
+ '9a3b8da1efac158d91bb9fc699736b03'
'ee592ee567faf683e7aecf651bd15937')
-
build() {
cd ${startdir}/src/NetworkManager-${pkgver}
patch -Np0 -i ${startdir}/src/networkmanager-initscript.patch || return 1
+ patch -Np1 -i ${startdir}/src/dbus-hal-policy.patch || return 1
+ patch -Np1 -i ${startdir}/src/dont-up-notwired-interfaces.patch || return 1
+ patch -Np1 -i ${startdir}/src/dont-tear-down-upped-interfaces.patch || return 1
+ patch -Np1 -i ${startdir}/src/fix-ethernet-link-detection-races.patch || return 1
./configure --prefix=/usr --sysconfdir=/etc \
--with-distro=arch --localstatedir=/var \
Index: extra/daemons/networkmanager/dbus-hal-policy.patch
diff -u /dev/null extra/daemons/networkmanager/dbus-hal-policy.patch:1.1
--- /dev/null Wed Jul 25 14:05:47 2007
+++ extra/daemons/networkmanager/dbus-hal-policy.patch Wed Jul 25 14:05:47 2007
@@ -0,0 +1,14 @@
+diff -Nur bzr.debian.0.9.4.patchupdate/src/NetworkManager.conf bzr.debian.0.9.4.patchupdate.new/src/NetworkManager.conf
+--- bzr.debian.0.9.4.patchupdate/src/NetworkManager.conf 2007-06-25 17:14:46.000000000 +0200
++++ bzr.debian.0.9.4.patchupdate.new/src/NetworkManager.conf 2007-06-25 17:15:51.000000000 +0200
+@@ -8,6 +8,10 @@
+ <allow send_destination="org.freedesktop.NetworkManager"/>
+ <allow send_interface="org.freedesktop.NetworkManager"/>
+ </policy>
++ <policy user="hal">
++ <allow send_destination="org.freedesktop.NetworkManager"/>
++ <allow send_interface="org.freedesktop.NetworkManager"/>
++ </policy>
+ <policy at_console="true">
+ <allow send_destination="org.freedesktop.NetworkManager"/>
+ <allow send_interface="org.freedesktop.NetworkManager"/>
Index: extra/daemons/networkmanager/dont-tear-down-upped-interfaces.patch
diff -u /dev/null extra/daemons/networkmanager/dont-tear-down-upped-interfaces.patch:1.1
--- /dev/null Wed Jul 25 14:05:47 2007
+++ extra/daemons/networkmanager/dont-tear-down-upped-interfaces.patch Wed Jul 25 14:05:47 2007
@@ -0,0 +1,158 @@
+ fix master bug that makes already configured interfaces (in /etc/network/interfaces)
+ being torn down. This causes issue for network cards that don't have a link beat and
+ might caus troubles for applications that have already bound to the interface and
+ don't react on netlink events (LP: #90267)
+
+ Author: Alexander Sack <asac at jwsdot.com>
+
+--
+
+--- bzr.debian.0.9.5/src/NetworkManager.c 2007-07-10 16:23:59 +0000
++++ bzr.debian.0.9.5.new/src/NetworkManager.c 2007-07-11 13:11:13 +0000
+@@ -140,12 +140,29 @@
+ nm_device_is_802_11_wireless (dev) ? "wireless (802.11)" : "wired Ethernet (802.3)", nm_device_get_iface (dev));
+
+ data->dev_list = g_slist_append (data->dev_list, dev);
+- nm_device_deactivate (dev);
+-
+- nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
+-
+- nm_policy_schedule_device_change_check (data);
+- nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_ADDED);
++
++ /* We don't take down wired devices that are already set up when NetworkManager gets
++ * launched. Plays better with the system. (Actually, we now try to do the same
++ * for wireless interfaces as well).
++ *
++ * asac: revived from svn revision 382 (was removed in 388)
++ * FIXME: IPv6 here too
++ */
++ // if (nm_device_is_802_11_wireless (dev) || !nm_device_get_ip4_address (dev)) {
++ if (!nm_device_get_ip4_address (dev)) {
++ nm_device_deactivate (dev);
++ nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
++ nm_policy_schedule_device_change_check (data);
++ nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_ADDED);
++ } else {
++ nm_info("Found old device up? %d ... has active link? %d", nm_device_is_up(dev), nm_device_has_active_link(dev));
++ NMActRequest *req = nm_act_request_new(data, dev, NULL, FALSE);
++ nm_act_request_set_stage(req, NM_ACT_STAGE_ACTIVATED);
++ nm_device_start_activated(req);
++ nm_info("boosted to ACTIVATED");
++ nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
++ nm_device_set_active_link (dev, TRUE);
++ }
+ }
+ else
+ {
+
+=== modified file 'src/NetworkManagerPolicy.c'
+--- bzr.debian.0.9.5/src/NetworkManagerPolicy.c 2007-07-10 16:23:59 +0000
++++ bzr.debian.0.9.5.new/src/NetworkManagerPolicy.c 2007-07-11 08:56:59 +0000
+@@ -324,6 +324,8 @@
+ if (nm_device_is_802_3_ethernet (old_dev))
+ has_link = nm_device_has_active_link (old_dev);
+
++ nm_info("nm_policy_device_change_check:: old_dev has_link? %d", has_link);
++
+ /* Don't interrupt a currently activating device. */
+ if ( nm_device_is_activating (old_dev)
+ && !nm_device_can_interrupt_activation (old_dev)
+@@ -365,6 +367,7 @@
+ if (!old_dev && !new_dev)
+ {
+ ; /* Do nothing, wait for something like link-state to change, or an access point to be found */
++ nm_info("nm_policy_device_change_check:: !old_dev && !new_dev!!");
+ }
+ else if (!old_dev && new_dev)
+ {
+@@ -381,6 +384,7 @@
+ }
+ else if (old_dev && new_dev)
+ {
++ nm_info("nm_policy_device_change_check:: old_dev && new_dev!!");
+ NMActRequest * old_act_req = nm_device_get_act_request (old_dev);
+ gboolean old_user_requested = nm_act_request_get_user_requested (old_act_req);
+ gboolean old_has_link = nm_device_has_active_link (old_dev);
+@@ -447,6 +451,8 @@
+ NMActRequest * act_req = NULL;
+ gboolean has_link = TRUE;
+
++ nm_info("nm_policy_device_change_check:: lets try to switch device!");
++
+ /* Ensure ethernet devices have a link before starting activation,
+ * partially works around Fedora #194124.
+ */
+
+=== modified file 'src/nm-device.c'
+--- bzr.debian.0.9.5/src/nm-device.c 2007-07-10 16:23:59 +0000
++++ bzr.debian.0.9.5.new/src/nm-device.c 2007-07-11 12:59:52 +0000
+@@ -586,6 +586,8 @@
+ NMData * app_data;
+ NMActRequest * req;
+
++ nm_info("nm_device_set_active_link start");
++
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (self->priv->app_data != NULL);
+
+@@ -675,6 +677,46 @@
+ return TRUE;
+ }
+
++/*
++ * nm_device_start_activated
++ *
++ * Tell the device thread that the device is started activated.
++ *
++ * Returns: TRUE on success ... device properly activated
++ * FALSE on error setting device up as activated
++ *
++ */
++gboolean
++nm_device_start_activated (NMActRequest *req)
++{
++ NMData * data = NULL;
++ NMDevice * self = NULL;
++
++ g_return_val_if_fail (req != NULL, FALSE);
++
++ data = nm_act_request_get_data (req);
++ g_assert (data);
++
++ self = nm_act_request_get_dev (req);
++ g_assert (self);
++
++ g_return_val_if_fail (!nm_device_is_activating (self), TRUE); /* Return if activation has already begun */
++
++ // if act_request exists, we cannot start activated obviously.
++ g_return_val_if_fail (self->priv->act_request == NULL, FALSE);
++
++ nm_act_request_ref (req);
++ self->priv->act_request = req;
++ self->priv->quit_activation = FALSE;
++
++ nm_info ("Device (%s) started as activated.", nm_device_get_iface (self));
++
++ nm_act_request_set_stage (req, NM_ACT_STAGE_ACTIVATED);
++ nm_schedule_state_change_signal_broadcast (data);
++ nm_dbus_schedule_device_status_change_signal (data, self, NULL, DEVICE_NOW_ACTIVE);
++
++ return TRUE;
++}
+
+ /*
+ * nm_device_activate_stage1_device_prepare
+
+=== modified file 'src/nm-device.h'
+--- bzr.debian.0.9.5/src/nm-device.h 2007-06-25 13:51:34 +0000
++++ bzr.debian.0.9.5.new/src/nm-device.h 2007-07-11 12:31:51 +0000
+@@ -182,6 +182,7 @@
+
+ gboolean nm_device_is_test_device (NMDevice *dev);
+
++gboolean nm_device_start_activated (struct NMActRequest *req);
+ gboolean nm_device_activation_start (struct NMActRequest *req);
+ void nm_device_activate_schedule_stage1_device_prepare (struct NMActRequest *req);
+ void nm_device_activate_schedule_stage2_device_config (struct NMActRequest *req);
+
Index: extra/daemons/networkmanager/dont-up-notwired-interfaces.patch
diff -u /dev/null extra/daemons/networkmanager/dont-up-notwired-interfaces.patch:1.1
--- /dev/null Wed Jul 25 14:05:47 2007
+++ extra/daemons/networkmanager/dont-up-notwired-interfaces.patch Wed Jul 25 14:05:47 2007
@@ -0,0 +1,199 @@
+ 2007-06-21 Dan Williams <dcbw at redhat.com>
+
+ More fixes for Fedora #194124, gnome.org #354565
+
+ * src/nm-device-802-3-ethernet.c
+ - (real_act_stage1_prepare): new function; fail activation if device
+ doesn't have a link
+
+ * src/NetworkManagerPolicy.c
+ - (nm_policy_activation_finish): ensure device is actually activated
+ before sending out signals. Fixes a race where device cancellation
+ would be processed right after finish was scheduled, but not run.
+ - (nm_policy_device_change_check, nm_policy_schedule_device_change_check):
+ ensure device change check GSource ID is locked across threads;
+ allow interruption of activation of 802.3 ethernet devices that no
+ longer have an active link, and ensure that 802.3 ethernet devices
+ have an active link before starting activation
+
+--
+
+Index: bzr.debian.0.9.5/src/nm-device-802-3-ethernet.c
+===================================================================
+--- bzr.debian.0.9.5/src/nm-device-802-3-ethernet.c (revision 2604)
++++ bzr.debian.0.9.5.new/src/nm-device-802-3-ethernet.c (revision 2605)
+@@ -207,6 +207,26 @@
+ return caps;
+ }
+
++
++static NMActStageReturn
++real_act_stage1_prepare (NMDevice *dev, NMActRequest *req)
++{
++ NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
++ NMDevice8023EthernetClass * klass;
++ NMDeviceClass * parent_class;
++
++ /* Ensure ethernet devices have a link before going further with activation,
++ * partially works around Fedora #194124.
++ */
++ if (!nm_device_has_active_link (dev))
++ return NM_ACT_STAGE_RETURN_FAILURE;
++
++ /* Chain up to parent */
++ klass = NM_DEVICE_802_3_ETHERNET_GET_CLASS (self);
++ parent_class = NM_DEVICE_CLASS (g_type_class_peek_parent (klass));
++ return parent_class->act_stage1_prepare (dev, req);
++}
++
+ static void
+ nm_device_802_3_ethernet_dispose (GObject *object)
+ {
+@@ -271,6 +291,7 @@
+ parent_class->get_generic_capabilities = real_get_generic_capabilities;
+ parent_class->init = real_init;
+ parent_class->update_link = real_update_link;
++ parent_class->act_stage1_prepare = real_act_stage1_prepare;
+
+ g_type_class_add_private (object_class, sizeof (NMDevice8023EthernetPrivate));
+ }
+Index: src/NetworkManagerPolicy.c
+===================================================================
+--- bzr.debian.0.9.5/src/NetworkManagerPolicy.c (revision 2604)
++++ bzr.debian.0.9.5.new/src/NetworkManagerPolicy.c (revision 2605)
+@@ -52,6 +52,7 @@
+ NMDevice *dev = NULL;
+ NMData *data = NULL;
+ NMAccessPoint * ap = NULL;
++ NMActRequest * dev_req;
+
+ g_return_val_if_fail (req != NULL, FALSE);
+
+@@ -61,6 +62,13 @@
+ dev = nm_act_request_get_dev (req);
+ g_assert (dev);
+
++ /* Ensure that inactive devices don't get the activated signal
++ * sent due to race conditions.
++ */
++ dev_req = nm_device_get_act_request (dev);
++ if (!dev_req || (dev_req != req))
++ return FALSE;
++
+ if (nm_device_is_802_11_wireless (dev))
+ ap = nm_act_request_get_ap (req);
+
+@@ -265,14 +273,16 @@
+ }
+
+ #if 0
+- nm_info ("AUTO: Best wired device = %s, best wireless device = %s (%s)", best_wired_dev ? nm_device_get_iface (best_wired_dev) : "(null)",
+- best_wireless_dev ? nm_device_get_iface (best_wireless_dev) : "(null)", (best_wireless_dev && *ap) ? nm_ap_get_essid (*ap) : "null" );
++ 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)",
++ best_wireless_dev ? nm_device_get_iface (NM_DEVICE (best_wireless_dev)) : "(null)", (best_wireless_dev && *ap) ? nm_ap_get_essid (*ap) : "null" );
+ #endif
+
+ return highest_priority_dev;
+ }
+
+
++static GStaticMutex dcc_mutex = G_STATIC_MUTEX_INIT;
++
+ /*
+ * nm_policy_device_change_check
+ *
+@@ -294,7 +304,9 @@
+
+ g_return_val_if_fail (data != NULL, FALSE);
+
++ g_static_mutex_lock (&dcc_mutex);
+ data->dev_change_check_idle_id = 0;
++ g_static_mutex_unlock (&dcc_mutex);
+
+ old_dev = nm_get_active_device (data);
+
+@@ -303,11 +315,19 @@
+
+ if (old_dev)
+ {
++ gboolean has_link = TRUE;
+ guint32 caps = nm_device_get_capabilities (old_dev);
+
++ /* Ensure ethernet devices have a link before starting activation,
++ * partially works around Fedora #194124.
++ */
++ if (nm_device_is_802_3_ethernet (old_dev))
++ has_link = nm_device_has_active_link (old_dev);
++
+ /* Don't interrupt a currently activating device. */
+ if ( nm_device_is_activating (old_dev)
+- && !nm_device_can_interrupt_activation (old_dev))
++ && !nm_device_can_interrupt_activation (old_dev)
++ && has_link)
+ {
+ nm_info ("Old device '%s' activating, won't change.", nm_device_get_iface (old_dev));
+ goto out;
+@@ -425,13 +445,36 @@
+ if (do_switch && (nm_device_is_802_3_ethernet (new_dev) || (nm_device_is_802_11_wireless (new_dev) && ap)))
+ {
+ NMActRequest * act_req = NULL;
++ gboolean has_link = TRUE;
+
+- if ((act_req = nm_act_request_new (data, new_dev, ap, FALSE)))
++ /* Ensure ethernet devices have a link before starting activation,
++ * partially works around Fedora #194124.
++ */
++ if (nm_device_is_802_3_ethernet (new_dev))
++ has_link = nm_device_has_active_link (new_dev);
++
++ if (has_link)
+ {
+- nm_info ("Will activate connection '%s%s%s'.", nm_device_get_iface (new_dev), ap ? "/" : "", ap ? nm_ap_get_essid (ap) : "");
+- nm_policy_schedule_device_activation (act_req);
+- nm_act_request_unref (act_req);
++ if ((act_req = nm_act_request_new (data, new_dev, ap, FALSE)))
++ {
++ nm_info ("Will activate connection '%s%s%s'.",
++ nm_device_get_iface (new_dev),
++ ap ? "/" : "",
++ ap ? nm_ap_get_essid (ap) : "");
++ nm_policy_schedule_device_activation (act_req);
++ nm_act_request_unref (act_req);
++ }
++ else
++ {
++ nm_info ("Error creating activation request for %s",
++ nm_device_get_iface (new_dev));
++ }
+ }
++ else
++ {
++ nm_info ("Won't activate %s because it no longer has a link.",
++ nm_device_get_iface (new_dev));
++ }
+ }
+
+ if (ap)
+@@ -452,11 +495,9 @@
+ */
+ void nm_policy_schedule_device_change_check (NMData *data)
+ {
+- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+-
+ g_return_if_fail (data != NULL);
+
+- g_static_mutex_lock (&mutex);
++ g_static_mutex_lock (&dcc_mutex);
+
+ if (data->dev_change_check_idle_id == 0)
+ {
+@@ -466,8 +507,7 @@
+ data->dev_change_check_idle_id = g_source_attach (source, data->main_context);
+ g_source_unref (source);
+ }
+-
+- g_static_mutex_unlock (&mutex);
++ g_static_mutex_unlock (&dcc_mutex);
+ }
+
+
Index: extra/daemons/networkmanager/fix-ethernet-link-detection-races.patch
diff -u /dev/null extra/daemons/networkmanager/fix-ethernet-link-detection-races.patch:1.1
--- /dev/null Wed Jul 25 14:05:47 2007
+++ extra/daemons/networkmanager/fix-ethernet-link-detection-races.patch Wed Jul 25 14:05:47 2007
@@ -0,0 +1,63 @@
+2007-06-07 Dan Williams <dcbw at redhat.com>
+
+* (nm_device_802_3_ethernet_link_activated,
+ nm_device_802_3_ethernet_link_deactivated): fix ethernet link detection
+ behavior due to races between the netlink code and when the
+ device thread recognizes the change. Checking the link state
+ before scheduling the change even on the device thread is wrong.
+ (gnome.org #354565, rh #194124)
+
+--
+
+--- bzr.debian.0.9.5/src/nm-device-802-3-ethernet.c (revision 2577)
++++ bzr.debian.0.9.5.new/src/nm-device-802-3-ethernet.c (revision 2578)
+@@ -108,18 +108,16 @@
+ GObject *obj,
+ NMDevice8023Ethernet *self)
+ {
++ GSource * source;
++
+ /* Make sure signal is for us */
+ if (NM_DEVICE (self) != NM_DEVICE (obj))
+ return;
+
+- if (!nm_device_has_active_link (NM_DEVICE (self)))
+- {
+- GSource * source = g_idle_source_new ();
+-
+- g_source_set_callback (source, (GSourceFunc) link_activated_helper, self, NULL);
+- g_source_attach (source, nm_device_get_main_context (NM_DEVICE (self)));
+- g_source_unref (source);
+- }
++ source = g_idle_source_new ();
++ g_source_set_callback (source, (GSourceFunc) link_activated_helper, self, NULL);
++ g_source_attach (source, nm_device_get_main_context (NM_DEVICE (self)));
++ g_source_unref (source);
+ }
+
+
+@@ -135,18 +133,16 @@
+ GObject *obj,
+ NMDevice8023Ethernet *self)
+ {
++ GSource * source;
++
+ /* Make sure signal is for us */
+ if (NM_DEVICE (self) != NM_DEVICE (obj))
+ return;
+
+- if (nm_device_has_active_link (NM_DEVICE (self)))
+- {
+- GSource * source = g_idle_source_new ();
+-
+- g_source_set_callback (source, (GSourceFunc) link_deactivated_helper, self, NULL);
+- g_source_attach (source, nm_device_get_main_context (NM_DEVICE (self)));
+- g_source_unref (source);
+- }
++ source = g_idle_source_new ();
++ g_source_set_callback (source, (GSourceFunc) link_deactivated_helper, self, NULL);
++ g_source_attach (source, nm_device_get_main_context (NM_DEVICE (self)));
++ g_source_unref (source);
+ }
+
+ static void
More information about the arch-commits
mailing list