diff options
| author | Michael Biebl <biebl@debian.org> | 2010-02-19 20:46:27 +0000 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2010-02-19 20:46:27 +0000 |
| commit | fa06dda22dd91e4b4763292666e8456435bb4e8c (patch) | |
| tree | f6d28f2442d52f1675934b79056db97d17f0bf18 | |
| parent | 7628406ee8021a01b3a513ab60ab2912a4a9ef12 (diff) | |
* Remove patches, all merged upstream
- debian/patches/04-etc-hosts-rewrite.patch - debian/patches/05-ifupdown-allow-hotplug-autoconnect.patch - debian/patches/03-hostname-fallback.patch git-svn-id: svn+ssh://svn.debian.org/svn/pkg-utopia/packages/unstable/networkmanager@3520 ceb527fc-18e6-0310-9fe2-813c157c29e7
| -rw-r--r-- | debian/changelog | 4 | ||||
| -rw-r--r-- | debian/patches/03-hostname-fallback.patch | 207 | ||||
| -rw-r--r-- | debian/patches/04-etc-hosts-rewrite.patch | 172 | ||||
| -rw-r--r-- | debian/patches/05-ifupdown-allow-hotplug-autoconnect.patch | 13 | ||||
| -rw-r--r-- | debian/patches/series | 3 |
5 files changed, 4 insertions, 395 deletions
diff --git a/debian/changelog b/debian/changelog index 1dc4fc9d..782bf775 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ network-manager (0.8-1) UNRELEASED; urgency=low * New upstream release. + * Remove patches, all merged upstream + - debian/patches/04-etc-hosts-rewrite.patch + - debian/patches/05-ifupdown-allow-hotplug-autoconnect.patch + - debian/patches/03-hostname-fallback.patch -- Michael Biebl <biebl@debian.org> Fri, 19 Feb 2010 21:41:06 +0100 diff --git a/debian/patches/03-hostname-fallback.patch b/debian/patches/03-hostname-fallback.patch deleted file mode 100644 index 40136ba5..00000000 --- a/debian/patches/03-hostname-fallback.patch +++ /dev/null @@ -1,207 +0,0 @@ -commit 395a0abd2f8a3a65b2e4a0664ccf48078d07346f -Author: Dan Williams <dcbw@redhat.com> -Date: Wed Jan 27 17:13:35 2010 -0800 - - policy: fall back to original hostname before trying reverse DNS - - Having the original hostname checks in the settings-service code - didn't allow the policy enough granularity to differentiate between - a plugin-provided hostname and the original hostname. We want to - fall back to the original hostname if there isn't a persistent - hostname (from a plugin) and if there isn't a DHCP-provided - hostname. Moving the original hostname checks to the policy - makes that possible. Clarify the precedence order at the same - time, and minimally validate the DHCP hostname as well. - - trivial: clearer hostname fallback message - -diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c -index 5c5ae40..7034520 100644 ---- a/src/NetworkManagerPolicy.c -+++ b/src/NetworkManagerPolicy.c -@@ -74,6 +74,8 @@ struct NMPolicy { - NMDevice *default_device; - - LookupThread *lookup; -+ -+ char *orig_hostname; /* hostname at NM start time */ - }; - - static gboolean -@@ -416,15 +418,16 @@ update_system_hostname (NMPolicy *policy, NMDevice *best) - policy->lookup = NULL; - } - -- /* A configured hostname (via the system-settings service) overrides -- * all automatic hostname determination. If there is no configured hostname, -- * the best device's automatically determined hostname (from DHCP, VPN, PPP, -- * etc) is used. If there is no automatically determined hostname, reverse -- * DNS lookup using the best device's IP address is started to determined the -- * the hostname. -+ /* Hostname precedence order: -+ * -+ * 1) a configured hostname (from system-settings) -+ * 2) automatic hostname from the default device's config (DHCP, VPN, etc) -+ * 3) the original hostname when NM started -+ * 4) reverse-DNS of the best device's IPv4 address -+ * - */ - -- /* Try a configured hostname first */ -+ /* Try a persistent hostname first */ - g_object_get (G_OBJECT (policy->manager), NM_MANAGER_HOSTNAME, &configured_hostname, NULL); - if (configured_hostname) { - set_system_hostname (configured_hostname, "from system configuration"); -@@ -437,25 +440,42 @@ update_system_hostname (NMPolicy *policy, NMDevice *best) - best = get_best_device (policy->manager, &best_req); - - if (!best) { -- /* No best device; fall back to localhost.localdomain */ -- set_system_hostname (NULL, "no default device"); -+ /* No best device; fall back to original hostname or if there wasn't -+ * one, 'localhost.localdomain' -+ */ -+ set_system_hostname (policy->orig_hostname, "no default device"); - return; - } - - /* Grab a hostname out of the device's DHCP4 config */ - dhcp4_config = nm_device_get_dhcp4_config (best); - if (dhcp4_config) { -- const char *dhcp4_hostname; -+ const char *dhcp4_hostname, *p; - -- dhcp4_hostname = nm_dhcp4_config_get_option (dhcp4_config, "host_name"); -+ p = dhcp4_hostname = nm_dhcp4_config_get_option (dhcp4_config, "host_name"); - if (dhcp4_hostname && strlen (dhcp4_hostname)) { -- set_system_hostname (dhcp4_hostname, "from DHCP"); -- return; -+ /* Sanity check */ -+ while (*p) { -+ if (!isblank (*p++)) { -+ set_system_hostname (dhcp4_hostname, "from DHCP"); -+ return; -+ } -+ } -+ nm_warning ("%s: DHCP-provided hostname '%s' looks invalid; ignoring it", -+ __func__, dhcp4_hostname); - } - } - -- /* No configured hostname, no automatically determined hostname either. Start -- * reverse DNS of the current IP address to try and find it. -+ /* If no automatically-configured hostname, try using the hostname from -+ * when NM started up. -+ */ -+ if (policy->orig_hostname) { -+ set_system_hostname (policy->orig_hostname, "from system startup"); -+ return; -+ } -+ -+ /* No configured hostname, no automatically determined hostname, and -+ * no bootup hostname. Start reverse DNS of the current IP address. - */ - ip4_config = nm_device_get_ip4_config (best); - if ( !ip4_config -@@ -988,6 +1008,7 @@ nm_policy_new (NMManager *manager, NMVPNManager *vpn_manager) - NMPolicy *policy; - static gboolean initialized = FALSE; - gulong id; -+ char hostname[HOST_NAME_MAX + 2]; - - g_return_val_if_fail (NM_IS_MANAGER (manager), NULL); - g_return_val_if_fail (initialized == FALSE, NULL); -@@ -996,6 +1017,14 @@ nm_policy_new (NMManager *manager, NMVPNManager *vpn_manager) - policy->manager = g_object_ref (manager); - policy->update_state_id = 0; - -+ /* Grab hostname on startup and use that if nothing provides one */ -+ memset (hostname, 0, sizeof (hostname)); -+ if (gethostname (&hostname[0], HOST_NAME_MAX) == 0) { -+ /* only cache it if it's a valid hostname */ -+ if (strlen (hostname) && strcmp (hostname, "localhost") && strcmp (hostname, "localhost.localdomain")) -+ policy->orig_hostname = g_strdup (hostname); -+ } -+ - policy->vpn_manager = g_object_ref (vpn_manager); - id = g_signal_connect (policy->vpn_manager, "connection-activated", - G_CALLBACK (vpn_connection_activated), policy); -@@ -1086,6 +1115,8 @@ nm_policy_destroy (NMPolicy *policy) - } - g_slist_free (policy->dev_signal_ids); - -+ g_free (policy->orig_hostname); -+ - g_object_unref (policy->manager); - g_free (policy); - } -diff --git a/src/system-settings/nm-sysconfig-settings.c b/src/system-settings/nm-sysconfig-settings.c -index 7580319..0498fe7 100644 ---- a/src/system-settings/nm-sysconfig-settings.c -+++ b/src/system-settings/nm-sysconfig-settings.c -@@ -90,7 +90,6 @@ typedef struct { - gboolean connections_loaded; - GHashTable *connections; - GSList *unmanaged_specs; -- char *orig_hostname; - } NMSysconfigSettingsPrivate; - - static void settings_system_interface_init (NMSettingsSystemInterface *klass); -@@ -254,7 +253,6 @@ nm_sysconfig_settings_get_hostname (NMSysconfigSettings *self) - NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self); - GSList *iter; - char *hostname = NULL; -- gboolean have_hostname_providers = FALSE; - - /* Hostname returned is the hostname returned from the first plugin - * that provides one. -@@ -264,8 +262,6 @@ nm_sysconfig_settings_get_hostname (NMSysconfigSettings *self) - - g_object_get (G_OBJECT (iter->data), NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES, &caps, NULL); - if (caps & NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_HOSTNAME) { -- have_hostname_providers = TRUE; -- - g_object_get (G_OBJECT (iter->data), NM_SYSTEM_CONFIG_INTERFACE_HOSTNAME, &hostname, NULL); - if (hostname && strlen (hostname)) - return hostname; -@@ -273,10 +269,6 @@ nm_sysconfig_settings_get_hostname (NMSysconfigSettings *self) - } - } - -- /* If no plugin provided a hostname, try the original hostname of the machine */ -- if (!have_hostname_providers && priv->orig_hostname) -- hostname = g_strdup (priv->orig_hostname); -- - return hostname; - } - -@@ -1378,7 +1370,6 @@ finalize (GObject *object) - g_slist_foreach (priv->plugins, (GFunc) g_object_unref, NULL); - g_slist_free (priv->plugins); - -- g_free (priv->orig_hostname); - g_free (priv->config_file); - - G_OBJECT_CLASS (nm_sysconfig_settings_parent_class)->finalize (object); -@@ -1476,7 +1467,6 @@ static void - nm_sysconfig_settings_init (NMSysconfigSettings *self) - { - NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self); -- char hostname[HOST_NAME_MAX + 2]; - - priv->connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); - -@@ -1488,13 +1478,5 @@ nm_sysconfig_settings_init (NMSysconfigSettings *self) - self); - } else - g_warning ("%s: failed to create PolicyKit authority.", __func__); -- -- /* Grab hostname on startup and use that if no plugins provide one */ -- memset (hostname, 0, sizeof (hostname)); -- if (gethostname (&hostname[0], HOST_NAME_MAX) == 0) { -- /* only cache it if it's a valid hostname */ -- if (strlen (hostname) && strcmp (hostname, "localhost") && strcmp (hostname, "localhost.localdomain")) -- priv->orig_hostname = g_strdup (hostname); -- } - } - diff --git a/debian/patches/04-etc-hosts-rewrite.patch b/debian/patches/04-etc-hosts-rewrite.patch deleted file mode 100644 index 3e640f69..00000000 --- a/debian/patches/04-etc-hosts-rewrite.patch +++ /dev/null @@ -1,172 +0,0 @@ -commit f6c383ff14412ea264fa8740dec84f92a89bd385 -Author: Dan Williams <dcbw@redhat.com> -Date: Mon Feb 1 17:29:58 2010 -0800 - - policy: be more selective when adding hostname to /etc/hosts (debian #567411) - - If the user has already mapped the hostname to some other address, - assume the user knows what they are doing (since they probably do) - and leave that mapping alone, and create a minimal 127.0.0.1 entry. - If there was no hostname mapping, add it to the 127.0.0.1 entry - like NM did before. - -diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c -index 7034520..1b7801c 100644 ---- a/src/NetworkManagerPolicy.c -+++ b/src/NetworkManagerPolicy.c -@@ -252,13 +252,84 @@ get_best_device (NMManager *manager, NMActRequest **out_req) - return best; - } - -+static gboolean -+is_localhost_mapping (const char *str) -+{ -+ return (!strncmp (str, "127.0.0.1", strlen ("127.0.0.1")) && strstr (str, "localhost")); -+} -+ -+static gboolean -+find_token (const char *line, const char *token) -+{ -+ const char *start = line, *p = line; -+ -+ g_return_val_if_fail (line != NULL, FALSE); -+ g_return_val_if_fail (token != NULL, FALSE); -+ g_return_val_if_fail (strlen (token) > 0, FALSE); -+ -+ /* Walk through the line to find the next whitespace character */ -+ while (p <= line + strlen (line)) { -+ if (isblank (*p) || (*p == '\0')) { -+ /* Token starts with 'start' and ends with 'end' */ -+ if ((p > start) && *start && !strncmp (start, token, (p - start))) -+ return TRUE; /* found */ -+ -+ /* not found; advance start and continue looking */ -+ start = p + 1; -+ } -+ p++; -+ } -+ -+ return FALSE; -+} -+ -+#if 0 -+/* Testcase for find_token; break it out and add it to the testsuite */ -+ -+typedef struct { -+ const char *line; -+ const char *token; -+ gboolean expected; -+} Foo; -+ -+static Foo foo[] = { -+ { "127.0.0.1\tfoobar\tblah", "blah", TRUE }, -+ { "", "blah", FALSE }, -+ { "1.1.1.1\tbork\tfoo", "blah", FALSE }, -+ { "127.0.0.1 foobar\tblah", "blah", TRUE }, -+ { "127.0.0.1 foobar blah", "blah", TRUE }, -+ { "192.168.1.1 blah borkbork", "blah", TRUE }, -+ { "192.168.1.1 foobar\tblah borkbork", "blah", TRUE }, -+ { "192.168.1.1\tfoobar\tblah\tborkbork", "blah", TRUE }, -+ { "192.168.1.1 \tfoobar \tblah \tborkbork\t ", "blah", TRUE }, -+ { "\t\t\t\t \t\t\tasdfadf a\t\t\t\t\t \t\t\t\t\t ", "blah", FALSE }, -+ { NULL, NULL, FALSE } -+}; -+ -+int main(int argc, char **argv) -+{ -+ Foo *iter = &foo[0]; -+ -+ while (iter->line) { -+ if (find_token (iter->line, iter->token) != iter->expected) { -+ g_message ("Failed: '%s' <= '%s' (%d)", iter->line, iter->token, iter->expected); -+ return 1; -+ } -+ iter++; -+ } -+ -+ g_message ("Success"); -+ return 0; -+} -+#endif -+ - #define FALLBACK_HOSTNAME "localhost.localdomain" - - static gboolean - update_etc_hosts (const char *hostname) - { - char *contents = NULL; -- char **lines = NULL, **line; -+ char **lines = NULL, **line, **host_mapping = NULL; - GError *error = NULL; - gboolean initial_comments = TRUE; - gboolean added = FALSE; -@@ -285,25 +356,62 @@ update_etc_hosts (const char *hostname) - return FALSE; - } - -- /* Replace any 127.0.0.1 entry that is at the beginning of the file or right -- * after initial comments. If there is no 127.0.0.1 entry at the beginning -- * or after initial comments, add one there and ignore any other 127.0.0.1 -- * entries. -+ /* Two-pass modification of /etc/hosts: -+ * -+ * 1) Look for a non-comment, non-localhost line that contains the current -+ * hostname. Mark that line. -+ * -+ * 2) For each line in the existing /etc/hosts, add it to the new /etc/hosts -+ * unless it starts with 127.0.0.1 and is right after the initial comments -+ * (if any) and contains "localhost". - */ -+ -+ /* Find any existing hostname mapping */ - for (line = lines; lines && *line; line++) { -+ /* Look for any line that (a) contains the current hostname, and -+ * (b) does not start with '127.0.0.1' and contain 'localhost'. -+ */ -+ if ( strlen (*line) -+ && (*line[0] != '#') -+ && find_token (*line, hostname) -+ && !is_localhost_mapping (*line)) { -+ host_mapping = line; -+ break; -+ } -+ } -+ -+ /* Construct the new hosts file; replace any 127.0.0.1 entry that is at the -+ * beginning of the file or right after initial comments and contains -+ * the string 'localhost'. If there is no 127.0.0.1 entry at the beginning -+ * or after initial comments that contains 'localhost', add one there -+ * and ignore any other 127.0.0.1 entries that contain 'localhost'. -+ */ -+ for (line = lines, initial_comments = TRUE; lines && *line; line++) { - gboolean add_line = TRUE; - - /* This is the first line after the initial comments */ -- if (initial_comments && (*line[0] != '#')) { -+ if (strlen (*line) && initial_comments && (*line[0] != '#')) { - initial_comments = FALSE; -- g_string_append_printf (new_contents, "127.0.0.1\t%s", hostname); -+ -+ /* If some other line contained the hostname, make a simple -+ * localhost mapping and assume the user knows what they are doing -+ * with their manual hostname entry. Otherwise if the hostname -+ * wasn't found somewhere else, add it to the localhost mapping line -+ * to make sure it's mapped to something. -+ */ -+ if (host_mapping) -+ g_string_append (new_contents, "127.0.0.1"); -+ else -+ g_string_append_printf (new_contents, "127.0.0.1\t%s", hostname); -+ - if (strcmp (hostname, FALLBACK_HOSTNAME)) - g_string_append_printf (new_contents, "\t" FALLBACK_HOSTNAME); -+ - g_string_append (new_contents, "\tlocalhost\n"); - added = TRUE; - - /* Don't add the entry if it's supposed to be the actual localhost reverse mapping */ -- if (!strncmp (*line, "127.0.0.1", strlen ("127.0.0.1")) && strstr (*line, "localhost")) -+ if (is_localhost_mapping (*line)) - add_line = FALSE; - } - diff --git a/debian/patches/05-ifupdown-allow-hotplug-autoconnect.patch b/debian/patches/05-ifupdown-allow-hotplug-autoconnect.patch deleted file mode 100644 index d27dfe35..00000000 --- a/debian/patches/05-ifupdown-allow-hotplug-autoconnect.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: NetworkManager-0.7.999/system-settings/plugins/ifupdown/plugin.c -=================================================================== ---- NetworkManager-0.7.999.orig/system-settings/plugins/ifupdown/plugin.c 2010-02-08 16:07:48.379559508 +0100 -+++ NetworkManager-0.7.999/system-settings/plugins/ifupdown/plugin.c 2010-02-08 16:08:04.255557965 +0100 -@@ -355,7 +355,7 @@ - ifparser_init (); - block = ifparser_getfirst (); - while (block) { -- if(!strcmp ("auto", block->type)) -+ if(!strcmp ("auto", block->type) || !strcmp ("allow-hotplug", block->type)) - g_hash_table_insert (auto_ifaces, block->name, GUINT_TO_POINTER (1)); - else if (!strcmp ("iface", block->type) && strcmp ("lo", block->name)) { - NMIfupdownConnection *exported; diff --git a/debian/patches/series b/debian/patches/series index f1e83cf1..5bb8c3f1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,4 +1 @@ 02-dbus_access_network_manager.patch -03-hostname-fallback.patch -04-etc-hosts-rewrite.patch -05-ifupdown-allow-hotplug-autoconnect.patch |