Make NM respect manual setting in ifupdown



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello everybody,

Since I'm on Debian, I'm using /etc/network/interfaces to bring up my
wireless network connection. According to the wpa-supplicant docs at
/usr/share/doc/wpasupplicant/README.modes.gz one of the ways to do so is
by using wpa-supplicant scripts. Here's the corresponding part of my
/etc/network/interfaces:

auto wlan0
iface wlan0 inet manual
    wpa-driver wext
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

The ifupdown plugin ignores the 'manual' setting and tries to read the
wireless config since it sees wpa-* lines. This results in an error and
causes NM to take control over the interface.
The attached patch fixes this behaviour by giving interfaces configured
as 'manual' the NM_SETTING_MANUAL_SETTING_NAME type.

Thanks in advance,
Okkel Klaver
info vanhetland nl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAku4sgYACgkQQxTA2p4ePKfS1QCghaDQMzycIN8FlnO+s7i4+qbW
7xQAn3ClUTOc4YD822npR4lidhu6CPaI
=vCDR
-----END PGP SIGNATURE-----
diff -ur network-manager-orig-0.8//system-settings/plugins/ifupdown/parser.c network-manager-0.8//system-settings/plugins/ifupdown/parser.c
--- network-manager-orig-0.8//system-settings/plugins/ifupdown/parser.c	2010-04-03 21:14:49.000000000 +0200
+++ network-manager-0.8//system-settings/plugins/ifupdown/parser.c	2010-04-04 13:18:16.000000000 +0200
@@ -55,6 +55,12 @@
 		ret_type = NM_SETTING_PPP_SETTING_NAME;
 	}
 
+        // Added by Okkel Klaver <info vanhetland nl>
+        // Make ifupdown plugin respect manual setting
+        if(value && !strcmp("manual", value)) {
+            ret_type = NM_SETTING_MANUAL_SETTING_NAME;
+        }
+
 	while(!ret_type && curr) {
 		if(!strncmp("wireless-", curr->key, strlen("wireless-")) ||
 		   !strncmp("wpa-", curr->key, strlen("wpa-"))) {
@@ -561,16 +567,21 @@
 	PLUGIN_PRINT("SCPlugin-Ifupdown", "update_connection_setting_from_if_block: name:%s, type:%s, id:%s, uuid: %s",
 			   block->name, type, idstr, nm_setting_connection_get_uuid (s_con));
 
+        // Modified by Okkel Klaver <info vanhetland nl>
+        // Make ifupdown plugin respect manual setting
 	if (!strcmp (NM_SETTING_WIRED_SETTING_NAME, type))
 		update_wired_setting_from_if_block (connection, block);	
 	else if (!strcmp (NM_SETTING_WIRELESS_SETTING_NAME, type)) {
 		update_wireless_setting_from_if_block (connection, block);
 		update_wireless_security_setting_from_if_block (connection, block);
 	}
+        else if(!strcmp(NM_SETTING_MANUAL_SETTING_NAME, type))
+                success = TRUE;
 
 	update_ip4_setting_from_if_block (connection, block);
 
-	success = nm_connection_verify (connection, error);
+	if(!success)
+                success = nm_connection_verify (connection, error);
 
 	g_free (idstr);
 	return success;
diff -ur network-manager-orig-0.8//system-settings/plugins/ifupdown/plugin.h network-manager-0.8//system-settings/plugins/ifupdown/plugin.h
--- network-manager-orig-0.8//system-settings/plugins/ifupdown/plugin.h	2010-04-03 21:14:49.000000000 +0200
+++ network-manager-0.8//system-settings/plugins/ifupdown/plugin.h	2010-04-04 13:18:16.000000000 +0200
@@ -35,6 +35,10 @@
 #define SC_IS_PLUGIN_IFUPDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SC_TYPE_PLUGIN_IFUPDOWN))
 #define SC_PLUGIN_IFUPDOWN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SC_TYPE_PLUGIN_IFUPDOWN, SCPluginIfupdownClass))
 
+// Added by Okkel Klaver <info vanhetland nl>
+// Make ifupdown plugin respect manual setting
+#define NM_SETTING_MANUAL_SETTING_NAME      "manual"
+
 typedef struct _SCPluginIfupdown SCPluginIfupdown;
 typedef struct _SCPluginIfupdownClass SCPluginIfupdownClass;
 

Attachment: nm-manual.patch.sig
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]