about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-03-06 20:57:59 +0100
committerMichael Biebl <biebl@debian.org>2011-03-06 20:57:59 +0100
commit9c7540deb1bd5356a12caa41dd21f898316b9a72 (patch)
tree5329f4188a2a18a3ca36d0f25eb5d562d79de373
parente4568b525190677213f0a3290219145c32a6c146 (diff)
Normalize keys in ifupdown parser.
* debian/patches/51-normalized-keys.patch
  - Normalize keys in ifupdown parser, so we accept options with either
    hyphens or underscores, like e.g. bridge_ports and bridge-ports.
    (Closes: #609831)
-rw-r--r--debian/changelog4
-rw-r--r--debian/patches/51-normalized-keys.patch37
-rw-r--r--debian/patches/series1
3 files changed, 42 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 67abd8a6..12ce618f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,10 @@ network-manager (0.8.2-6) UNRELEASED; urgency=low
   * debian/ifblacklist_migrate.sh
     - Only comment out iface lines if we have an exact match for the network
       interface. (Closes: #612247)
+  * debian/patches/51-normalized-keys.patch
+    - Normalize keys in ifupdown parser, so we accept options with either
+      hyphens or underscores, like e.g. bridge_ports and bridge-ports.
+      (Closes: #609831)
 
  -- Michael Biebl <biebl@debian.org>  Sun, 06 Mar 2011 17:12:47 +0100
 
diff --git a/debian/patches/51-normalized-keys.patch b/debian/patches/51-normalized-keys.patch
new file mode 100644
index 00000000..8411ca8b
--- /dev/null
+++ b/debian/patches/51-normalized-keys.patch
@@ -0,0 +1,37 @@
+Index: network-manager/system-settings/plugins/ifupdown/interface_parser.c
+===================================================================
+--- network-manager.orig/system-settings/plugins/ifupdown/interface_parser.c	2011-03-06 20:49:32.229089569 +0100
++++ network-manager/system-settings/plugins/ifupdown/interface_parser.c	2011-03-06 20:53:09.749089571 +0100
+@@ -51,6 +51,7 @@
+ void add_data(const char *key,const char *data)
+ {
+ 	if_data *ret;
++	char *idx;
+ 
+ 	// Check if there is a block where we can attach our data
+ 	if (first == NULL)
+@@ -58,6 +59,11 @@
+ 
+ 	ret = (if_data*) calloc(1,sizeof(struct _if_data));
+ 	ret->key = g_strdup(key);
++	// Normalize keys. Convert '_' to '-', as ifupdown accepts both variants.
++	// When querying keys via ifparser_getkey(), use '-'.
++	while ((idx = strrchr(ret->key, '_'))) {
++		*idx = '-';
++	}
+ 	ret->data = g_strdup(data);
+ 
+ 	if (last->info == NULL)
+Index: network-manager/system-settings/plugins/ifupdown/plugin.c
+===================================================================
+--- network-manager.orig/system-settings/plugins/ifupdown/plugin.c	2011-03-06 20:49:36.721089570 +0100
++++ network-manager/system-settings/plugins/ifupdown/plugin.c	2011-03-06 20:50:13.493089573 +0100
+@@ -368,7 +368,7 @@
+ 			/* Bridge configuration */
+ 			if(!strncmp ("br", block->name, 2)) {
+ 				/* Try to find bridge ports */
+-				const char *ports = ifparser_getkey (block, "bridge_ports");
++				const char *ports = ifparser_getkey (block, "bridge-ports");
+ 				if (ports) {
+ 					PLUGIN_PRINT("SCPlugin-Ifupdown", "found bridge ports %s for %s", ports, block->name);
+ 					char **port_ifaces = g_strsplit_set (ports, " \t", -1);
diff --git a/debian/patches/series b/debian/patches/series
index 28605828..dead3eb6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,6 +3,7 @@
 03-systemd.patch
 40-umanaged-interfaces.patch
 50-bridge-interfaces.patch
+51-normalized-keys.patch
 60-policy-stop-touching-etc-hosts.patch
 70-install-nm-online.patch
 80-keyfile-ignore-temporary-files.patch