Re: No error is returned to user if system settings plugin fails connection update

2010-11-20 Thread Andrey Borzenkov
On Tue, Mar 2, 2010 at 8:34 PM, Andrey Borzenkov arvidj...@gmail.com wrote:
 On Tuesday 02 of March 2010 10:14:09 Dan Williams wrote:
 On Sat, 2010-02-27 at 23:39 +0300, Andrey Borzenkov wrote:
  Using NM 0.8 + nm-applet 0.8 I hit the following situation - if
  -update plugin method fails (for whatever reason - e.g. plugin is
  not able to create necessary file) - no error is returned to user.
  Error is correctly returned if creation of new system connection
  fails.
 
  I start nm-connection-editor and select system connection to
  modify. I correctly get authentication request and am able to
  modify connection (and save changes if no errors happened). But if
  there are errors inside of plugin during updating of connection
  settings, very funny situation results - logical state of NM is
  updated (i.e. if I start n-c-e again, I see my changes) but state
  in files on permanent storage is not updated, meaning restarting
  NM show again previous configuration.
 
  I verified that plugin really returns error, error is correctly set
  and plugin should be calling callback (in this case
  con_update_cb). This unfortunately pretty much ends my ability to
  debug it further - I am not good at D-Bus internals.

 So the flow *does* get to nm-sysconfig-connection.c's con_update_cb()
 function,

 Yes

 and the error is valid in that function?

 Yes

 If you add a
 g_message/fprintf of error-message there is that valid too?


 update: DEBUG: /etc/sysconfig/network-scripts/ifcfg-eth0 ERROR ifcfg-
 mdv: DHCP_CLIENT_ID is not supported
 con_update_cb: DEBUG: connection error ifcfg-mdv: DHCP_CLIENT_ID is not
 supported



Sorry for reviving old thread, but it is still valid in 0.8.2. So far
there are two separate issues associated with it.

1) if plugin fails to write connection to stable store (for whatever
reasons) NM is left with old, cached, connection that was received fro
client. It makes impression that connection update worked (and it even
will work for as long as either NM is restarted or connection is
re-read again from disk). The reason is,
src/system-settings/nm-sysconfig-connection.c:pk_update_cb() first
updates in memory and then calls to save new definition. It is even
documented in comments :)

