parent
68e3003ad6
commit
dcee9c1cfd
@ -0,0 +1,63 @@
|
||||
From 705b9978ed914aba87e5a5191a1d0acacaf70a81 Mon Sep 17 00:00:00 2001
|
||||
From: Alexandre Rostovtsev <tetromino@gentoo.org>
|
||||
Date: Wed, 1 Feb 2012 05:51:20 -0500
|
||||
Subject: [PATCH] gentoo: provide net and use inactive status when not
|
||||
connected
|
||||
|
||||
The status will be reset to started via a dispatcher script on up/down
|
||||
events. See https://bugs.gentoo.org/show_bug.cgi?id=252137
|
||||
---
|
||||
initscript/Gentoo/NetworkManager.in | 26 +++++++++++++++++++++++++-
|
||||
1 files changed, 25 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/initscript/Gentoo/NetworkManager.in b/initscript/Gentoo/NetworkManager.in
|
||||
index 7db410b..1960795 100755
|
||||
--- a/initscript/Gentoo/NetworkManager.in
|
||||
+++ b/initscript/Gentoo/NetworkManager.in
|
||||
@@ -3,18 +3,42 @@
|
||||
# Distributed under the terms of the GNU General Purpose License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net-r1.patch,v 1.2 2012/02/21 23:19:19 tetromino Exp $
|
||||
|
||||
+description="NetworkManager daemon. The service is marked as started only \
|
||||
+when a network connection is established."
|
||||
+
|
||||
depend() {
|
||||
need dbus
|
||||
+ provide net
|
||||
}
|
||||
|
||||
start() {
|
||||
+ # If we are re-called by a dispatcher event, we want to mark the service
|
||||
+ # as started without starting the daemon again
|
||||
+ yesno "${IN_BACKGROUND}" && return 0
|
||||
+
|
||||
+ [ -z "${INACTIVE_TIMEOUT}" ] && INACTIVE_TIMEOUT="1"
|
||||
+
|
||||
ebegin "Starting NetworkManager"
|
||||
start-stop-daemon --start --quiet --pidfile /var/run/NetworkManager.pid \
|
||||
--exec /usr/sbin/NetworkManager -- --pid-file /var/run/NetworkManager.pid
|
||||
- eend $?
|
||||
+ local _retval=$?
|
||||
+ eend "${_retval}"
|
||||
+ if [ "x${_retval}" = 'x0' ] && ! nm-online -t "${INACTIVE_TIMEOUT}"; then
|
||||
+ einfo "Marking NetworkManager as inactive. It will automatically be marked"
|
||||
+ einfo "as started after a network connection has been established."
|
||||
+ mark_service_inactive
|
||||
+ fi
|
||||
+ return "${_retval}"
|
||||
}
|
||||
|
||||
stop() {
|
||||
+ # If we are re-called by a dispatcher event, we want to mark the service
|
||||
+ # as inactive without stopping the daemon
|
||||
+ if yesno "${IN_BACKGROUND}"; then
|
||||
+ mark_service_inactive "${SVCNAME}"
|
||||
+ return 0
|
||||
+ fi
|
||||
+
|
||||
ebegin "Stopping NetworkManager"
|
||||
start-stop-daemon --stop --quiet --pidfile /var/run/NetworkManager.pid
|
||||
eend $?
|
||||
--
|
||||
1.7.8.4
|
||||
|
@ -0,0 +1,232 @@
|
||||
From 00b5c3785f7f5ce8da6db5da3fab814680ff82bc Mon Sep 17 00:00:00 2001
|
||||
From: Alexandre Rostovtsev <tetromino@gentoo.org>
|
||||
Date: Mon, 20 Feb 2012 02:14:26 -0500
|
||||
Subject: [PATCH] Implement "pre-sleep" action dispatch
|
||||
|
||||
Based on work by Christian Becke <christianbecke@gmail.com> in
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=387832
|
||||
|
||||
Adds a nm_utils_call_dispatcher_with_notify variant of the dispatcher
|
||||
call, and uses it to dispatch a "pre-sleep" action before sleeping.
|
||||
---
|
||||
callouts/nm-dispatcher-utils.c | 3 +-
|
||||
src/NetworkManagerUtils.c | 70 ++++++++++++++++++++++++++++++++++------
|
||||
src/NetworkManagerUtils.h | 12 +++++++
|
||||
src/nm-manager.c | 28 ++++++++++++----
|
||||
4 files changed, 95 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
|
||||
index 887e80d..db66b61 100644
|
||||
--- a/callouts/nm-dispatcher-utils.c
|
||||
+++ b/callouts/nm-dispatcher-utils.c
|
||||
@@ -407,7 +407,8 @@ nm_dispatcher_utils_construct_envp (const char *action,
|
||||
g_return_val_if_fail (*out_iface == NULL, NULL);
|
||||
|
||||
/* Hostname changes don't require a device nor contain a connection */
|
||||
- if (!strcmp (action, "hostname"))
|
||||
+ if (!strcmp (action, "hostname") ||
|
||||
+ !strcmp (action, "pre-sleep"))
|
||||
return g_new0 (char *, 1);
|
||||
|
||||
/* Canonicalize the VPN interface name; "" is used when passing it through
|
||||
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
|
||||
index 451de6d..008b94e 100644
|
||||
--- a/src/NetworkManagerUtils.c
|
||||
+++ b/src/NetworkManagerUtils.c
|
||||
@@ -44,6 +44,13 @@
|
||||
#include "nm-setting-wireless-security.h"
|
||||
#include "nm-manager-auth.h"
|
||||
|
||||
+typedef struct
|
||||
+{
|
||||
+ NMDBusManager *dbus_mgr;
|
||||
+ NMUtilsDispatcherDoneCallback notify;
|
||||
+ gpointer user_data;
|
||||
+} NMUtilsCallDispatcherNotifyData;
|
||||
+
|
||||
/*
|
||||
* nm_ethernet_address_is_valid
|
||||
*
|
||||
@@ -475,18 +482,36 @@ fill_vpn_props (NMIP4Config *ip4_config,
|
||||
static void
|
||||
dispatcher_done_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
|
||||
{
|
||||
+ NMUtilsCallDispatcherNotifyData *notify_data = (NMUtilsCallDispatcherNotifyData *) user_data;
|
||||
+
|
||||
dbus_g_proxy_end_call (proxy, call, NULL, G_TYPE_INVALID);
|
||||
g_object_unref (proxy);
|
||||
+ if (notify_data->notify != NULL)
|
||||
+ notify_data->notify (notify_data->user_data);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+nm_utils_call_dispatcher_notify_data_free (NMUtilsCallDispatcherNotifyData *data)
|
||||
+{
|
||||
+ if (data == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ if (data->dbus_mgr != NULL)
|
||||
+ g_object_unref (data->dbus_mgr);
|
||||
+ g_free (data);
|
||||
}
|
||||
|
||||
void
|
||||
-nm_utils_call_dispatcher (const char *action,
|
||||
- NMConnection *connection,
|
||||
- NMDevice *device,
|
||||
- const char *vpn_iface,
|
||||
- NMIP4Config *vpn_ip4_config,
|
||||
- NMIP6Config *vpn_ip6_config)
|
||||
+nm_utils_call_dispatcher_with_notify (const char *action,
|
||||
+ NMConnection *connection,
|
||||
+ NMDevice *device,
|
||||
+ const char *vpn_iface,
|
||||
+ NMIP4Config *vpn_ip4_config,
|
||||
+ NMIP6Config *vpn_ip6_config,
|
||||
+ NMUtilsDispatcherDoneCallback notify,
|
||||
+ gpointer user_data)
|
||||
{
|
||||
+ NMUtilsCallDispatcherNotifyData *notify_data;
|
||||
NMDBusManager *dbus_mgr;
|
||||
DBusGProxy *proxy;
|
||||
DBusGConnection *g_connection;
|
||||
@@ -503,7 +528,8 @@ nm_utils_call_dispatcher (const char *action,
|
||||
g_return_if_fail (action != NULL);
|
||||
|
||||
/* All actions except 'hostname' require a device */
|
||||
- if (strcmp (action, "hostname") != 0)
|
||||
+ if (strcmp (action, "hostname") != 0 &&
|
||||
+ strcmp (action, "pre-sleep") != 0)
|
||||
g_return_if_fail (NM_IS_DEVICE (device));
|
||||
/* VPN actions require at least an IPv4 config (for now) */
|
||||
if (strcmp (action, "vpn-up") == 0)
|
||||
@@ -544,7 +570,8 @@ nm_utils_call_dispatcher (const char *action,
|
||||
vpn_ip6_props = value_hash_create ();
|
||||
|
||||
/* hostname actions only send the hostname */
|
||||
- if (strcmp (action, "hostname") != 0) {
|
||||
+ if (strcmp (action, "hostname") != 0 &&
|
||||
+ strcmp (action, "pre-sleep") != 0) {
|
||||
fill_device_props (device,
|
||||
device_props,
|
||||
device_ip4_props,
|
||||
@@ -555,6 +582,11 @@ nm_utils_call_dispatcher (const char *action,
|
||||
fill_vpn_props (vpn_ip4_config, NULL, vpn_ip4_props, vpn_ip6_props);
|
||||
}
|
||||
|
||||
+ notify_data = g_new0 (NMUtilsCallDispatcherNotifyData, 1);
|
||||
+ notify_data->dbus_mgr = dbus_mgr;
|
||||
+ notify_data->notify = notify;
|
||||
+ notify_data->user_data = user_data;
|
||||
+
|
||||
/* Do a non-blocking call, but wait for the reply, because dbus-glib
|
||||
* sometimes needs time to complete internal housekeeping. If we use
|
||||
* dbus_g_proxy_call_no_reply(), that housekeeping (specifically the
|
||||
@@ -563,8 +595,8 @@ nm_utils_call_dispatcher (const char *action,
|
||||
*/
|
||||
dbus_g_proxy_begin_call_with_timeout (proxy, "Action",
|
||||
dispatcher_done_cb,
|
||||
- dbus_mgr, /* automatically unref the dbus mgr when call is done */
|
||||
- g_object_unref,
|
||||
+ notify_data, /* automatically unref the dbus mgr when call is done */
|
||||
+ (GDestroyNotify) nm_utils_call_dispatcher_notify_data_free,
|
||||
5000,
|
||||
G_TYPE_STRING, action,
|
||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash,
|
||||
@@ -589,6 +621,24 @@ nm_utils_call_dispatcher (const char *action,
|
||||
g_hash_table_destroy (vpn_ip6_props);
|
||||
}
|
||||
|
||||
+void
|
||||
+nm_utils_call_dispatcher (const char *action,
|
||||
+ NMConnection *connection,
|
||||
+ NMDevice *device,
|
||||
+ const char *vpn_iface,
|
||||
+ NMIP4Config *vpn_ip4_config,
|
||||
+ NMIP6Config *vpn_ip6_config)
|
||||
+{
|
||||
+ nm_utils_call_dispatcher_with_notify (action,
|
||||
+ connection,
|
||||
+ device,
|
||||
+ vpn_iface,
|
||||
+ vpn_ip4_config,
|
||||
+ vpn_ip6_config,
|
||||
+ NULL,
|
||||
+ NULL);
|
||||
+}
|
||||
+
|
||||
gboolean
|
||||
nm_match_spec_hwaddr (const GSList *specs, const char *hwaddr)
|
||||
{
|
||||
diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h
|
||||
index 1bf741e..bdc0fef 100644
|
||||
--- a/src/NetworkManagerUtils.h
|
||||
+++ b/src/NetworkManagerUtils.h
|
||||
@@ -49,6 +49,18 @@ void nm_utils_call_dispatcher (const char *action,
|
||||
NMIP4Config *vpn_ip4_config,
|
||||
NMIP6Config *vpn_ip6_config);
|
||||
|
||||
+typedef void (*NMUtilsDispatcherDoneCallback) (gpointer user_data);
|
||||
+
|
||||
+void
|
||||
+nm_utils_call_dispatcher_with_notify (const char *action,
|
||||
+ NMConnection *connection,
|
||||
+ NMDevice *device,
|
||||
+ const char *vpn_iface,
|
||||
+ NMIP4Config *vpn_ip4_config,
|
||||
+ NMIP6Config *vpn_ip6_config,
|
||||
+ NMUtilsDispatcherDoneCallback notify,
|
||||
+ gpointer user_data);
|
||||
+
|
||||
gboolean nm_match_spec_hwaddr (const GSList *specs, const char *hwaddr);
|
||||
gboolean nm_match_spec_s390_subchannels (const GSList *specs, const char *subchannels);
|
||||
|
||||
diff --git a/src/nm-manager.c b/src/nm-manager.c
|
||||
index 7205c7a..9e70071 100644
|
||||
--- a/src/nm-manager.c
|
||||
+++ b/src/nm-manager.c
|
||||
@@ -2433,6 +2433,23 @@ impl_manager_deactivate_connection (NMManager *self,
|
||||
}
|
||||
|
||||
static void
|
||||
+pre_sleep_dispatcher_done (gpointer user_data)
|
||||
+{
|
||||
+ NMManager *self = (NMManager *) user_data;
|
||||
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
||||
+ GSList *iter;
|
||||
+
|
||||
+ /* Just deactivate and down all devices from the device list,
|
||||
+ * to keep things fast the device list will get resynced when
|
||||
+ * the manager wakes up.
|
||||
+ */
|
||||
+ for (iter = priv->devices; iter; iter = iter->next)
|
||||
+ nm_device_set_managed (NM_DEVICE (iter->data), FALSE, NM_DEVICE_STATE_REASON_SLEEPING);
|
||||
+
|
||||
+ nm_manager_update_state (self);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
do_sleep_wake (NMManager *self)
|
||||
{
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
||||
@@ -2442,13 +2459,10 @@ do_sleep_wake (NMManager *self)
|
||||
if (manager_sleeping (self)) {
|
||||
nm_log_info (LOGD_SUSPEND, "sleeping or disabling...");
|
||||
|
||||
- /* Just deactivate and down all devices from the device list,
|
||||
- * to keep things fast the device list will get resynced when
|
||||
- * the manager wakes up.
|
||||
- */
|
||||
- for (iter = priv->devices; iter; iter = iter->next)
|
||||
- nm_device_set_managed (NM_DEVICE (iter->data), FALSE, NM_DEVICE_STATE_REASON_SLEEPING);
|
||||
-
|
||||
+ nm_utils_call_dispatcher_with_notify ("pre-sleep",
|
||||
+ NULL, NULL, NULL, NULL, NULL,
|
||||
+ pre_sleep_dispatcher_done, self);
|
||||
+ return;
|
||||
} else {
|
||||
nm_log_info (LOGD_SUSPEND, "waking up and re-enabling...");
|
||||
|
||||
--
|
||||
1.7.8.4
|
||||
|
@ -0,0 +1,34 @@
|
||||
From cc9f8102859cccd95ba7a13c00bc3cc4fb53aa0a Mon Sep 17 00:00:00 2001
|
||||
From: Rick Harris <rickfharris@yahoo.com.au>
|
||||
Date: Sun, 15 Apr 2012 09:44:55 +0000
|
||||
Subject: [PATCH] dhcp: do not require dhclient-4 to be built with DHCPv6
|
||||
|
||||
The "-4" flag is the default if dhclient-4 was built with DHCPv6 support
|
||||
enabled, and it's invalid if dhclient-4 was built without DHCPv6.
|
||||
Therefore, we simply should not use it.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=679428
|
||||
---
|
||||
src/dhcp-manager/nm-dhcp-dhclient.c | 5 +++--
|
||||
1 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c
|
||||
index 043cd63..14be5b2 100644
|
||||
--- a/src/dhcp-manager/nm-dhcp-dhclient.c
|
||||
+++ b/src/dhcp-manager/nm-dhcp-dhclient.c
|
||||
@@ -490,9 +490,10 @@ dhclient_start (NMDHCPClient *client,
|
||||
g_ptr_array_add (argv, (gpointer) "-6");
|
||||
if (mode_opt)
|
||||
g_ptr_array_add (argv, (gpointer) mode_opt);
|
||||
- } else {
|
||||
- g_ptr_array_add (argv, (gpointer) "-4");
|
||||
}
|
||||
+ /* We never want the "-4" flag: it's the default if dhclient was
|
||||
+ * built with DHCPv6 support, and invalid otherwise.
|
||||
+ */
|
||||
#endif
|
||||
|
||||
g_ptr_array_add (argv, (gpointer) "-sf"); /* Set script file */
|
||||
--
|
||||
1.7.8.6
|
||||
|
@ -0,0 +1,83 @@
|
||||
From d6fd1cf98a617aaf78ee98ec0a3ac5c468ac666f Mon Sep 17 00:00:00 2001
|
||||
From: Alexandre Rostovtsev <tetromino@gentoo.org>
|
||||
Date: Sun, 13 Nov 2011 17:51:47 -0500
|
||||
Subject: [PATCH] Allow building against libnl:1.1 only
|
||||
|
||||
Allow building against libnl:1.1 only for wimax. Otherwise, networkmanager
|
||||
will link to libnl-3.so and to libiWmxSdk (from wimax-1.5.2) which links
|
||||
to libnl.so, and then explode spectacularly at runtime due to symbol
|
||||
collisions.
|
||||
---
|
||||
configure.ac | 47 +++++++++++++++++++----------------------------
|
||||
1 files changed, 19 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index ed66b3d..c88cbe4 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -379,32 +379,27 @@ AM_CONDITIONAL(SESSION_TRACKING_SYSTEMD, test "x$with_session_tracking" = "xsyst
|
||||
|
||||
|
||||
have_libnl="no"
|
||||
-PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [have_libnl3=yes], [have_libnl3=no])
|
||||
-PKG_CHECK_MODULES(LIBNL_ROUTE3, libnl-route-3.0, [have_libnl_route3=yes], [have_libnl_route3=no])
|
||||
-PKG_CHECK_MODULES(LIBNL_GENL3, libnl-genl-3.0, [have_libnl_genl3=yes], [have_libnl_genl3=no])
|
||||
-if (test "${have_libnl3}" = "yes" -a "${have_libnl_route3}" = "yes" -a "${have_libnl_genl3}" = "yes"); then
|
||||
- AC_DEFINE(HAVE_LIBNL3, 1, [Define if you require specific libnl-3 support])
|
||||
- LIBNL_CFLAGS="$LIBNL3_CFLAGS $LIBNL_ROUTE3_CFLAGS $LIBNL_GENL3_CFLAGS"
|
||||
- LIBNL_LIBS="$LIBNL3_LIBS $LIBNL_ROUTE3_LIBS $LIBNL_GENL3_LIBS"
|
||||
- libnl_version="3"
|
||||
- have_libnl="yes"
|
||||
+AC_ARG_WITH(libnl-1, AS_HELP_STRING([--with-libnl-1], [use legacy libnl-1 instead of libnl-3]), ,[with_libnl_1=no])
|
||||
+if (test "${with_libnl_1}" = "yes"); then
|
||||
+ PKG_CHECK_MODULES(LIBNL1, libnl-1 >= 1.0-pre8, [have_libnl1=yes], [have_libnl1=no])
|
||||
+ if (test "${have_libnl1}" = "yes"); then
|
||||
+ AC_DEFINE(HAVE_LIBNL1, 1, [Define if you require libnl-1 legacy support])
|
||||
+ LIBNL_CFLAGS="$LIBNL1_CFLAGS"
|
||||
+ LIBNL_LIBS="$LIBNL1_LIBS"
|
||||
+ libnl_version="1"
|
||||
+ have_libnl="yes"
|
||||
+ NM_LIBNL_CHECK
|
||||
+ fi
|
||||
else
|
||||
- PKG_CHECK_MODULES(LIBNL2, libnl-2.0, [have_libnl2=yes], [have_libnl2=no])
|
||||
- if (test "${have_libnl2}" = "yes"); then
|
||||
- AC_DEFINE(HAVE_LIBNL2, 1, [Define if you require specific libnl-2 support])
|
||||
- LIBNL_CFLAGS="$LIBNL2_CFLAGS"
|
||||
- LIBNL_LIBS="$LIBNL2_LIBS"
|
||||
- libnl_version="2"
|
||||
+ PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [have_libnl3=yes], [have_libnl3=no])
|
||||
+ PKG_CHECK_MODULES(LIBNL_ROUTE3, libnl-route-3.0, [have_libnl_route3=yes], [have_libnl_route3=no])
|
||||
+ PKG_CHECK_MODULES(LIBNL_GENL3, libnl-genl-3.0, [have_libnl_genl3=yes], [have_libnl_genl3=no])
|
||||
+ if (test "${have_libnl3}" = "yes" -a "${have_libnl_route3}" = "yes" -a "${have_libnl_genl3}" = "yes"); then
|
||||
+ AC_DEFINE(HAVE_LIBNL3, 1, [Define if you require specific libnl-3 support])
|
||||
+ LIBNL_CFLAGS="$LIBNL3_CFLAGS $LIBNL_ROUTE3_CFLAGS $LIBNL_GENL3_CFLAGS"
|
||||
+ LIBNL_LIBS="$LIBNL3_LIBS $LIBNL_ROUTE3_LIBS $LIBNL_GENL3_LIBS"
|
||||
+ libnl_version="3"
|
||||
have_libnl="yes"
|
||||
- else
|
||||
- PKG_CHECK_MODULES(LIBNL1, libnl-1 >= 1.0-pre8, [have_libnl1=yes], [have_libnl1=no])
|
||||
- if (test "${have_libnl1}" = "yes"); then
|
||||
- AC_DEFINE(HAVE_LIBNL1, 1, [Define if you require libnl-1 legacy support])
|
||||
- LIBNL_CFLAGS="$LIBNL1_CFLAGS"
|
||||
- LIBNL_LIBS="$LIBNL1_LIBS"
|
||||
- libnl_version="1"
|
||||
- have_libnl="yes"
|
||||
- fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -414,10 +409,6 @@ fi
|
||||
AC_SUBST(LIBNL_CFLAGS)
|
||||
AC_SUBST(LIBNL_LIBS)
|
||||
|
||||
-if (test "${libnl_version}" = "1"); then
|
||||
- NM_LIBNL_CHECK
|
||||
-fi
|
||||
-
|
||||
PKG_CHECK_MODULES(UUID, uuid)
|
||||
AC_SUBST(UUID_CFLAGS)
|
||||
AC_SUBST(UUID_LIBS)
|
||||
--
|
||||
1.7.8.5
|
||||
|
Loading…
Reference in new issue