How to connect to wireless AP with NM 0.7.1

2010-01-13 Thread Scott Parker
I'm creating a console application which needs to be able to identify 
and to connect to wireless access points.


So far I have been able to scan and parse the access point I wish to 
connect to but I'm having trouble understanding how to actually connect 
to it now. From reading the source for the applet I have been able to 
come up with this.


s_wireless = (NMSettingWireless *)nm_setting_wireless_new ();
ap_ssid = nm_access_point_get_ssid(ap);

g_object_set(s_wireless, NM_SETTING_WIRELESS_SSID, ap_ssid, NULL);
g_object_set(s_wireless, NM_SETTING_WIRELESS_MODE, "infrastructure", NULL);

connection = nm_connection_new();
nm_connection_add_setting(connection, NM_SETTING(s_wireless));

s_con = NM_SETTING_CONNECTION(nm_setting_connection_new());
g_object_set(s_con, NM_SETTING_CONNECTION_TYPE, 
nm_setting_get_name(NM_SETTING(s_wireless)), NULL);


nm_connection_add_setting(connection, NM_SETTING(s_con));
specific_object = nm_object_get_path (NM_OBJECT(ap));

g_assert(connection);
con_path = nm_connection_get_path(connection);
g_assert(con_path); /* FAILS HERE */

nm_client_activate_connection(app->priv->client, 
NM_DBUS_SERVICE_USER_SETTINGS,
  con_path, device, 
specific_object, activate_connection_cb, app);


After I filter and select the access point (unencrypted) that i want to 
connect to I'm unable to get the path of the NMConnection I have 
created. The nm-applet is not running.


Thanks

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


How to connect to wireless AP with NM 0.7.1

2010-01-13 Thread Scott Parker
I'm creating a console application which needs to be able to identify and to
connect to wireless access points.

So far I have been able to scan and parse the access point I wish to connect
to but I'm having trouble understanding how to actually connect to it now.
>From reading the source for the applet I have been able to come up with
this:

s_wireless = (NMSettingWireless *)nm_setting_wireless_new ();
ap_ssid = nm_access_point_get_ssid(ap);

g_object_set(s_wireless, NM_SETTING_WIRELESS_SSID, ap_ssid, NULL);
g_object_set(s_wireless, NM_SETTING_WIRELESS_MODE, "infrastructure",
NULL);

connection = nm_connection_new();
nm_connection_add_setting(connection, NM_SETTING(s_wireless));

s_con = NM_SETTING_CONNECTION(nm_setting_connection_new());
g_object_set(s_con,
   NM_SETTING_CONNECTION_TYPE,
   nm_setting_get_name(NM_SETTING(s_wireless)),
   NULL);

nm_connection_add_setting(connection, NM_SETTING(s_con));
specific_object = nm_object_get_path (NM_OBJECT(ap));

g_assert(connection);
con_path = nm_connection_get_path(connection);
g_assert(con_path); /* FAILS HERE */

nm_client_activate_connection(app->priv->client,
  NM_DBUS_SERVICE_USER_SETTINGS,
  con_path,
  device,
  specific_object,
  activate_connection_cb,
  app);

After I filter and select the access point (unencrypted) that i want to
connect to I'm unable to get the path of the NMConnection I have created.
The nm-applet is not running.

Thanks
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


NM forgets CA certificate

2010-01-13 Thread Matthew Saltzman
I don't recall if I wrote before about this, but I don't think so.  I've
been thinking about it.

I have a PEAP connection that requires a separate CA cert from the usual
bundle.  The first time I connect after a reboot, the connection always
times out.  When the configuration dialog pops up, it shows "CA
certificate: (None)".  Opening the dialog allows me to select the cert
file and then the connection is fine (although the Wireless Security
config window shows no cert), even across movements to another network
and back, until the next boot or NM restart.

Also, it seems that I should be able to use the cert as I got it from
Entrust as a .cer or after conversion to a .der, but neither of those
works for me (although it does work for others).  I had to get someone
to send me a .der that we knew worked, and I use that.
-- 
Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Adding OLPC Mesh device to libnm-glib library

2010-01-13 Thread Dan Williams
On Tue, 2010-01-12 at 14:40 +0100, Jirka Klimes wrote:
> Hello,
> libnm-glib is missing OLPC device support, even if NM contains it and exports 
> via DBus.
> 
> This patch adds the device to libnm-glib library.
> Could someone review and possibly test?

