From 6d5a07a76bc1d531851c5adf25fbe38885bc855f Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Wed, 2 Apr 2014 21:53:40 +0200 Subject: Make patches gbp-pq compatible --- .../0001-Add-D-Bus-policy-for-group-netdev.patch | 81 +++++++++++ ...ific-tweaks-for-NetworkManager-systemd-se.patch | 33 +++++ ...Force-online-state-with-unmanaged-devices.patch | 161 +++++++++++++++++++++ .../patches/02-dbus_access_network_manager.patch | 75 ---------- debian/patches/03-systemd.patch | 26 ---- .../05-force-online-with-unmanaged-devices.patch | 152 ------------------- debian/patches/series | 6 +- 7 files changed, 278 insertions(+), 256 deletions(-) create mode 100644 debian/patches/0001-Add-D-Bus-policy-for-group-netdev.patch create mode 100644 debian/patches/0002-Debian-specific-tweaks-for-NetworkManager-systemd-se.patch create mode 100644 debian/patches/0003-Force-online-state-with-unmanaged-devices.patch delete mode 100644 debian/patches/02-dbus_access_network_manager.patch delete mode 100644 debian/patches/03-systemd.patch delete mode 100644 debian/patches/05-force-online-with-unmanaged-devices.patch (limited to 'debian') diff --git a/debian/patches/0001-Add-D-Bus-policy-for-group-netdev.patch b/debian/patches/0001-Add-D-Bus-policy-for-group-netdev.patch new file mode 100644 index 00000000..a1aea3e0 --- /dev/null +++ b/debian/patches/0001-Add-D-Bus-policy-for-group-netdev.patch @@ -0,0 +1,81 @@ +From: Michael Biebl +Date: Wed, 2 Apr 2014 03:15:53 +0200 +Subject: Add D-Bus policy for group netdev + +This is more or less a verbatim copy of the at_console section. +--- + src/org.freedesktop.NetworkManager.conf | 61 +++++++++++++++++++++++++++++++++ + 1 file changed, 61 insertions(+) + +diff --git a/src/org.freedesktop.NetworkManager.conf b/src/org.freedesktop.NetworkManager.conf +index 5e7bafa..e5378d7 100644 +--- a/src/org.freedesktop.NetworkManager.conf ++++ b/src/org.freedesktop.NetworkManager.conf +@@ -86,6 +86,67 @@ + send_interface="org.freedesktop.NetworkManager" + send_member="wake"/> + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + diff --git a/debian/patches/0002-Debian-specific-tweaks-for-NetworkManager-systemd-se.patch b/debian/patches/0002-Debian-specific-tweaks-for-NetworkManager-systemd-se.patch new file mode 100644 index 00000000..c6fedf14 --- /dev/null +++ b/debian/patches/0002-Debian-specific-tweaks-for-NetworkManager-systemd-se.patch @@ -0,0 +1,33 @@ +From: Michael Biebl +Date: Wed, 2 Apr 2014 03:15:53 +0200 +Subject: Debian specific tweaks for NetworkManager systemd service file + +This patch is needed to avoid a dependency loop which is generated +by early boot (rcS) SysV init scripts depending on the $network LSB +system facility (either directly or indirectly via $remote_fs). + +The $network LSB system facility is mapped to network.target. + +Those rcS SysV init scripts are started in sysinit.target, +NetworkManager.service is started via multi-user.target, which depends +on sysinit.target. + +As long as we have rcS SysV init scripts which such a dependency on +$remote_fs or $network we can not make NetworkManager.service a provider +for network.target. +--- + data/NetworkManager.service.in | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/data/NetworkManager.service.in b/data/NetworkManager.service.in +index ddc1627..526a56e 100644 +--- a/data/NetworkManager.service.in ++++ b/data/NetworkManager.service.in +@@ -1,7 +1,5 @@ + [Unit] + Description=Network Manager +-Wants=network.target +-Before=network.target + + [Service] + Type=dbus diff --git a/debian/patches/0003-Force-online-state-with-unmanaged-devices.patch b/debian/patches/0003-Force-online-state-with-unmanaged-devices.patch new file mode 100644 index 00000000..0e4f91db --- /dev/null +++ b/debian/patches/0003-Force-online-state-with-unmanaged-devices.patch @@ -0,0 +1,161 @@ +From: Michael Biebl +Date: Wed, 2 Apr 2014 03:15:53 +0200 +Subject: Force online state with unmanaged devices + +If we have unmanaged devices in /e/n/i, monitor the ifupdown state file +and in case we find active interfaces besides lo, forcefully set the +online state to CONNECTED. + +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512286 +--- + src/nm-manager.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 102 insertions(+) + +diff --git a/src/nm-manager.c b/src/nm-manager.c +index 9c82d14..7dbba47 100644 +--- a/src/nm-manager.c ++++ b/src/nm-manager.c +@@ -78,6 +78,8 @@ + #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" + #define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" + ++#define IFUPDOWN_STATE_FILE "/run/network/ifstate" ++ + static gboolean impl_manager_get_devices (NMManager *manager, + GPtrArray **devices, + GError **err); +@@ -249,6 +251,11 @@ typedef struct { + guint fw_monitor_id; + guint fw_changed_id; + ++ /* ifupdown state file monitor */ ++ GFileMonitor *ifstate_monitor; ++ guint ifstate_monitor_id; ++ gboolean ifstate_force_online; ++ + guint timestamp_update_id; + + GHashTable *nm_bridges; +@@ -618,6 +625,14 @@ nm_manager_update_state (NMManager *manager) + } + } + ++ if (state == NM_DEVICE_STATE_UNMANAGED) { ++ const char *iface = nm_device_get_ip_iface (dev); ++ if (priv->ifstate_force_online) { ++ new_state = NM_STATE_CONNECTED; ++ nm_log_dbg (LOGD_CORE, "Unmanaged device found: %s; state CONNECTED forced.", iface); ++ } ++ } ++ + if (nm_device_is_activating (dev)) + new_state = NM_STATE_CONNECTING; + else if (new_state != NM_STATE_CONNECTING) { +@@ -4090,6 +4105,65 @@ policy_activating_device_changed (GObject *object, GParamSpec *pspec, gpointer u + } + } + ++static void ++check_ifstate_file (gpointer user_data) ++{ ++ NMManager *self = NM_MANAGER (user_data); ++ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); ++ GIOChannel *channel; ++ gchar *line; ++ gboolean online = FALSE; ++ ++ channel = g_io_channel_new_file (IFUPDOWN_STATE_FILE, "r", NULL); ++ if (!channel) { ++ nm_log_warn (LOGD_CORE, "Error: failed to open %s", IFUPDOWN_STATE_FILE); ++ return; ++ } ++ ++ while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL) ++ != G_IO_STATUS_EOF && !online) { ++ g_strstrip (line); ++ if (strlen (line) > 0 && g_strcmp0 (line, "lo=lo") != 0) { ++ online = TRUE; ++ } ++ g_free (line); ++ } ++ ++ g_io_channel_shutdown (channel, FALSE, NULL); ++ g_io_channel_unref (channel); ++ ++ if (priv->ifstate_force_online != online) { ++ priv->ifstate_force_online = online; ++ nm_manager_update_state (self); ++ } ++} ++ ++static void ++ifstate_file_changed (GFileMonitor *monitor, ++ GFile *file, ++ GFile *other_file, ++ GFileMonitorEvent event_type, ++ gpointer user_data) ++{ ++ NMManager *self = NM_MANAGER (user_data); ++ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); ++ ++ switch (event_type) { ++// case G_FILE_MONITOR_EVENT_CREATED: ++//#if GLIB_CHECK_VERSION(2,23,4) ++// case G_FILE_MONITOR_EVENT_MOVED: ++//#endif ++// case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: ++ case G_FILE_MONITOR_EVENT_CHANGED: ++ case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: ++ nm_log_dbg (LOGD_CORE, "ifupdown state file %s was changed", IFUPDOWN_STATE_FILE); ++ check_ifstate_file (user_data); ++ break; ++ default: ++ break; ++ } ++} ++ + #define NM_PERM_DENIED_ERROR "org.freedesktop.NetworkManager.PermissionDenied" + #define DEV_PERM_DENIED_ERROR "org.freedesktop.NetworkManager.Device.PermissionDenied" + +@@ -4506,6 +4580,17 @@ dispose (GObject *object) + g_object_unref (priv->fw_monitor); + } + ++ if (priv->ifstate_monitor) { ++ if (priv->ifstate_monitor_id) ++ g_signal_handler_disconnect (priv->ifstate_monitor, priv->ifstate_monitor_id); ++ ++ if (priv->ifstate_force_online) ++ g_source_remove (priv->ifstate_force_online); ++ ++ g_file_monitor_cancel (priv->ifstate_monitor); ++ g_object_unref (priv->ifstate_monitor); ++ } ++ + g_slist_free (priv->factories); + + if (priv->timestamp_update_id) { +@@ -4865,6 +4950,23 @@ nm_manager_init (NMManager *manager) + KERNEL_FIRMWARE_DIR); + } + ++ /* Monitor the ifupdown state file */ ++ file = g_file_new_for_path (IFUPDOWN_STATE_FILE); ++ priv->ifstate_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); ++ g_object_unref (file); ++ ++ if (priv->ifstate_monitor) { ++ priv->ifstate_monitor_id = g_signal_connect (priv->ifstate_monitor, "changed", ++ G_CALLBACK (ifstate_file_changed), ++ manager); ++ nm_log_info (LOGD_CORE, "monitoring ifupdown state file '%s'.", ++ IFUPDOWN_STATE_FILE); ++ } else { ++ nm_log_warn (LOGD_CORE, "failed to monitor ifupdown state file '%s'.", ++ IFUPDOWN_STATE_FILE); ++ } ++ check_ifstate_file (manager); ++ + load_device_factories (manager); + + /* Update timestamps in active connections */ diff --git a/debian/patches/02-dbus_access_network_manager.patch b/debian/patches/02-dbus_access_network_manager.patch deleted file mode 100644 index 0105b16f..00000000 --- a/debian/patches/02-dbus_access_network_manager.patch +++ /dev/null @@ -1,75 +0,0 @@ -Description: Add D-Bus policy for group netdev - It is more or less a copy of the at_console section. -Author: Michael Biebl -Index: network-manager/src/org.freedesktop.NetworkManager.conf -=================================================================== ---- network-manager.orig/src/org.freedesktop.NetworkManager.conf 2012-06-29 20:12:59.056208718 +0200 -+++ network-manager/src/org.freedesktop.NetworkManager.conf 2012-06-29 20:17:00.479762828 +0200 -@@ -85,6 +85,67 @@ - send_interface="org.freedesktop.NetworkManager" - send_member="wake"/> - -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - diff --git a/debian/patches/03-systemd.patch b/debian/patches/03-systemd.patch deleted file mode 100644 index cb3c9d6f..00000000 --- a/debian/patches/03-systemd.patch +++ /dev/null @@ -1,26 +0,0 @@ -Description: Debian specific tweaks for NetworkManager systemd service file - This patch is needed to avoid a dependency loop which is generated - by early boot (rcS) SysV init scripts depending on the $network LSB - system facility (either directly or indirectly via $remote_fs). - . - The $network LSB system facility is mapped to network.target. - . - Those rcS SysV init scripts are started in sysinit.target, - NetworkManager.service is started via multi-user.target, which depends - on sysinit.target. - . - As long as we have rcS SysV init scripts which such a dependency on - $remote_fs or $network we can not make NetworkManager.service a provider - for network.target. - -Author: Michael Biebl ---- a/data/NetworkManager.service.in -+++ b/data/NetworkManager.service.in -@@ -1,7 +1,5 @@ - [Unit] - Description=Network Manager --Wants=network.target --Before=network.target - - [Service] - Type=dbus diff --git a/debian/patches/05-force-online-with-unmanaged-devices.patch b/debian/patches/05-force-online-with-unmanaged-devices.patch deleted file mode 100644 index 31d5cadb..00000000 --- a/debian/patches/05-force-online-with-unmanaged-devices.patch +++ /dev/null @@ -1,152 +0,0 @@ -Description: Force online state with unmanaged devices - If we have unmanaged devices in /e/n/i, monitor the ifupdown state file - and in case we find active interfaces besides lo, forcefully set the - online state to CONNECTED. -Author: Michael Biebl -Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512286 ---- a/src/nm-manager.c -+++ b/src/nm-manager.c -@@ -78,6 +78,8 @@ - #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" - #define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" - -+#define IFUPDOWN_STATE_FILE "/run/network/ifstate" -+ - static gboolean impl_manager_get_devices (NMManager *manager, - GPtrArray **devices, - GError **err); -@@ -249,6 +251,11 @@ - guint fw_monitor_id; - guint fw_changed_id; - -+ /* ifupdown state file monitor */ -+ GFileMonitor *ifstate_monitor; -+ guint ifstate_monitor_id; -+ gboolean ifstate_force_online; -+ - guint timestamp_update_id; - - GHashTable *nm_bridges; -@@ -618,6 +625,14 @@ - } - } - -+ if (state == NM_DEVICE_STATE_UNMANAGED) { -+ const char *iface = nm_device_get_ip_iface (dev); -+ if (priv->ifstate_force_online) { -+ new_state = NM_STATE_CONNECTED; -+ nm_log_dbg (LOGD_CORE, "Unmanaged device found: %s; state CONNECTED forced.", iface); -+ } -+ } -+ - if (nm_device_is_activating (dev)) - new_state = NM_STATE_CONNECTING; - else if (new_state != NM_STATE_CONNECTING) { -@@ -4090,6 +4105,65 @@ - } - } - -+static void -+check_ifstate_file (gpointer user_data) -+{ -+ NMManager *self = NM_MANAGER (user_data); -+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); -+ GIOChannel *channel; -+ gchar *line; -+ gboolean online = FALSE; -+ -+ channel = g_io_channel_new_file (IFUPDOWN_STATE_FILE, "r", NULL); -+ if (!channel) { -+ nm_log_warn (LOGD_CORE, "Error: failed to open %s", IFUPDOWN_STATE_FILE); -+ return; -+ } -+ -+ while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL) -+ != G_IO_STATUS_EOF && !online) { -+ g_strstrip (line); -+ if (strlen (line) > 0 && g_strcmp0 (line, "lo=lo") != 0) { -+ online = TRUE; -+ } -+ g_free (line); -+ } -+ -+ g_io_channel_shutdown (channel, FALSE, NULL); -+ g_io_channel_unref (channel); -+ -+ if (priv->ifstate_force_online != online) { -+ priv->ifstate_force_online = online; -+ nm_manager_update_state (self); -+ } -+} -+ -+static void -+ifstate_file_changed (GFileMonitor *monitor, -+ GFile *file, -+ GFile *other_file, -+ GFileMonitorEvent event_type, -+ gpointer user_data) -+{ -+ NMManager *self = NM_MANAGER (user_data); -+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); -+ -+ switch (event_type) { -+// case G_FILE_MONITOR_EVENT_CREATED: -+//#if GLIB_CHECK_VERSION(2,23,4) -+// case G_FILE_MONITOR_EVENT_MOVED: -+//#endif -+// case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: -+ case G_FILE_MONITOR_EVENT_CHANGED: -+ case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: -+ nm_log_dbg (LOGD_CORE, "ifupdown state file %s was changed", IFUPDOWN_STATE_FILE); -+ check_ifstate_file (user_data); -+ break; -+ default: -+ break; -+ } -+} -+ - #define NM_PERM_DENIED_ERROR "org.freedesktop.NetworkManager.PermissionDenied" - #define DEV_PERM_DENIED_ERROR "org.freedesktop.NetworkManager.Device.PermissionDenied" - -@@ -4506,6 +4580,17 @@ - g_object_unref (priv->fw_monitor); - } - -+ if (priv->ifstate_monitor) { -+ if (priv->ifstate_monitor_id) -+ g_signal_handler_disconnect (priv->ifstate_monitor, priv->ifstate_monitor_id); -+ -+ if (priv->ifstate_force_online) -+ g_source_remove (priv->ifstate_force_online); -+ -+ g_file_monitor_cancel (priv->ifstate_monitor); -+ g_object_unref (priv->ifstate_monitor); -+ } -+ - g_slist_free (priv->factories); - - if (priv->timestamp_update_id) { -@@ -4865,6 +4950,23 @@ - KERNEL_FIRMWARE_DIR); - } - -+ /* Monitor the ifupdown state file */ -+ file = g_file_new_for_path (IFUPDOWN_STATE_FILE); -+ priv->ifstate_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); -+ g_object_unref (file); -+ -+ if (priv->ifstate_monitor) { -+ priv->ifstate_monitor_id = g_signal_connect (priv->ifstate_monitor, "changed", -+ G_CALLBACK (ifstate_file_changed), -+ manager); -+ nm_log_info (LOGD_CORE, "monitoring ifupdown state file '%s'.", -+ IFUPDOWN_STATE_FILE); -+ } else { -+ nm_log_warn (LOGD_CORE, "failed to monitor ifupdown state file '%s'.", -+ IFUPDOWN_STATE_FILE); -+ } -+ check_ifstate_file (manager); -+ - load_device_factories (manager); - - /* Update timestamps in active connections */ diff --git a/debian/patches/series b/debian/patches/series index 1eef0c6e..251dba2a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,3 @@ -02-dbus_access_network_manager.patch -03-systemd.patch -05-force-online-with-unmanaged-devices.patch +0001-Add-D-Bus-policy-for-group-netdev.patch +0002-Debian-specific-tweaks-for-NetworkManager-systemd-se.patch +0003-Force-online-state-with-unmanaged-devices.patch -- cgit 1.3.0-6-gf8a5