/[gentoo-x86]/net-misc/networkmanager/files/networkmanager-0.9.1.95-dns-routing-unmanaged-devices.patch
Gentoo

Contents of /net-misc/networkmanager/files/networkmanager-0.9.1.95-dns-routing-unmanaged-devices.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Feb 1 07:46:37 2012 UTC (2 years, 5 months ago) by tetromino
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Install nm-interfaces service to provide net dependency for openrc only when nm is connected (inspired by Xake's solution in bug #252137). Correctly deal with single quotes in /etc/conf.d/hostname. Do not create /var/run/NetworkManager, it's not needed in Gentoo (bug #401019, thanks to Maxim Kammerer). Drop old.

(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)

1 From fc0739a5d4e714234e1d544db838e932219c5d4d Mon Sep 17 00:00:00 2001
2 From: Mathieu Trudel-Lapierre <mathieu.tl@gmail.com>
3 Date: Wed, 2 Nov 2011 15:28:43 -0500
4 Subject: [PATCH] dns: don't update routing and DNS if no devices were ever
5 managed (lp:862134)
6
7 Avoids blowing away existing routes and resolv.conf if NM never
8 managed any devices.
9 ---
10 src/dns-manager/nm-dns-manager.c | 21 +++++++++++++--------
11 src/nm-policy.c | 9 +++++++++
12 2 files changed, 22 insertions(+), 8 deletions(-)
13
14 diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c
15 index 0203f2b..ddfd47c 100644
16 --- a/src/dns-manager/nm-dns-manager.c
17 +++ b/src/dns-manager/nm-dns-manager.c
18 @@ -1097,15 +1097,20 @@ dispose (GObject *object)
19 g_slist_free (priv->plugins);
20 priv->plugins = NULL;
21
22 - /* If we're quitting leave a valid resolv.conf in place, not one
23 - * pointing to 127.0.0.1 if any plugins were active. Thus update
24 - * DNS after disposing of all plugins.
25 + /* If last_iface is NULL, this means we haven't done a DNS update before,
26 + * so no reason to try and take down entries from resolv.conf.
27 */
28 - if (!update_dns (self, priv->last_iface, TRUE, &error)) {
29 - nm_log_warn (LOGD_DNS, "could not commit DNS changes on shutdown: (%d) %s",
30 - error ? error->code : -1,
31 - error && error->message ? error->message : "(unknown)");
32 - g_clear_error (&error);
33 + if (priv->last_iface != NULL) {
34 + /* If we're quitting leave a valid resolv.conf in place, not one
35 + * pointing to 127.0.0.1 if any plugins were active. Thus update
36 + * DNS after disposing of all plugins.
37 + */
38 + if (!update_dns (self, priv->last_iface, TRUE, &error)) {
39 + nm_log_warn (LOGD_DNS, "could not commit DNS changes on shutdown: (%d) %s",
40 + error ? error->code : -1,
41 + error && error->message ? error->message : "(unknown)");
42 + g_clear_error (&error);
43 + }
44 }
45
46 g_slist_foreach (priv->configs, (GFunc) g_object_unref, NULL);
47 diff --git a/src/nm-policy.c b/src/nm-policy.c
48 index cd8245e..669db28 100644
49 --- a/src/nm-policy.c
50 +++ b/src/nm-policy.c
51 @@ -1042,6 +1042,15 @@ device_state_changed (NMDevice *device,
52 update_routing_and_dns (policy, FALSE);
53 break;
54 case NM_DEVICE_STATE_UNMANAGED:
55 + if ( old_state == NM_DEVICE_STATE_UNAVAILABLE
56 + || old_state == NM_DEVICE_STATE_DISCONNECTED) {
57 + /* If the device was never activated, there's no point in
58 + * updating routing or DNS. This allows us to keep the previous
59 + * resolv.conf or routes from before NM started if no device was
60 + * ever managed by NM.
61 + */
62 + break;
63 + }
64 case NM_DEVICE_STATE_UNAVAILABLE:
65 update_routing_and_dns (policy, FALSE);
66 break;
67 --
68 1.7.7.2

  ViewVC Help
Powered by ViewVC 1.1.20