Permalink
Browse files

FL-477: networkmanager version bump (masked)

  • Loading branch information...
1 parent 69b8867 commit f36d5b7fbff283ed52ae2a4eb65b9177b5751502 @jeanfrancisroy jeanfrancisroy committed Apr 1, 2013
@@ -1 +1,2 @@
DIST NetworkManager-0.9.6.4.tar.xz 1968564 SHA256 511b411e055d187bc8f26c519fdb3e55e07fc40d4adecbbec623c0249380a7eb SHA512 900eb30f7fed35d43f2c1003fcf7fc0b6ab9c5a9f0a14777d4636372376af8477e63fc7fc9b05d2f281d48de658d96d9b30f44851af8ae2b4271bb2b5c2cb669 WHIRLPOOL b87903e4cbb3efcec17b25e74dd67dc6a81a6d553df57e9c699bb1f0d40fe6d611953f6baaeca48ef4387316980d775ec2b07a9df06ecb5f03c10dffc2b60584
+DIST NetworkManager-0.9.8.0.tar.xz 2056356 SHA256 c366bcded6354d8186ad93c05d26d6a20bc550aa0391f974704e7a60e9f6096b SHA512 a13cf044b405ecafe1c28f6b0796e62968e4090862ec45eae48fd65c644f520b45107e37c97150e4f9c47d50de7663c0e74baeb2cade4b5f0736dede4d79c398 WHIRLPOOL 9449c404fade944cc2d3f267894bafc9574e6da4f93534151d7e41b6f8c55cb417bab89b09add3a06278467483cf64ccdc3651d29646ead0c46251fecd678284
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright (c) 2012 Alexandre Rostovtsev
+# Released under the 2-clause BSD license.
+
+# Ensures that the NetworkManager OpenRC service is marked as started and
+# providing net only when it has a successful connection.
+
+# Ensure rc-service is in PATH
+PATH="${PATH}:@EPREFIX@/sbin:@EPREFIX@/usr/sbin"
+
+# Exit if the NetworkManager OpenRC service is not running
+rc-service NetworkManager status 2>&1 | grep -Eq "status: (starting|started|inactive|stopping)" || exit 0
+
+# Call rc-service in background mode so that the start/stop functions update
+# NetworkManager service status to started or inactive instead of actually
+# starting or stopping the daemon
+export IN_BACKGROUND=YES
+
+case "$2" in
+ up) nm-online -t 0 -x &&
+ ! rc-service NetworkManager status 2>&1 | grep -q started &&
+ exec rc-service NetworkManager start ;;
+ down) nm-online -t 0 -x ||
+ rc-service NetworkManager status 2>&1 | grep -q stopped ||
+ exec rc-service NetworkManager stop ;;
+ pre-sleep) rc-service NetworkManager status 2>&1 | grep -q stopped ||
+ exec rc-service NetworkManager stop ;;
+esac
+exit 0
+# vim: set ts=4:
@@ -0,0 +1,57 @@
+#!/sbin/runscript
+# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org>
+# Distributed under the terms of the GNU General Purpose License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/files/init.d.NetworkManager,v 1.1 2013/01/28 07:05:05 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 /run/NetworkManager/NetworkManager.pid \
+ --exec /usr/sbin/NetworkManager -- --pid-file /run/NetworkManager/NetworkManager.pid
+ 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"
+ local pidfile=/run/NetworkManager/NetworkManager.pid
+ if [ ! -e "${pidfile}" ] && [ -e /var/run/NetworkManager.pid ]; then
+ # Try stopping the pid file used by <0.9.7
+ pidfile=/var/run/NetworkManager.pid
+ start-stop-daemon --stop --quiet --pidfile "${pidfile}"
+ ret=$?
+ [ ${ret} = 0 ] && [ -e "${pidfile}" ] && rm "${pidfile}"
+ eend ${ret}
+ else
+ start-stop-daemon --stop --quiet --pidfile "${pidfile}"
+ eend $?
+ fi
+}
+
+# vim: set ft=gentoo-init-d ts=4 :
@@ -0,0 +1,131 @@
+From 83dd792c8678337aba0af100bb4590c6325b696e Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gentoo.org>
+Date: Sun, 27 Jan 2013 23:39:56 -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
+---
+ callouts/nm-dispatcher-utils.c | 3 ++-
+ src/nm-dispatcher.c | 8 ++++++--
+ src/nm-dispatcher.h | 3 ++-
+ src/nm-manager.c | 28 +++++++++++++++++++++-------
+ 4 files changed, 31 insertions(+), 11 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/nm-dispatcher.c b/src/nm-dispatcher.c
+index 61dfd7c..c4a2829 100644
+--- a/src/nm-dispatcher.c
++++ b/src/nm-dispatcher.c
+@@ -237,6 +237,8 @@ action_to_string (DispatcherAction action)
+ return "dhcp4-change";
+ case DISPATCHER_ACTION_DHCP6_CHANGE:
+ return "dhcp6-change";
++ case DISPATCHER_ACTION_PRE_SLEEP:
++ return "pre-sleep";
+ default:
+ break;
+ }
+@@ -269,7 +271,8 @@ _dispatcher_call (DispatcherAction action,
+ DispatchInfo *info;
+
+ /* All actions except 'hostname' require a device */
+- if (action != DISPATCHER_ACTION_HOSTNAME)
++ if (action != DISPATCHER_ACTION_HOSTNAME &&
++ action != DISPATCHER_ACTION_PRE_SLEEP)
+ g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
+ /* VPN actions require at least an IPv4 config (for now) */
+ if (action == DISPATCHER_ACTION_VPN_UP)
+@@ -308,7 +311,8 @@ _dispatcher_call (DispatcherAction action,
+ vpn_ip6_props = value_hash_create ();
+
+ /* hostname actions only send the hostname */
+- if (action != DISPATCHER_ACTION_HOSTNAME) {
++ if (action != DISPATCHER_ACTION_HOSTNAME &&
++ action != DISPATCHER_ACTION_PRE_SLEEP) {
+ fill_device_props (device,
+ device_props,
+ device_ip4_props,
+diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h
+index 05a6c87..8e95834 100644
+--- a/src/nm-dispatcher.h
++++ b/src/nm-dispatcher.h
+@@ -39,7 +39,8 @@ typedef enum {
+ DISPATCHER_ACTION_VPN_PRE_DOWN,
+ DISPATCHER_ACTION_VPN_DOWN,
+ DISPATCHER_ACTION_DHCP4_CHANGE,
+- DISPATCHER_ACTION_DHCP6_CHANGE
++ DISPATCHER_ACTION_DHCP6_CHANGE,
++ DISPATCHER_ACTION_PRE_SLEEP = 999,
+ } DispatcherAction;
+
+ typedef void (*DispatcherFunc) (gconstpointer call, gpointer user_data);
+diff --git a/src/nm-manager.c b/src/nm-manager.c
+index fbc9d23..197b213 100644
+--- a/src/nm-manager.c
++++ b/src/nm-manager.c
+@@ -71,6 +71,7 @@
+ #include "wifi-utils.h"
+ #include "nm-enum-types.h"
+ #include "nm-sleep-monitor.h"
++#include "nm-dispatcher.h"
+
+ #if WITH_CONCHECK
+ #include "nm-connectivity.h"
+@@ -3149,6 +3150,23 @@ impl_manager_deactivate_connection (NMManager *self,
+ }
+
+ static void
++pre_sleep_dispatcher_done (gpointer call, 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);
+@@ -3158,13 +3176,9 @@ 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_dispatcher_call (DISPATCHER_ACTION_PRE_SLEEP, NULL, NULL,
++ pre_sleep_dispatcher_done, self);
++ return;
+ } else {
+ nm_log_info (LOGD_SUSPEND, "waking up and re-enabling...");
+
+--
+1.8.1.1
+
Oops, something went wrong.

0 comments on commit f36d5b7

Please sign in to comment.