Re: Creating adhoc wireless Network



Thanks for this quick answer.

That's what I though. Adding a new connection isnot easy to do...

when you say "programmatically ask the system settings service to create it"

What do you mean ? Doing the same stuff as nm-applet but hardcoded ?

I think I have something... ugly but it works..

Create the adhoc with nm-editor -no enc key-, dump the gconf settings with
gconftool2, cleaning the result.

On the other box : tweak the uuid and key number of the previously dumped
gconf settings according to the still created network in gconf.

Use dbus to list connections, next list connections settings to find the
one you just added. You have the objpath.

Find your wireless device with GetDevices method

Use ActivateConnection with special objpath at the objpath:/ ans
NetworkManagerUserSettings as service_name.

Keep the return, it's the ActiveConnection objpath

My Connection Appear ! yeepee

Use the same way to DeactivateConnection and why not Delete the profile.


So The ugly part is to create the new wireless adhoc connection by dumping
gconf and reload it on other boxes. It could be nice to create it directly
by dbus command.

Thanks btw for your help


> On Wed, 2009-07-01 at 05:27 -0400, nexus aflb com wrote:
>> Hi there,
>>
>> I try to create a new adhoc wireless connection using DBUS.
>>
>> It's pretty hard coz I don't find any documentantion. I've only the
>> d-feet
>> utility to see the method and object path to use.
>>
>> I would like to create a third party apps (python / bash but not c) to :
>>
>> *-create a new adhoc connection with provided essid, wep encryption and
>> key (no matter if the key is stored in plain text in gconf for example)
>> *-activate this connection
>> *-deactivate this connection
>> *-delete this connection (the only part I've successfully tested !!)
>>
>> Is there someone who can help me with this ?
>
> http://projects.gnome.org/NetworkManager/developers/spec.html
>
> Any network device setup needs a Connection associated with it, which
> contains all the settings for the device, including wifi, IP, DNS.
> Those connections are provided by settings services, of which there are
> two: user and system.  These settings services store all the Connections
> somewhere (gconf, kconfig, flat files, etc) and provide them to
> NetworkManager and other programs that want network information.
>
> So, to do an adhoc network, you'd first make sure that its Connection is
> provided by a settings service (ie, that the connection has already been
> set up), and then you tell NM to activate that connection (see the
> ActiveConnection call on the org.freedesktop.NetworkManager dbus
> interface).
>
> To get the Connection provided by a settings service, you either set it
> up through the connection editor, or programmatically ask the system
> settings service to create it.  It's also possible to create it in the
> user settings service, but that's a bit more obscure due to security
> concerns with exposing user passwords and secrets.
>
>> (the main goal is to create an adhoc wireless network to provide a one
>> shot tiny http server (woof) with my calendar.ics in order to subscribe
>> and sync my iphone  with it. I don't want to use Gcal or anything else,
>> I
>> need point to point network)
>
> Yeah, that should work.  You either need to figure out the IP address of
> the connection that got created (which NM can provide to you, each
> connection you active creates an ActiveConnection object on the dbus
> interface which implements the
> org.freedesktop.NetworkManager.Connection.Active interface, then you get
> the device from that object that you care about, then you ask the device
> for its current IPv4 settings) or bind your server to 0.0.0.0.
>
>> (second goal is to be able to create a third apps to use hotspot with
>> spécific secrets I don't want to provide to some users).
>
> Be aware that we don't necessarily expect WPA adhoc mode to work that
> well with current kernel drivers, it's fairly untested but reported by
> some to work, and not to work by others.  You'll need a fairly recent
> wpa_supplicant installed (0.6.9 or later I think) to get adhoc to work
> reliably as well.
>
> Dan
>
>




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