Re: Make NM respect manual setting in ifupdown



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Op 6-4-2010 10:07, Dan Williams schreef:
> On Sun, 2010-04-04 at 17:36 +0200, Okkel wrote:
> 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:
>
> > Hmm, though this is usually done by setting:
>
> > managed=false
>
> > in /etc/NetworkManager/nm-system-settings.conf
> > or /etc/NetworkManager/NetworkManager.conf instead, which causes NM to
> > ignore devices that are listed in your /e/n/i file.
>

My /etc/NetworkManager/nm-system-settings.conf HAS managed=false, but
the plugin messes things up because it doesn't find wpa-key nor
wireless-key and essid lines. So the plugin 'forgets' to add the
interace to the to-be-unmanaged interfaces list and NM tries to manage
the interface, fighting over it with wpasupplicant.

> > I suppose this enhancement would allow 'managed=true' and let the user
> > make individual devices unmanaged, which is nice.
>
> > The patch isn't quite what we'd need though, since what you really
> want
> > to do is to make the device 'unmanaged' if it's marked as 'manual'
> > in /e/n/i.  Unfortunately the ifupdown plugin isn't well set up to
> > unmanage individual interfaces right now...  any chance you'd be
> willing
> > to work on a patch for that?
>

The patch makes the plugin report the interace as unmanaged. Although
I admit it's a bit hackish because the plugin reports the interface to
be unmanaged because it doesn't recognise the
NM_SETTING_MANUAL_SETTING_NAME type.
About working on a better patch, I have very little time to spend on
my computer the next months.

> > asac/tony, any comments here?
>
> > Dan
>
> 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

differences between files attachment (nm-manual.patch)
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;
 
_______________________________________________
NetworkManager-list mailing list
NetworkManager-list gnome org
http://mail.gnome.org/mailman/listinfo/networkmanager-list




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iEYEARECAAYFAku7fC4ACgkQQxTA2p4ePKc5wgCgmWfdU2QJJrl6rJQFu9NABXOR
UQ4AnjLsnRyf7oYn7GcWwaJLVOoZUi+F
=l0ig
-----END PGP SIGNATURE-----



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