Make patches gbp-pq compatible
Michael Biebl
10 years ago
0 | From: Michael Biebl <biebl@debian.org> | |
1 | Date: Wed, 2 Apr 2014 03:15:53 +0200 | |
2 | Subject: Add D-Bus policy for group netdev | |
3 | ||
4 | This is more or less a verbatim copy of the at_console section. | |
5 | --- | |
6 | src/org.freedesktop.NetworkManager.conf | 61 +++++++++++++++++++++++++++++++++ | |
7 | 1 file changed, 61 insertions(+) | |
8 | ||
9 | diff --git a/src/org.freedesktop.NetworkManager.conf b/src/org.freedesktop.NetworkManager.conf | |
10 | index 5e7bafa..e5378d7 100644 | |
11 | --- a/src/org.freedesktop.NetworkManager.conf | |
12 | +++ b/src/org.freedesktop.NetworkManager.conf | |
13 | @@ -86,6 +86,67 @@ | |
14 | send_interface="org.freedesktop.NetworkManager" | |
15 | send_member="wake"/> | |
16 | </policy> | |
17 | + <policy group="netdev"> | |
18 | + <allow send_destination="org.freedesktop.NetworkManager"/> | |
19 | + | |
20 | + <allow send_destination="org.freedesktop.NetworkManager" | |
21 | + send_interface="org.freedesktop.DBus.Introspectable"/> | |
22 | + | |
23 | + <allow send_destination="org.freedesktop.NetworkManager" | |
24 | + send_interface="org.freedesktop.DBus.Properties"/> | |
25 | + | |
26 | + <allow send_destination="org.freedesktop.NetworkManager" | |
27 | + send_interface="org.freedesktop.NetworkManager"/> | |
28 | + | |
29 | + <allow send_destination="org.freedesktop.NetworkManager" | |
30 | + send_interface="org.freedesktop.NetworkManager.AccessPoint"/> | |
31 | + | |
32 | + <allow send_destination="org.freedesktop.NetworkManager" | |
33 | + send_interface="org.freedesktop.NetworkManager.Connection.Active"/> | |
34 | + | |
35 | + <allow send_destination="org.freedesktop.NetworkManager" | |
36 | + send_interface="org.freedesktop.NetworkManager.Device.Modem"/> | |
37 | + | |
38 | + <allow send_destination="org.freedesktop.NetworkManager" | |
39 | + send_interface="org.freedesktop.NetworkManager.Device.Wired"/> | |
40 | + | |
41 | + <allow send_destination="org.freedesktop.NetworkManager" | |
42 | + send_interface="org.freedesktop.NetworkManager.Device.Serial"/> | |
43 | + | |
44 | + <allow send_destination="org.freedesktop.NetworkManager" | |
45 | + send_interface="org.freedesktop.NetworkManager.Device.Wireless"/> | |
46 | + | |
47 | + <allow send_destination="org.freedesktop.NetworkManager" | |
48 | + send_interface="org.freedesktop.NetworkManager.Device"/> | |
49 | + | |
50 | + <allow send_destination="org.freedesktop.NetworkManager" | |
51 | + send_interface="org.freedesktop.NetworkManager.DHCP4Config"/> | |
52 | + | |
53 | + <allow send_destination="org.freedesktop.NetworkManager" | |
54 | + send_interface="org.freedesktop.NetworkManager.IP4Config"/> | |
55 | + | |
56 | + <allow send_destination="org.freedesktop.NetworkManager" | |
57 | + send_interface="org.freedesktop.NetworkManager.VPN.Connection"/> | |
58 | + | |
59 | + <allow send_destination="org.freedesktop.NetworkManager" | |
60 | + send_interface="org.freedesktop.NetworkManager.AgentManager"/> | |
61 | + | |
62 | + <deny send_destination="org.freedesktop.NetworkManager" | |
63 | + send_interface="org.freedesktop.NetworkManager" | |
64 | + send_member="SetLogging"/> | |
65 | + | |
66 | + <deny send_destination="org.freedesktop.NetworkManager" | |
67 | + send_interface="org.freedesktop.NetworkManager" | |
68 | + send_member="Sleep"/> | |
69 | + | |
70 | + <deny send_destination="org.freedesktop.NetworkManager" | |
71 | + send_interface="org.freedesktop.NetworkManager" | |
72 | + send_member="sleep"/> | |
73 | + | |
74 | + <deny send_destination="org.freedesktop.NetworkManager" | |
75 | + send_interface="org.freedesktop.NetworkManager" | |
76 | + send_member="wake"/> | |
77 | + </policy> | |
78 | <policy context="default"> | |
79 | <deny own="org.freedesktop.NetworkManager"/> | |
80 |
0 | From: Michael Biebl <biebl@debian.org> | |
1 | Date: Wed, 2 Apr 2014 03:15:53 +0200 | |
2 | Subject: Debian specific tweaks for NetworkManager systemd service file | |
3 | ||
4 | This patch is needed to avoid a dependency loop which is generated | |
5 | by early boot (rcS) SysV init scripts depending on the $network LSB | |
6 | system facility (either directly or indirectly via $remote_fs). | |
7 | ||
8 | The $network LSB system facility is mapped to network.target. | |
9 | ||
10 | Those rcS SysV init scripts are started in sysinit.target, | |
11 | NetworkManager.service is started via multi-user.target, which depends | |
12 | on sysinit.target. | |
13 | ||
14 | As long as we have rcS SysV init scripts which such a dependency on | |
15 | $remote_fs or $network we can not make NetworkManager.service a provider | |
16 | for network.target. | |
17 | --- | |
18 | data/NetworkManager.service.in | 2 -- | |
19 | 1 file changed, 2 deletions(-) | |
20 | ||
21 | diff --git a/data/NetworkManager.service.in b/data/NetworkManager.service.in | |
22 | index ddc1627..526a56e 100644 | |
23 | --- a/data/NetworkManager.service.in | |
24 | +++ b/data/NetworkManager.service.in | |
25 | @@ -1,7 +1,5 @@ | |
26 | [Unit] | |
27 | Description=Network Manager | |
28 | -Wants=network.target | |
29 | -Before=network.target | |
30 | ||
31 | [Service] | |
32 | Type=dbus |
0 | From: Michael Biebl <biebl@debian.org> | |
1 | Date: Wed, 2 Apr 2014 03:15:53 +0200 | |
2 | Subject: Force online state with unmanaged devices | |
3 | ||
4 | If we have unmanaged devices in /e/n/i, monitor the ifupdown state file | |
5 | and in case we find active interfaces besides lo, forcefully set the | |
6 | online state to CONNECTED. | |
7 | ||
8 | Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512286 | |
9 | --- | |
10 | src/nm-manager.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11 | 1 file changed, 102 insertions(+) | |
12 | ||
13 | diff --git a/src/nm-manager.c b/src/nm-manager.c | |
14 | index 9c82d14..7dbba47 100644 | |
15 | --- a/src/nm-manager.c | |
16 | +++ b/src/nm-manager.c | |
17 | @@ -78,6 +78,8 @@ | |
18 | #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" | |
19 | #define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" | |
20 | ||
21 | +#define IFUPDOWN_STATE_FILE "/run/network/ifstate" | |
22 | + | |
23 | static gboolean impl_manager_get_devices (NMManager *manager, | |
24 | GPtrArray **devices, | |
25 | GError **err); | |
26 | @@ -249,6 +251,11 @@ typedef struct { | |
27 | guint fw_monitor_id; | |
28 | guint fw_changed_id; | |
29 | ||
30 | + /* ifupdown state file monitor */ | |
31 | + GFileMonitor *ifstate_monitor; | |
32 | + guint ifstate_monitor_id; | |
33 | + gboolean ifstate_force_online; | |
34 | + | |
35 | guint timestamp_update_id; | |
36 | ||
37 | GHashTable *nm_bridges; | |
38 | @@ -618,6 +625,14 @@ nm_manager_update_state (NMManager *manager) | |
39 | } | |
40 | } | |
41 | ||
42 | + if (state == NM_DEVICE_STATE_UNMANAGED) { | |
43 | + const char *iface = nm_device_get_ip_iface (dev); | |
44 | + if (priv->ifstate_force_online) { | |
45 | + new_state = NM_STATE_CONNECTED; | |
46 | + nm_log_dbg (LOGD_CORE, "Unmanaged device found: %s; state CONNECTED forced.", iface); | |
47 | + } | |
48 | + } | |
49 | + | |
50 | if (nm_device_is_activating (dev)) | |
51 | new_state = NM_STATE_CONNECTING; | |
52 | else if (new_state != NM_STATE_CONNECTING) { | |
53 | @@ -4090,6 +4105,65 @@ policy_activating_device_changed (GObject *object, GParamSpec *pspec, gpointer u | |
54 | } | |
55 | } | |
56 | ||
57 | +static void | |
58 | +check_ifstate_file (gpointer user_data) | |
59 | +{ | |
60 | + NMManager *self = NM_MANAGER (user_data); | |
61 | + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
62 | + GIOChannel *channel; | |
63 | + gchar *line; | |
64 | + gboolean online = FALSE; | |
65 | + | |
66 | + channel = g_io_channel_new_file (IFUPDOWN_STATE_FILE, "r", NULL); | |
67 | + if (!channel) { | |
68 | + nm_log_warn (LOGD_CORE, "Error: failed to open %s", IFUPDOWN_STATE_FILE); | |
69 | + return; | |
70 | + } | |
71 | + | |
72 | + while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL) | |
73 | + != G_IO_STATUS_EOF && !online) { | |
74 | + g_strstrip (line); | |
75 | + if (strlen (line) > 0 && g_strcmp0 (line, "lo=lo") != 0) { | |
76 | + online = TRUE; | |
77 | + } | |
78 | + g_free (line); | |
79 | + } | |
80 | + | |
81 | + g_io_channel_shutdown (channel, FALSE, NULL); | |
82 | + g_io_channel_unref (channel); | |
83 | + | |
84 | + if (priv->ifstate_force_online != online) { | |
85 | + priv->ifstate_force_online = online; | |
86 | + nm_manager_update_state (self); | |
87 | + } | |
88 | +} | |
89 | + | |
90 | +static void | |
91 | +ifstate_file_changed (GFileMonitor *monitor, | |
92 | + GFile *file, | |
93 | + GFile *other_file, | |
94 | + GFileMonitorEvent event_type, | |
95 | + gpointer user_data) | |
96 | +{ | |
97 | + NMManager *self = NM_MANAGER (user_data); | |
98 | + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
99 | + | |
100 | + switch (event_type) { | |
101 | +// case G_FILE_MONITOR_EVENT_CREATED: | |
102 | +//#if GLIB_CHECK_VERSION(2,23,4) | |
103 | +// case G_FILE_MONITOR_EVENT_MOVED: | |
104 | +//#endif | |
105 | +// case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: | |
106 | + case G_FILE_MONITOR_EVENT_CHANGED: | |
107 | + case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: | |
108 | + nm_log_dbg (LOGD_CORE, "ifupdown state file %s was changed", IFUPDOWN_STATE_FILE); | |
109 | + check_ifstate_file (user_data); | |
110 | + break; | |
111 | + default: | |
112 | + break; | |
113 | + } | |
114 | +} | |
115 | + | |
116 | #define NM_PERM_DENIED_ERROR "org.freedesktop.NetworkManager.PermissionDenied" | |
117 | #define DEV_PERM_DENIED_ERROR "org.freedesktop.NetworkManager.Device.PermissionDenied" | |
118 | ||
119 | @@ -4506,6 +4580,17 @@ dispose (GObject *object) | |
120 | g_object_unref (priv->fw_monitor); | |
121 | } | |
122 | ||
123 | + if (priv->ifstate_monitor) { | |
124 | + if (priv->ifstate_monitor_id) | |
125 | + g_signal_handler_disconnect (priv->ifstate_monitor, priv->ifstate_monitor_id); | |
126 | + | |
127 | + if (priv->ifstate_force_online) | |
128 | + g_source_remove (priv->ifstate_force_online); | |
129 | + | |
130 | + g_file_monitor_cancel (priv->ifstate_monitor); | |
131 | + g_object_unref (priv->ifstate_monitor); | |
132 | + } | |
133 | + | |
134 | g_slist_free (priv->factories); | |
135 | ||
136 | if (priv->timestamp_update_id) { | |
137 | @@ -4865,6 +4950,23 @@ nm_manager_init (NMManager *manager) | |
138 | KERNEL_FIRMWARE_DIR); | |
139 | } | |
140 | ||
141 | + /* Monitor the ifupdown state file */ | |
142 | + file = g_file_new_for_path (IFUPDOWN_STATE_FILE); | |
143 | + priv->ifstate_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); | |
144 | + g_object_unref (file); | |
145 | + | |
146 | + if (priv->ifstate_monitor) { | |
147 | + priv->ifstate_monitor_id = g_signal_connect (priv->ifstate_monitor, "changed", | |
148 | + G_CALLBACK (ifstate_file_changed), | |
149 | + manager); | |
150 | + nm_log_info (LOGD_CORE, "monitoring ifupdown state file '%s'.", | |
151 | + IFUPDOWN_STATE_FILE); | |
152 | + } else { | |
153 | + nm_log_warn (LOGD_CORE, "failed to monitor ifupdown state file '%s'.", | |
154 | + IFUPDOWN_STATE_FILE); | |
155 | + } | |
156 | + check_ifstate_file (manager); | |
157 | + | |
158 | load_device_factories (manager); | |
159 | ||
160 | /* Update timestamps in active connections */ |
0 | Description: Add D-Bus policy for group netdev | |
1 | It is more or less a copy of the at_console section. | |
2 | Author: Michael Biebl <biebl@debian.org> | |
3 | Index: network-manager/src/org.freedesktop.NetworkManager.conf | |
4 | =================================================================== | |
5 | --- network-manager.orig/src/org.freedesktop.NetworkManager.conf 2012-06-29 20:12:59.056208718 +0200 | |
6 | +++ network-manager/src/org.freedesktop.NetworkManager.conf 2012-06-29 20:17:00.479762828 +0200 | |
7 | @@ -85,6 +85,67 @@ | |
8 | send_interface="org.freedesktop.NetworkManager" | |
9 | send_member="wake"/> | |
10 | </policy> | |
11 | + <policy group="netdev"> | |
12 | + <allow send_destination="org.freedesktop.NetworkManager"/> | |
13 | + | |
14 | + <allow send_destination="org.freedesktop.NetworkManager" | |
15 | + send_interface="org.freedesktop.DBus.Introspectable"/> | |
16 | + | |
17 | + <allow send_destination="org.freedesktop.NetworkManager" | |
18 | + send_interface="org.freedesktop.DBus.Properties"/> | |
19 | + | |
20 | + <allow send_destination="org.freedesktop.NetworkManager" | |
21 | + send_interface="org.freedesktop.NetworkManager"/> | |
22 | + | |
23 | + <allow send_destination="org.freedesktop.NetworkManager" | |
24 | + send_interface="org.freedesktop.NetworkManager.AccessPoint"/> | |
25 | + | |
26 | + <allow send_destination="org.freedesktop.NetworkManager" | |
27 | + send_interface="org.freedesktop.NetworkManager.Connection.Active"/> | |
28 | + | |
29 | + <allow send_destination="org.freedesktop.NetworkManager" | |
30 | + send_interface="org.freedesktop.NetworkManager.Device.Modem"/> | |
31 | + | |
32 | + <allow send_destination="org.freedesktop.NetworkManager" | |
33 | + send_interface="org.freedesktop.NetworkManager.Device.Wired"/> | |
34 | + | |
35 | + <allow send_destination="org.freedesktop.NetworkManager" | |
36 | + send_interface="org.freedesktop.NetworkManager.Device.Serial"/> | |
37 | + | |
38 | + <allow send_destination="org.freedesktop.NetworkManager" | |
39 | + send_interface="org.freedesktop.NetworkManager.Device.Wireless"/> | |
40 | + | |
41 | + <allow send_destination="org.freedesktop.NetworkManager" | |
42 | + send_interface="org.freedesktop.NetworkManager.Device"/> | |
43 | + | |
44 | + <allow send_destination="org.freedesktop.NetworkManager" | |
45 | + send_interface="org.freedesktop.NetworkManager.DHCP4Config"/> | |
46 | + | |
47 | + <allow send_destination="org.freedesktop.NetworkManager" | |
48 | + send_interface="org.freedesktop.NetworkManager.IP4Config"/> | |
49 | + | |
50 | + <allow send_destination="org.freedesktop.NetworkManager" | |
51 | + send_interface="org.freedesktop.NetworkManager.VPN.Connection"/> | |
52 | + | |
53 | + <allow send_destination="org.freedesktop.NetworkManager" | |
54 | + send_interface="org.freedesktop.NetworkManager.AgentManager"/> | |
55 | + | |
56 | + <deny send_destination="org.freedesktop.NetworkManager" | |
57 | + send_interface="org.freedesktop.NetworkManager" | |
58 | + send_member="SetLogging"/> | |
59 | + | |
60 | + <deny send_destination="org.freedesktop.NetworkManager" | |
61 | + send_interface="org.freedesktop.NetworkManager" | |
62 | + send_member="Sleep"/> | |
63 | + | |
64 | + <deny send_destination="org.freedesktop.NetworkManager" | |
65 | + send_interface="org.freedesktop.NetworkManager" | |
66 | + send_member="sleep"/> | |
67 | + | |
68 | + <deny send_destination="org.freedesktop.NetworkManager" | |
69 | + send_interface="org.freedesktop.NetworkManager" | |
70 | + send_member="wake"/> | |
71 | + </policy> | |
72 | <policy context="default"> | |
73 | <deny own="org.freedesktop.NetworkManager"/> | |
74 |
0 | Description: Debian specific tweaks for NetworkManager systemd service file | |
1 | This patch is needed to avoid a dependency loop which is generated | |
2 | by early boot (rcS) SysV init scripts depending on the $network LSB | |
3 | system facility (either directly or indirectly via $remote_fs). | |
4 | . | |
5 | The $network LSB system facility is mapped to network.target. | |
6 | . | |
7 | Those rcS SysV init scripts are started in sysinit.target, | |
8 | NetworkManager.service is started via multi-user.target, which depends | |
9 | on sysinit.target. | |
10 | . | |
11 | As long as we have rcS SysV init scripts which such a dependency on | |
12 | $remote_fs or $network we can not make NetworkManager.service a provider | |
13 | for network.target. | |
14 | ||
15 | Author: Michael Biebl <biebl@debian.org> | |
16 | --- a/data/NetworkManager.service.in | |
17 | +++ b/data/NetworkManager.service.in | |
18 | @@ -1,7 +1,5 @@ | |
19 | [Unit] | |
20 | Description=Network Manager | |
21 | -Wants=network.target | |
22 | -Before=network.target | |
23 | ||
24 | [Service] | |
25 | Type=dbus |
0 | Description: Force online state with unmanaged devices | |
1 | If we have unmanaged devices in /e/n/i, monitor the ifupdown state file | |
2 | and in case we find active interfaces besides lo, forcefully set the | |
3 | online state to CONNECTED. | |
4 | Author: Michael Biebl <biebl@debian.org> | |
5 | Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512286 | |
6 | --- a/src/nm-manager.c | |
7 | +++ b/src/nm-manager.c | |
8 | @@ -78,6 +78,8 @@ | |
9 | #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" | |
10 | #define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" | |
11 | ||
12 | +#define IFUPDOWN_STATE_FILE "/run/network/ifstate" | |
13 | + | |
14 | static gboolean impl_manager_get_devices (NMManager *manager, | |
15 | GPtrArray **devices, | |
16 | GError **err); | |
17 | @@ -249,6 +251,11 @@ | |
18 | guint fw_monitor_id; | |
19 | guint fw_changed_id; | |
20 | ||
21 | + /* ifupdown state file monitor */ | |
22 | + GFileMonitor *ifstate_monitor; | |
23 | + guint ifstate_monitor_id; | |
24 | + gboolean ifstate_force_online; | |
25 | + | |
26 | guint timestamp_update_id; | |
27 | ||
28 | GHashTable *nm_bridges; | |
29 | @@ -618,6 +625,14 @@ | |
30 | } | |
31 | } | |
32 | ||
33 | + if (state == NM_DEVICE_STATE_UNMANAGED) { | |
34 | + const char *iface = nm_device_get_ip_iface (dev); | |
35 | + if (priv->ifstate_force_online) { | |
36 | + new_state = NM_STATE_CONNECTED; | |
37 | + nm_log_dbg (LOGD_CORE, "Unmanaged device found: %s; state CONNECTED forced.", iface); | |
38 | + } | |
39 | + } | |
40 | + | |
41 | if (nm_device_is_activating (dev)) | |
42 | new_state = NM_STATE_CONNECTING; | |
43 | else if (new_state != NM_STATE_CONNECTING) { | |
44 | @@ -4090,6 +4105,65 @@ | |
45 | } | |
46 | } | |
47 | ||
48 | +static void | |
49 | +check_ifstate_file (gpointer user_data) | |
50 | +{ | |
51 | + NMManager *self = NM_MANAGER (user_data); | |
52 | + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
53 | + GIOChannel *channel; | |
54 | + gchar *line; | |
55 | + gboolean online = FALSE; | |
56 | + | |
57 | + channel = g_io_channel_new_file (IFUPDOWN_STATE_FILE, "r", NULL); | |
58 | + if (!channel) { | |
59 | + nm_log_warn (LOGD_CORE, "Error: failed to open %s", IFUPDOWN_STATE_FILE); | |
60 | + return; | |
61 | + } | |
62 | + | |
63 | + while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL) | |
64 | + != G_IO_STATUS_EOF && !online) { | |
65 | + g_strstrip (line); | |
66 | + if (strlen (line) > 0 && g_strcmp0 (line, "lo=lo") != 0) { | |
67 | + online = TRUE; | |
68 | + } | |
69 | + g_free (line); | |
70 | + } | |
71 | + | |
72 | + g_io_channel_shutdown (channel, FALSE, NULL); | |
73 | + g_io_channel_unref (channel); | |
74 | + | |
75 | + if (priv->ifstate_force_online != online) { | |
76 | + priv->ifstate_force_online = online; | |
77 | + nm_manager_update_state (self); | |
78 | + } | |
79 | +} | |
80 | + | |
81 | +static void | |
82 | +ifstate_file_changed (GFileMonitor *monitor, | |
83 | + GFile *file, | |
84 | + GFile *other_file, | |
85 | + GFileMonitorEvent event_type, | |
86 | + gpointer user_data) | |
87 | +{ | |
88 | + NMManager *self = NM_MANAGER (user_data); | |
89 | + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
90 | + | |
91 | + switch (event_type) { | |
92 | +// case G_FILE_MONITOR_EVENT_CREATED: | |
93 | +//#if GLIB_CHECK_VERSION(2,23,4) | |
94 | +// case G_FILE_MONITOR_EVENT_MOVED: | |
95 | +//#endif | |
96 | +// case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: | |
97 | + case G_FILE_MONITOR_EVENT_CHANGED: | |
98 | + case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: | |
99 | + nm_log_dbg (LOGD_CORE, "ifupdown state file %s was changed", IFUPDOWN_STATE_FILE); | |
100 | + check_ifstate_file (user_data); | |
101 | + break; | |
102 | + default: | |
103 | + break; | |
104 | + } | |
105 | +} | |
106 | + | |
107 | #define NM_PERM_DENIED_ERROR "org.freedesktop.NetworkManager.PermissionDenied" | |
108 | #define DEV_PERM_DENIED_ERROR "org.freedesktop.NetworkManager.Device.PermissionDenied" | |
109 | ||
110 | @@ -4506,6 +4580,17 @@ | |
111 | g_object_unref (priv->fw_monitor); | |
112 | } | |
113 | ||
114 | + if (priv->ifstate_monitor) { | |
115 | + if (priv->ifstate_monitor_id) | |
116 | + g_signal_handler_disconnect (priv->ifstate_monitor, priv->ifstate_monitor_id); | |
117 | + | |
118 | + if (priv->ifstate_force_online) | |
119 | + g_source_remove (priv->ifstate_force_online); | |
120 | + | |
121 | + g_file_monitor_cancel (priv->ifstate_monitor); | |
122 | + g_object_unref (priv->ifstate_monitor); | |
123 | + } | |
124 | + | |
125 | g_slist_free (priv->factories); | |
126 | ||
127 | if (priv->timestamp_update_id) { | |
128 | @@ -4865,6 +4950,23 @@ | |
129 | KERNEL_FIRMWARE_DIR); | |
130 | } | |
131 | ||
132 | + /* Monitor the ifupdown state file */ | |
133 | + file = g_file_new_for_path (IFUPDOWN_STATE_FILE); | |
134 | + priv->ifstate_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); | |
135 | + g_object_unref (file); | |
136 | + | |
137 | + if (priv->ifstate_monitor) { | |
138 | + priv->ifstate_monitor_id = g_signal_connect (priv->ifstate_monitor, "changed", | |
139 | + G_CALLBACK (ifstate_file_changed), | |
140 | + manager); | |
141 | + nm_log_info (LOGD_CORE, "monitoring ifupdown state file '%s'.", | |
142 | + IFUPDOWN_STATE_FILE); | |
143 | + } else { | |
144 | + nm_log_warn (LOGD_CORE, "failed to monitor ifupdown state file '%s'.", | |
145 | + IFUPDOWN_STATE_FILE); | |
146 | + } | |
147 | + check_ifstate_file (manager); | |
148 | + | |
149 | load_device_factories (manager); | |
150 | ||
151 | /* Update timestamps in active connections */ |