/* Update our settings internally so the update() call will save the new
 * ones.

But if -update fails, settings are not rolled back.

It could be possible; we could add old_connection field to PolkitCall
and use it to rollback in con_update_cb. Any potential issues
associated with it?

2) NM core does send proper error via D-Bus to nm-connection-editor,
but it simply does not have code to display them. On update it finally
calls connection_updated_cb() and it does not display anything (nor is
any error displayed on callback chain).

Hope this makes sense.
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


possibly ifcfg-rh: fix missing connections if unmanaged interface was present

2010-11-20 Thread Andrey Borzenkov
Below is patch for ifcfg-mdv (Mandriva plugin that is currently
in development). Plugin was forked off ifcfg-rh and this part
is mostly unchanged. From code review the same problem should
be present in ifcfg-rh as well.

To reproduce - take the first ifcfg file in directory scan order
and set it as unmanaged. In my case it results in no system
connections being displayed by NM.

---

NM starts plugin initialization by requesting list of
unmanaged interfaces. ifcfg-mdv reads in interface list on
demand either in get_connections() or in get_unmanaged_specs().
What now happens is:

get_unmanaged_specs() - read_connections() - read_one_connection()
- signal(unmanaged-specs-changed) - unmanaged_specs_changed()
- nm_sysconfig_settings_get_unmanaged_specs() - load_connections()
- get_connections()

Now ifcfg-mdv get_connections() will see non-empty connection
hash table and return whatever is available. load_connections()
will mark connections as loaded and never re-request it. And
read_one_connection() never signals that connection was added so
NM will never notice existence of connections added *after* the
first unmanaged interface was found.

There are two places where read_one_connection() is called:
read_connections() and handle_connection_remove_or_new(). The
former is called exactly once on initialization and does not
need any signals - we want to read full list before interacting
with NM. Move signal(unmanaged-specs-changed) to the latter
from read_one_connection().

Signed-off-by: Andrey Borzenkov arvidj...@gmail.com

---

 system-settings/plugins/ifcfg-mdv/plugin.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/system-settings/plugins/ifcfg-mdv/plugin.c 
b/system-settings/plugins/ifcfg-mdv/plugin.c
index 4b4667b..68a2c72 100644
--- a/system-settings/plugins/ifcfg-mdv/plugin.c
+++ b/system-settings/plugins/ifcfg-mdv/plugin.c
@@ -135,7 +135,6 @@ read_one_connection (SCPluginIfcfg *plugin, const char 
*filename)
if (nm_ifcfg_connection_get_unmanaged_spec (connection)) {
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, Ignoring connection 
'%s' and its 
  device due to 
NM_CONTROLLED/ONBOOT/BRIDGE/VLAN., cid);
-   g_signal_emit_by_name (plugin, 
NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
} else {
/* Wait for the connection to become unmanaged once it 
knows the
 * UDI of it's device, if/when the device gets plugged 
in.
@@ -298,7 +297,9 @@ handle_connection_remove_or_new (SCPluginIfcfg *plugin,
if (do_new) {
connection = read_one_connection (plugin, path);
if (connection) {
-   if (!nm_ifcfg_connection_get_unmanaged_spec 
(connection))
+   if (nm_ifcfg_connection_get_unmanaged_spec (connection))
+   g_signal_emit_by_name (plugin, 
NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
+   else
g_signal_emit_by_name (plugin, 
NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, connection);
}
}
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: 0.8.2: nm-connection-edit does not ask for authorization on system connections

2010-11-20 Thread Andrey Borzenkov
On Sat, Nov 20, 2010 at 2:01 AM, Dan Williams d...@redhat.com wrote:
 On Sun, 2010-11-14 at 10:49 +0300, Andrey Borzenkov wrote:
 Trying to use nm-connection-editor under KDE (it is SVN snapshot
 4.5.76) to edit system connection results only in Insufficient
 privileges. I am not asked for authentication.

 Seems like a breakdown with PolicyKit stuff.  Do you have a PolicyKit
 agent for KDE installed, or do you have the Gtk PolicyKit agent
 installed at all?


Honestly? No idea. I lost track of all these changes in names long ago.

.. digging web, trying to find information about KDE ...

Right, I had old version that no more worked in KDE 4.6 ... found new
and shiny KDE GIT with new and shiny polkit-kde-1 that works. Why they
make it so hard? :)
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: GSM modem via Bluetooth?

2010-11-20 Thread Andrey Borzenkov
On Sat, Nov 20, 2010 at 1:24 AM, Dan Williams d...@redhat.com wrote:
 On Thu, 2010-11-04 at 15:33 +0300, Andrey Borzenkov wrote:
 I have Nokia E51 and am using KDE with bluedevil; Modemmanager 0.4 and
 NM 0.8.2-rc1. I can browse phone and transfer files, but modemmanager
 does not display any available device when BT is activated. Is it
 supposed to work at all and if yes, what is requires to get it
 working? Pointers to documentation is appreciated. Thank you!

 Getting this working first requires adding a connection for the
 device, since we can't scan for it.  Once the connection is added and
 known to NM, it'll show up in the menu and you can choose it.  While it
 doesn't help you immediately with bluedevil, this is how we did the
 gnome side of things:

 http://blogs.gnome.org/dcbw/2009/07/10/unwire-with-networkmanager/


Yes, I know this but it does not really help to make it running using
Bordmittel.

OK, I have phone that exports DUN:

{pts/1}% sdptool search DUN
Inquiring ...
Searching for DUN on 00:24:03:BE:1A:29 ...
Service Name: Dial-Up Networking
Service RecHandle: 0x100c5
Service Class ID List:
  Dialup Networking (0x1103)
Protocol Descriptor List:
  L2CAP (0x0100)
  RFCOMM (0x0003)
Channel: 4
Language Base Attr List:
  code_ISO639: 0x454e
  encoding:0x6a
  base_offset: 0x100
Profile Descriptor List:
  Dialup Networking (0x1103)
Version: 0x0100

As I understand, I need serial port that is used by ModemManager. I
now create serial port for the phone:

{pts/0}% sudo rfcomm bind 00:24:03:BE:1A:29 4
{pts/0}% ll /dev/rfcomm0
crw-rw 1 root dialout 216, 0 Ноя 20 23:22 /dev/rfcomm0

But this port is ignored by ModemManager:

{pts/0}% dbus-send --print-reply --system
--dest=org.freedesktop.ModemManager /org/freedesktop/ModemManager
org.freedesktop.ModemManager.EnumerateDevices
method return sender=:1.10 - dest=:1.315 reply_serial=2
   array [
   ]

So what is missing in this case? Thank you!
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list