about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@teco.edu>2006-05-10 00:36:14 +0000
committerMichael Biebl <biebl@teco.edu>2006-05-10 00:36:14 +0000
commita5a5d5671a0c793b4d45373947178fa77fec9a16 (patch)
treeeb7a5f844a1aabd50512208dda833bc776086b0d
parent63b3f3f48fb827a50b82d46c358dbedea4060770 (diff)
Fix the /etc/network/interfaces parser:
- Only add data to an existing block (prevents segfault)
- Support mapping and allow-* stanzas.


git-svn-id: svn+ssh://svn.debian.org/svn/pkg-utopia/packages/unstable/networkmanager@820 ceb527fc-18e6-0310-9fe2-813c157c29e7
-rw-r--r--debian/README.Debian7
-rw-r--r--debian/changelog6
-rw-r--r--debian/patches/10-interface_parser_fixes.patch90
3 files changed, 99 insertions, 4 deletions
diff --git a/debian/README.Debian b/debian/README.Debian
index 537f1c83..4694c299 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -11,8 +11,11 @@ After that you have to reload dbus with the command "/etc/init.d/dbus reload".
 
 Configuration
 ~~~~~~~~~~~~~
-Only devices that are not listed in /etc/network/interfaces or which have been
-configured "auto" and "dhcp" (with no other options) are managed by NM.
+Only devices that are *not* listed in /etc/network/interfaces or which have 
+been configured "auto" and "dhcp" (with no other options) are managed by NM.
+
+This way you can setup a custom (static) configuration for a device and NM 
+will not try to override this setting.
 
 Examples:
 
diff --git a/debian/changelog b/debian/changelog
index ee66008a..9f2cdaf0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,13 +11,15 @@ network-manager (0.6.2-2) unstable; urgency=low
       not handled by NM. This makes it possible to configure interfaces 
       statically and have NM not messing with them. 
       Updated README.Debian to reflect these changes.
-    - Added 09-nm_bad_mutex_free.patch. Otherwise NM crashes if devices are
-      listed in /etc/network/interfaces. 
+    - Added 09-nm_bad_mutex_free.patch. Otherwise NM crashes if a device is
+      disabled.
   * Added 07-libnm_glib_reconnect_dbus.patch which makes libnm_glib sleep 
     between unsuccessful connection attempts to dbus. (Closes: #366010)
   * Bumped Standards-Version to 3.7.2, no further changes required.
   * Removed *.la files from the dev packages as we also ship pkg-config files
     which are a better alternative.
+  * Added 10-interface_parser_fixes.patch which fixes several problems with
+    the /etc/network/interfaces parser. (Closes: #355564)
 
  -- Michael Biebl <biebl@teco.edu>  Fri,  5 May 2006 18:01:47 +0200
 
diff --git a/debian/patches/10-interface_parser_fixes.patch b/debian/patches/10-interface_parser_fixes.patch
new file mode 100644
index 00000000..e751e359
--- /dev/null
+++ b/debian/patches/10-interface_parser_fixes.patch
@@ -0,0 +1,90 @@
+Index: src/backends/interface_parser.c
+===================================================================
+RCS file: /cvs/gnome/NetworkManager/src/backends/interface_parser.c,v
+retrieving revision 1.6
+diff -u -3 -p -r1.6 interface_parser.c
+--- src/backends/interface_parser.c	24 Oct 2005 15:04:28 -0000	1.6
++++ src/backends/interface_parser.c	9 May 2006 23:06:35 -0000
+@@ -50,6 +50,10 @@ void add_block(const char *type, const c
+ 
+ void add_data(const char *key,const char *data)
+ {
++	// Check if there is a block where we can attach our data
++	if (first == NULL)
++		return;
++			
+ 	if_data *ret = (if_data*)calloc(1,sizeof(struct _if_data));
+ 	ret->key = g_strdup(key);
+ 	ret->data = g_strdup(data);
+@@ -73,6 +77,10 @@ void ifparser_init(void)
+ {
+ 	FILE *inp = fopen(INTERFACES,"r");
+ 	int ret = 0;
++	char *line;
++	char *space;
++	char rline[255];
++
+ 	if (inp == NULL)
+ 	{
+ 		nm_warning ("Error: Can't open %s\n",INTERFACES);
+@@ -81,10 +89,16 @@ void ifparser_init(void)
+ 	first = last = NULL;
+ 	while(1)
+ 	{
+-		char *line,rline[255],*space;
++		line = space = NULL;
+ 		ret = fscanf(inp,"%255[^\n]\n",rline);
+ 		if (ret == EOF)
+ 			break;
++		// If the line did not match, skip it
++		if (ret == 0) {
++			fgets(rline, 255, inp);
++			continue;
++		}
++		
+ 		line = rline;
+ 		while(line[0] == ' ')
+ 			line++;
+@@ -94,18 +108,19 @@ void ifparser_init(void)
+ 		SPACE_OR_TAB(line,space)
+ 		if (space == NULL)
+ 		{
+-            nm_warning ("Error: Can't parse interface line '%s'\n",line);
++			nm_warning ("Error: Can't parse interface line '%s'\n",line);
+ 			continue;
+ 		}
+ 		space[0] = '\0';
+ 		
+-		
++		// There are four different stanzas:
++		// iface, mapping, auto and allow-*. Create a block for each of them.
+ 		if (strcmp(line,"iface")==0)
+ 		{
+ 			char *space2 = strchr(space+1,' ');
+ 			if (space2 == NULL)
+ 			{
+-            	nm_warning ("Error: Can't parse iface line '%s'\n",space+1);
++				nm_warning ("Error: Can't parse iface line '%s'\n",space+1);
+ 				continue;
+ 			}
+ 			space2[0]='\0';
+@@ -116,7 +131,7 @@ void ifparser_init(void)
+ 				space = strchr(space2+1,' ');
+ 				if (space == NULL)
+ 				{
+-            		nm_warning ("Error: Can't parse data '%s'\n",space2+1);
++					nm_warning ("Error: Can't parse data '%s'\n",space2+1);
+ 					continue;
+ 				}
+ 				space[0] = '\0';
+@@ -124,6 +139,10 @@ void ifparser_init(void)
+ 			}
+ 		}
+ 		else if (strcmp(line,"auto")==0)
++			add_block(line,space+1);
++		else if (strcmp(line,"mapping")==0)
++			add_block(line,space+1);
++		else if (strncmp(line,"allow-",6)==0)
+ 			add_block(line,space+1);
+ 		else
+ 			add_data(line,space+1);