/[gentoo-x86]/net-misc/networkmanager/files/networkmanager-0.9.7.995-pre-sleep.patch
Gentoo

Contents of /net-misc/networkmanager/files/networkmanager-0.9.7.995-pre-sleep.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Mon Jan 28 07:05:05 2013 UTC (14 months, 3 weeks ago) by tetromino
Branch: MAIN
CVS Tags: HEAD
Add 0.9.8 development pre-release and a live git ebuild (bug #444814, thanks to Pavel Šimerda and Sobhan Mohammadpour). Lots of improvements and bugfixes. Wimax support has been disabled until we have a libnl:3 compatible version in portage.

(Portage version: 2.2.0_alpha161/cvs/Linux x86_64, signed Manifest commit with key CF0ADD61)

1 From 83dd792c8678337aba0af100bb4590c6325b696e Mon Sep 17 00:00:00 2001
2 From: Alexandre Rostovtsev <tetromino@gentoo.org>
3 Date: Sun, 27 Jan 2013 23:39:56 -0500
4 Subject: [PATCH] Implement "pre-sleep" action dispatch
5
6 Based on work by Christian Becke <christianbecke@gmail.com> in
7 https://bugzilla.gnome.org/show_bug.cgi?id=387832
8 ---
9 callouts/nm-dispatcher-utils.c | 3 ++-
10 src/nm-dispatcher.c | 8 ++++++--
11 src/nm-dispatcher.h | 3 ++-
12 src/nm-manager.c | 28 +++++++++++++++++++++-------
13 4 files changed, 31 insertions(+), 11 deletions(-)
14
15 diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
16 index 887e80d..db66b61 100644
17 --- a/callouts/nm-dispatcher-utils.c
18 +++ b/callouts/nm-dispatcher-utils.c
19 @@ -407,7 +407,8 @@ nm_dispatcher_utils_construct_envp (const char *action,
20 g_return_val_if_fail (*out_iface == NULL, NULL);
21
22 /* Hostname changes don't require a device nor contain a connection */
23 - if (!strcmp (action, "hostname"))
24 + if (!strcmp (action, "hostname") ||
25 + !strcmp (action, "pre-sleep"))
26 return g_new0 (char *, 1);
27
28 /* Canonicalize the VPN interface name; "" is used when passing it through
29 diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c
30 index 61dfd7c..c4a2829 100644
31 --- a/src/nm-dispatcher.c
32 +++ b/src/nm-dispatcher.c
33 @@ -237,6 +237,8 @@ action_to_string (DispatcherAction action)
34 return "dhcp4-change";
35 case DISPATCHER_ACTION_DHCP6_CHANGE:
36 return "dhcp6-change";
37 + case DISPATCHER_ACTION_PRE_SLEEP:
38 + return "pre-sleep";
39 default:
40 break;
41 }
42 @@ -269,7 +271,8 @@ _dispatcher_call (DispatcherAction action,
43 DispatchInfo *info;
44
45 /* All actions except 'hostname' require a device */
46 - if (action != DISPATCHER_ACTION_HOSTNAME)
47 + if (action != DISPATCHER_ACTION_HOSTNAME &&
48 + action != DISPATCHER_ACTION_PRE_SLEEP)
49 g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
50 /* VPN actions require at least an IPv4 config (for now) */
51 if (action == DISPATCHER_ACTION_VPN_UP)
52 @@ -308,7 +311,8 @@ _dispatcher_call (DispatcherAction action,
53 vpn_ip6_props = value_hash_create ();
54
55 /* hostname actions only send the hostname */
56 - if (action != DISPATCHER_ACTION_HOSTNAME) {
57 + if (action != DISPATCHER_ACTION_HOSTNAME &&
58 + action != DISPATCHER_ACTION_PRE_SLEEP) {
59 fill_device_props (device,
60 device_props,
61 device_ip4_props,
62 diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h
63 index 05a6c87..8e95834 100644
64 --- a/src/nm-dispatcher.h
65 +++ b/src/nm-dispatcher.h
66 @@ -39,7 +39,8 @@ typedef enum {
67 DISPATCHER_ACTION_VPN_PRE_DOWN,
68 DISPATCHER_ACTION_VPN_DOWN,
69 DISPATCHER_ACTION_DHCP4_CHANGE,
70 - DISPATCHER_ACTION_DHCP6_CHANGE
71 + DISPATCHER_ACTION_DHCP6_CHANGE,
72 + DISPATCHER_ACTION_PRE_SLEEP = 999,
73 } DispatcherAction;
74
75 typedef void (*DispatcherFunc) (gconstpointer call, gpointer user_data);
76 diff --git a/src/nm-manager.c b/src/nm-manager.c
77 index fbc9d23..197b213 100644
78 --- a/src/nm-manager.c
79 +++ b/src/nm-manager.c
80 @@ -71,6 +71,7 @@
81 #include "wifi-utils.h"
82 #include "nm-enum-types.h"
83 #include "nm-sleep-monitor.h"
84 +#include "nm-dispatcher.h"
85
86 #if WITH_CONCHECK
87 #include "nm-connectivity.h"
88 @@ -3149,6 +3150,23 @@ impl_manager_deactivate_connection (NMManager *self,
89 }
90
91 static void
92 +pre_sleep_dispatcher_done (gpointer call, gpointer user_data)
93 +{
94 + NMManager *self = (NMManager *) user_data;
95 + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
96 + GSList *iter;
97 +
98 + /* Just deactivate and down all devices from the device list,
99 + * to keep things fast the device list will get resynced when
100 + * the manager wakes up.
101 + */
102 + for (iter = priv->devices; iter; iter = iter->next)
103 + nm_device_set_managed (NM_DEVICE (iter->data), FALSE, NM_DEVICE_STATE_REASON_SLEEPING);
104 +
105 + nm_manager_update_state (self);
106 +}
107 +
108 +static void
109 do_sleep_wake (NMManager *self)
110 {
111 NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
112 @@ -3158,13 +3176,9 @@ do_sleep_wake (NMManager *self)
113 if (manager_sleeping (self)) {
114 nm_log_info (LOGD_SUSPEND, "sleeping or disabling...");
115
116 - /* Just deactivate and down all devices from the device list,
117 - * to keep things fast the device list will get resynced when
118 - * the manager wakes up.
119 - */
120 - for (iter = priv->devices; iter; iter = iter->next)
121 - nm_device_set_managed (NM_DEVICE (iter->data), FALSE, NM_DEVICE_STATE_REASON_SLEEPING);
122 -
123 + nm_dispatcher_call (DISPATCHER_ACTION_PRE_SLEEP, NULL, NULL,
124 + pre_sleep_dispatcher_done, self);
125 + return;
126 } else {
127 nm_log_info (LOGD_SUSPEND, "waking up and re-enabling...");
128
129 --
130 1.8.1.1

  ViewVC Help
Powered by ViewVC 1.1.20