Bother; found out that the olpc-mesh device Companion property should
really be an object path instead of a string, like the wifi device's
active-ap property is.  I'll need to fix up the NM side of this and then
you can respin this patch with the right bits to expose the companion
device as a real NMDeviceWifi object instead...

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-13 Thread Dan Williams
On Wed, 2010-01-13 at 08:09 +0100, Daniel Wagner wrote:
> On 01/07/2010 05:27 PM, Dan Williams wrote:
> > On Thu, 2010-01-07 at 08:18 +, Alex Buell wrote:
> >> On Wed, 2010-01-06 at 22:51 -0800, Dan Williams wrote:
> >>> On Tue, 2010-01-05 at 14:31 +0530, Elison Niven wrote:
>  Hi List,
> 
>  I am using Network manager with Gnome network applet on Fedora 12.
> 
>  Are there any options for getting accounting like information about 
>  connect
>  times, data bytes in and out etc?
> >>>
> >>> Not yet, but I've been trying to get somebody interested in doing the
> >>> feature since I'm swamped with a bunch of other stuff at this point.  It
> >>> shouldn't be too bad; we just keep a sqlite database around of all
> >>> connection start/stop/bytecounts and then expose that as a D-Bus
> >>> interface that applets can read.  Either somebody needs to step up or I
> >>> guess just wait until I get around to it.
> >>
> >> I'd like to volunteer to do this. I'll get around to it over the weekend
> >> and send you patches if you like. All I need is a list of desired
> >> features and I'll implement it. Just my way of contributing to NM!
> >
> > Excellent!  I put a summary of what I think should be done here:
> >
> > https://bugzilla.gnome.org/show_bug.cgi?id=601372
> >
> > Does the stuff in Comment #3 sound doable?  You don't have to do
> > everything at the start but we can do it incrementally.  Like you don't
> > need to populate the "user-id" and "user-name" fields yet, since we need
> > to do a bit more internally to NM to store that information in the
> > NMActRequest structure (by pulling the uid off the D-Bus request to
> > start the connection).
> >
> > Let me know if you have any questions.
> 
> Just out of curiosity: where does the accounting information come from? 
> I see one possible solution using netfilter with ULOG target and the 
> ulogd daemon.
> 
> I guess when using ulogd there is always a certain lag between the 
> number of bytes transferred/received and the user defined maximum of 
> bytes transferred/received (probably enforced by PolicyKit). I don't 
> think that's a real problem and could be workaround if there isn't the 
> need to have exact numbers.

At least for PPP we can get traffic counts via ioctls.  I'd like to get
traffic counts for the other devices like ifconfig does, but last I knew
ifconfig got that by scraping /proc/net/dev which is just ugly.  We may
be able to get updated traffic counts from netlink somehow?

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: support for --tls-remote : gnome bz #455142

2010-01-13 Thread Dan Williams
On Fri, 2010-01-08 at 12:50 +0530, Huzaifa Sidhpurwala wrote:
> Hi,
> I just saw this old bug in the gnome bz, i would like to write a patch
> for it, is any one already working on it, or is it available to be
> worked on.

Follow-up; Huzaifa will work on this... :)

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Problem to add a broadband connection on NetworkManagerUserSettings

2010-01-13 Thread Maxwell Chiareli Xandeco

I'm using Ubuntu 9.10, with your code I don't get errors but a
connection is not added, nothing happens when I call AddConnection
method.

Follow my policy file:

http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd";>
























512


On Wed, 2010-01-13 at 14:07 +0100, Jirka Klimes wrote:

> On Tuesday 12 January 2010 16:36:07 Maxwell Chiareli Xandeco wrote:
> > Hi all,
> >
> > I trying to add a new broadband connection using dbus python API:
> >
> > settings = dbus.Dictionary({dbus.String(u'connection'):
> > dbus.Dictionary({dbus.String(u'timestamp'): dbus.UInt64(1263301788L,
> > variant_level=1), dbus.String(u'autoconnect'): dbus.Boolean(False,
> > variant_level=1), dbus.String(u'type'): dbus.String(u'gsm',
> > variant_level=1), dbus.String(u'uuid'):
> > dbus.String(u'8a0e02d9-9b1a-463b-a089-7a68140bf4c3', variant_level=1),
> > dbus.String(u'id'): dbus.String(u'Vivo Default', variant_level=1)},
> > signature=dbus.Signature('sv')), dbus.String(u'ppp'):
> > dbus.Dictionary({}, signature=dbus.Signature('sv')),
> > dbus.String(u'gsm'): dbus.Dictionary({dbus.String(u'username'):
> > dbus.String(u'vivo', variant_level=1), dbus.String(u'band'):
> > dbus.Int32(0, variant_level=1), dbus.String(u'apn'):
> > dbus.String(u'zap.vivo.com.br', variant_level=1),
> > dbus.String(u'number'): dbus.String(u'*99#', variant_level=1)},
> > signature=dbus.Signature('sv')), dbus.String(u'serial'):
> > dbus.Dictionary({dbus.String(u'baud'): dbus.UInt32(115200L,
> > variant_level=1)}, signature=dbus.Signature('sv'))},
> > signature=dbus.Signature('sa{sv}'))
> >
> > sys_bus = dbus.SystemBus()
> > proxy = sys_bus.get_object("org.freedesktop.NetworkManagerUserSettings",
> > "/org/freedesktop/NetworkManagerSettings")
> > proxy.AddConnection(settings)
> >
> > When I run this code i get a access denied error:
> >
> > dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied:
> > Rejected send message, 2 matched rules; type="method_call",
> > sender=":1.210" (uid=0 pid=27292 comm="python) interface="(unset)"
> > member="AddConnection" error name="(unset)" requested_reply=0
> > destination=":1.106" (uid=1000 pid=10148 comm="nm-applet))
> >
> > Does someone have any idea?
> >
> > Maxwell
> >
>
> The error says that you don't have permissions.
> It's caused by not specifying interface which the method AddConnection should
> be called on.
>
> so do:
> sys_bus = dbus.SystemBus()
> proxy = sys_bus.get_object("org.freedesktop.NetworkManagerUserSettings",
> "/org/freedesktop/NetworkManagerSettings")
> iface = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
>
> iface.AddConnection(settings)
>
> Btw, what distribution do you use and what policies do you have in
> /etc/dbus-1/system.d/nm-applet.conf ?
>
> Jirka



 
Legal Disclaimer:
The information contained in this message may be privileged and confidential. 
It is intended to be read only by the individual or entity to whom it is 
addressed or by their designee. If the reader of this message is not the 
intended recipient, you are on notice that any distribution of this message, in 
any form, is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete or destroy any copy of this 
message

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Problem to add a broadband connection on NetworkManagerUserSettings

2010-01-13 Thread Jirka Klimes
On Tuesday 12 January 2010 16:36:07 Maxwell Chiareli Xandeco wrote:
> Hi all,
> 
> I trying to add a new broadband connection using dbus python API:
> 
> settings = dbus.Dictionary({dbus.String(u'connection'):
> dbus.Dictionary({dbus.String(u'timestamp'): dbus.UInt64(1263301788L,
> variant_level=1), dbus.String(u'autoconnect'): dbus.Boolean(False,
> variant_level=1), dbus.String(u'type'): dbus.String(u'gsm',
> variant_level=1), dbus.String(u'uuid'):
> dbus.String(u'8a0e02d9-9b1a-463b-a089-7a68140bf4c3', variant_level=1),
> dbus.String(u'id'): dbus.String(u'Vivo Default', variant_level=1)},
> signature=dbus.Signature('sv')), dbus.String(u'ppp'):
> dbus.Dictionary({}, signature=dbus.Signature('sv')),
> dbus.String(u'gsm'): dbus.Dictionary({dbus.String(u'username'):
> dbus.String(u'vivo', variant_level=1), dbus.String(u'band'):
> dbus.Int32(0, variant_level=1), dbus.String(u'apn'):
> dbus.String(u'zap.vivo.com.br', variant_level=1),
> dbus.String(u'number'): dbus.String(u'*99#', variant_level=1)},
> signature=dbus.Signature('sv')), dbus.String(u'serial'):
> dbus.Dictionary({dbus.String(u'baud'): dbus.UInt32(115200L,
> variant_level=1)}, signature=dbus.Signature('sv'))},
> signature=dbus.Signature('sa{sv}'))
> 
> sys_bus = dbus.SystemBus()
> proxy = sys_bus.get_object("org.freedesktop.NetworkManagerUserSettings",
> "/org/freedesktop/NetworkManagerSettings")
> proxy.AddConnection(settings)
> 
> When I run this code i get a access denied error:
> 
> dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied:
> Rejected send message, 2 matched rules; type="method_call",
> sender=":1.210" (uid=0 pid=27292 comm="python) interface="(unset)"
> member="AddConnection" error name="(unset)" requested_reply=0
> destination=":1.106" (uid=1000 pid=10148 comm="nm-applet))
> 
> Does someone have any idea?
> 
> Maxwell
> 

The error says that you don't have permissions.
It's caused by not specifying interface which the method AddConnection should 
be called on.

so do:
sys_bus = dbus.SystemBus()
proxy = sys_bus.get_object("org.freedesktop.NetworkManagerUserSettings", 
"/org/freedesktop/NetworkManagerSettings")
iface = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")

iface.AddConnection(settings)

Btw, what distribution do you use and what policies do you have in 
/etc/dbus-1/system.d/nm-applet.conf ?

Jirka
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list