iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* No Agent registered when calling Connect method
@ 2023-03-23  9:52 clement.legoffic
  2023-03-23 23:02 ` James Prestwood
  0 siblings, 1 reply; 6+ messages in thread
From: clement.legoffic @ 2023-03-23  9:52 UTC (permalink / raw)
  To: iwd

Hello,

I want to connect to a psk network using iwd D-BUS interface.
I am using IWD version 1.25 with sytemd.
To call D-BUS method I use busctl.
My actions are :

Scan for networks :
busctl call net.connman.iwd /net/connman/iwd/0/6 net.connman.iwd.Station Scan

Register an agent :
busctl call net.connman.iwd /net/connman/iwd net.connman.iwd.AgentManager RegisterAgent o /test/agent/1234

Call Connect method my object Interface
busctl call net.connman.iwd /net/connman/iwd/0/6/Xxxxx net.connman.iwd.Network Connect

But I get the error :
Call failed: No Agent registered

So I restart iwd deamon with debug output and try to connect to my network using iwctl
iwctl station wlan0 connect SSID

IWD debug output with the iwctl command is :
src/agent.c:agent_register() agent register called
src/agent.c:agent_register() agent :1.71 path /agent/471
src/network.c:network_connect()
src/network.c:network_connect_psk() ask_passphrase: true
src/agent.c:agent_request_passphrase() agent 0xb9ca8 owner :1.71 path /agent/471
src/agent.c:agent_send_next_request() send request to :1.71 /agent/471
src/agent.c:agent_receive_reply() agent 0xb9ca8 request id 22
src/network.c:passphrase_callback() result 0

And I get connected

Whereas the debug output using the D-BUS Call is :
src/agent.c:agent_register() agent register called
src/agent.c:agent_register() agent :1.78 path /test/agent/1234
src/agent.c:agent_disconnect() agent :1.78 disconnected
src/agent.c:agent_free() agent free 0xbb1a0
src/network.c:network_connect()
src/network.c:network_connect_psk() ask_passphrase: true

And I'm not able to connect to my network/

We can observe that the agent disconnect before the network_connect(), Is it a normal behaviour ?

So my question is how to use the RegisterAgent method in order to connect to a psk Network with DBUS ?

Thanks in advance


Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis a l'intention exclusive de ses destinataires.
Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur par e-mail.
Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. Les communications sur Internet n'etant pas securisees, l'expediteur informe qu'il ne peut accepter aucune responsabilite quant au contenu de ce message.
This mail message and attachments (the "message") are solely intended for the addresses. It is confidential in nature.
If you receive this message in error, please delete it and immediately notify the sender by e-mail.
Any use other than its intended purpose, dissemination or disclosure, either whole or partial, is prohibited except if formal approval is granted. As communication on the Internet is not secure, the sender does not accept responsibility for the content of this message.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: No Agent registered when calling Connect method
  2023-03-23  9:52 No Agent registered when calling Connect method clement.legoffic
@ 2023-03-23 23:02 ` James Prestwood
  2023-03-24  9:42   ` clement.legoffic
  0 siblings, 1 reply; 6+ messages in thread
From: James Prestwood @ 2023-03-23 23:02 UTC (permalink / raw)
  To: clement.legoffic, iwd

Hi,

On Thu, 2023-03-23 at 09:52 +0000, clement.legoffic@kelio.com wrote:
> Hello,
> 
> I want to connect to a psk network using iwd D-BUS interface.
> I am using IWD version 1.25 with sytemd.
> To call D-BUS method I use busctl.

I think using busctl for an agent is likely the problem. An agent for
IWD is a DBus service, so it must be running and able to accept
incoming requests for passphrase/usernames etc.

> My actions are :
> 
> Scan for networks :
> busctl call net.connman.iwd /net/connman/iwd/0/6
> net.connman.iwd.Station Scan
> 
> Register an agent :
> busctl call net.connman.iwd /net/connman/iwd
> net.connman.iwd.AgentManager RegisterAgent o /test/agent/1234
> 
> Call Connect method my object Interface
> busctl call net.connman.iwd /net/connman/iwd/0/6/Xxxxx
> net.connman.iwd.Network Connect
> 
> But I get the error :
> Call failed: No Agent registered
> 
> So I restart iwd deamon with debug output and try to connect to my
> network using iwctl
> iwctl station wlan0 connect SSID
> 
> IWD debug output with the iwctl command is :
> src/agent.c:agent_register() agent register called
> src/agent.c:agent_register() agent :1.71 path /agent/471
> src/network.c:network_connect()
> src/network.c:network_connect_psk() ask_passphrase: true
> src/agent.c:agent_request_passphrase() agent 0xb9ca8 owner :1.71 path
> /agent/471
> src/agent.c:agent_send_next_request() send request to :1.71 /agent/471
> src/agent.c:agent_receive_reply() agent 0xb9ca8 request id 22
> src/network.c:passphrase_callback() result 0
> 
> And I get connected
> 
> Whereas the debug output using the D-BUS Call is :
> src/agent.c:agent_register() agent register called
> src/agent.c:agent_register() agent :1.78 path /test/agent/1234
> src/agent.c:agent_disconnect() agent :1.78 disconnected
> src/agent.c:agent_free() agent free 0xbb1a0
> src/network.c:network_connect()
> src/network.c:network_connect_psk() ask_passphrase: true
> 
> And I'm not able to connect to my network/
> 
> We can observe that the agent disconnect before the network_connect(),
> Is it a normal behaviour ?
> 
> So my question is how to use the RegisterAgent method in order to
> connect to a psk Network with DBUS ?

IWD has a simple agent service written in Python for reference:
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/test/simple-agent

Thanks,
James

> 
> Thanks in advance
> 
> 
> Ce message et toutes les pieces jointes (ci-apres le "message") sont
> etablis a l'intention exclusive de ses destinataires.
> Si vous recevez ce message par erreur, merci de le detruire et d'en
> avertir immediatement l'expediteur par e-mail.
> Toute utilisation de ce message non conforme a sa destination, toute
> diffusion ou toute publication, totale ou partielle, est interdite,
> sauf autorisation expresse. Les communications sur Internet n'etant pas
> securisees, l'expediteur informe qu'il ne peut accepter aucune
> responsabilite quant au contenu de ce message.
> This mail message and attachments (the "message") are solely intended
> for the addresses. It is confidential in nature.
> If you receive this message in error, please delete it and immediately
> notify the sender by e-mail.
> Any use other than its intended purpose, dissemination or disclosure,
> either whole or partial, is prohibited except if formal approval is
> granted. As communication on the Internet is not secure, the sender
> does not accept responsibility for the content of this message.
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: No Agent registered when calling Connect method
  2023-03-23 23:02 ` James Prestwood
@ 2023-03-24  9:42   ` clement.legoffic
  2023-03-24 15:13     ` James Prestwood
  0 siblings, 1 reply; 6+ messages in thread
From: clement.legoffic @ 2023-03-24  9:42 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi,

Thank you for your answer !

> Hi,
> 
> On Thu, 2023-03-23 at 09:52 +0000, clement.legoffic@kelio.com wrote:
> > Hello,
> >
> > I want to connect to a psk network using iwd D-BUS interface.
> > I am using IWD version 1.25 with sytemd.
> > To call D-BUS method I use busctl.
> 
> I think using busctl for an agent is likely the problem. An agent for IWD is a
> DBus service, so it must be running and able to accept incoming requests
> for passphrase/usernames etc.

Ok I understand.

> 
> > My actions are :
> >
> > Scan for networks :
> > busctl call net.connman.iwd /net/connman/iwd/0/6
> > net.connman.iwd.Station Scan
> >
> > Register an agent :
> > busctl call net.connman.iwd /net/connman/iwd
> > net.connman.iwd.AgentManager RegisterAgent o /test/agent/1234
> >
> > Call Connect method my object Interface busctl call net.connman.iwd
> > /net/connman/iwd/0/6/Xxxxx net.connman.iwd.Network Connect
> >
> > But I get the error :
> > Call failed: No Agent registered
> >
> > So I restart iwd deamon with debug output and try to connect to my
> > network using iwctl iwctl station wlan0 connect SSID
> >
> > IWD debug output with the iwctl command is :
> > src/agent.c:agent_register() agent register called
> > src/agent.c:agent_register() agent :1.71 path /agent/471
> > src/network.c:network_connect()
> > src/network.c:network_connect_psk() ask_passphrase: true
> > src/agent.c:agent_request_passphrase() agent 0xb9ca8 owner :1.71 path
> > /agent/471
> > src/agent.c:agent_send_next_request() send request to :1.71 /agent/471
> > src/agent.c:agent_receive_reply() agent 0xb9ca8 request id 22
> > src/network.c:passphrase_callback() result 0
> >
> > And I get connected
> >
> > Whereas the debug output using the D-BUS Call is :
> > src/agent.c:agent_register() agent register called
> > src/agent.c:agent_register() agent :1.78 path /test/agent/1234
> > src/agent.c:agent_disconnect() agent :1.78 disconnected
> > src/agent.c:agent_free() agent free 0xbb1a0
> > src/network.c:network_connect()
> > src/network.c:network_connect_psk() ask_passphrase: true
> >
> > And I'm not able to connect to my network/
> >
> > We can observe that the agent disconnect before the network_connect(),
> > Is it a normal behaviour ?
> >
> > So my question is how to use the RegisterAgent method in order to
> > connect to a psk Network with DBUS ?
> 
> IWD has a simple agent service written in Python for reference:
> https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/test/simple-
> agent

I have read this code but maybe not understand it.
Does I need to create my own Agent ? Wich respect the doc agent-api here : 
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/doc/agent-api.txt

Why can't I use the IWD agent which iwctl use ?

Thanks

> 
> Thanks,
> James
> 
> >
> > Thanks in advance
> >
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: No Agent registered when calling Connect method
  2023-03-24  9:42   ` clement.legoffic
@ 2023-03-24 15:13     ` James Prestwood
  2023-03-27  7:16       ` clement.legoffic
  0 siblings, 1 reply; 6+ messages in thread
From: James Prestwood @ 2023-03-24 15:13 UTC (permalink / raw)
  To: clement.legoffic, iwd

On Fri, 2023-03-24 at 09:42 +0000, clement.legoffic@kelio.com wrote:
> Hi,
> 
> Thank you for your answer !
> 
> > Hi,
> > 
> > On Thu, 2023-03-23 at 09:52 +0000,
> > clement.legoffic@kelio.com wrote:
> > > Hello,
> > > 
> > > I want to connect to a psk network using iwd D-BUS interface.
> > > I am using IWD version 1.25 with sytemd.
> > > To call D-BUS method I use busctl.
> > 
> > I think using busctl for an agent is likely the problem. An agent
> > for IWD is a
> > DBus service, so it must be running and able to accept incoming
> > requests
> > for passphrase/usernames etc.
> 
> Ok I understand.
> 
> > 
> > > My actions are :
> > > 
> > > Scan for networks :
> > > busctl call net.connman.iwd /net/connman/iwd/0/6
> > > net.connman.iwd.Station Scan
> > > 
> > > Register an agent :
> > > busctl call net.connman.iwd /net/connman/iwd
> > > net.connman.iwd.AgentManager RegisterAgent o /test/agent/1234
> > > 
> > > Call Connect method my object Interface busctl call
> > > net.connman.iwd
> > > /net/connman/iwd/0/6/Xxxxx net.connman.iwd.Network Connect
> > > 
> > > But I get the error :
> > > Call failed: No Agent registered
> > > 
> > > So I restart iwd deamon with debug output and try to connect to
> > > my
> > > network using iwctl iwctl station wlan0 connect SSID
> > > 
> > > IWD debug output with the iwctl command is :
> > > src/agent.c:agent_register() agent register called
> > > src/agent.c:agent_register() agent :1.71 path /agent/471
> > > src/network.c:network_connect()
> > > src/network.c:network_connect_psk() ask_passphrase: true
> > > src/agent.c:agent_request_passphrase() agent 0xb9ca8 owner :1.71
> > > path
> > > /agent/471
> > > src/agent.c:agent_send_next_request() send request to :1.71
> > > /agent/471
> > > src/agent.c:agent_receive_reply() agent 0xb9ca8 request id 22
> > > src/network.c:passphrase_callback() result 0
> > > 
> > > And I get connected
> > > 
> > > Whereas the debug output using the D-BUS Call is :
> > > src/agent.c:agent_register() agent register called
> > > src/agent.c:agent_register() agent :1.78 path /test/agent/1234
> > > src/agent.c:agent_disconnect() agent :1.78 disconnected
> > > src/agent.c:agent_free() agent free 0xbb1a0
> > > src/network.c:network_connect()
> > > src/network.c:network_connect_psk() ask_passphrase: true
> > > 
> > > And I'm not able to connect to my network/
> > > 
> > > We can observe that the agent disconnect before the
> > > network_connect(),
> > > Is it a normal behaviour ?
> > > 
> > > So my question is how to use the RegisterAgent method in order to
> > > connect to a psk Network with DBUS ?
> > 
> > IWD has a simple agent service written in Python for reference:
> > https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/test/simple
> > -
> > agent
> 
> I have read this code but maybe not understand it.
> Does I need to create my own Agent ? Wich respect the doc agent-api
> here : 
> https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/doc/agent-api.txt
> 
> Why can't I use the IWD agent which iwctl use ?

You can use iwctl as the agent, and you already did this to connect
above. What's the problem doing it this way?

Thanks,
Jame

> 
> Thanks
> 
> > 
> > Thanks,
> > James
> > 
> > > 
> > > Thanks in advance
> > > 
> > > 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: No Agent registered when calling Connect method
  2023-03-24 15:13     ` James Prestwood
@ 2023-03-27  7:16       ` clement.legoffic
  2023-04-05 10:26         ` Joakim Lotsengård
  0 siblings, 1 reply; 6+ messages in thread
From: clement.legoffic @ 2023-03-27  7:16 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi,

> On Fri, 2023-03-24 at 09:42 +0000, clement.legoffic@kelio.com wrote:
> > Hi,
> >
> > Thank you for your answer !
> >
> > > Hi,
> > >
> > > On Thu, 2023-03-23 at 09:52 +0000,
> > > clement.legoffic@kelio.com wrote:
> > > > Hello,
> > > >
> > > > I want to connect to a psk network using iwd D-BUS interface.
> > > > I am using IWD version 1.25 with sytemd.
> > > > To call D-BUS method I use busctl.
> > >
> > > I think using busctl for an agent is likely the problem. An agent
> > > for IWD is a DBus service, so it must be running and able to accept
> > > incoming requests for passphrase/usernames etc.
> >
> > Ok I understand.
> >
> > >
> > > > My actions are :
> > > >
> > > > Scan for networks :
> > > > busctl call net.connman.iwd /net/connman/iwd/0/6
> > > > net.connman.iwd.Station Scan
> > > >
> > > > Register an agent :
> > > > busctl call net.connman.iwd /net/connman/iwd
> > > > net.connman.iwd.AgentManager RegisterAgent o /test/agent/1234
> > > >
> > > > Call Connect method my object Interface busctl call
> > > > net.connman.iwd /net/connman/iwd/0/6/Xxxxx
> net.connman.iwd.Network
> > > > Connect
> > > >
> > > > But I get the error :
> > > > Call failed: No Agent registered
> > > >
> > > > So I restart iwd deamon with debug output and try to connect to my
> > > > network using iwctl iwctl station wlan0 connect SSID
> > > >
> > > > IWD debug output with the iwctl command is :
> > > > src/agent.c:agent_register() agent register called
> > > > src/agent.c:agent_register() agent :1.71 path /agent/471
> > > > src/network.c:network_connect()
> > > > src/network.c:network_connect_psk() ask_passphrase: true
> > > > src/agent.c:agent_request_passphrase() agent 0xb9ca8 owner :1.71
> > > > path
> > > > /agent/471
> > > > src/agent.c:agent_send_next_request() send request to :1.71
> > > > /agent/471
> > > > src/agent.c:agent_receive_reply() agent 0xb9ca8 request id 22
> > > > src/network.c:passphrase_callback() result 0
> > > >
> > > > And I get connected
> > > >
> > > > Whereas the debug output using the D-BUS Call is :
> > > > src/agent.c:agent_register() agent register called
> > > > src/agent.c:agent_register() agent :1.78 path /test/agent/1234
> > > > src/agent.c:agent_disconnect() agent :1.78 disconnected
> > > > src/agent.c:agent_free() agent free 0xbb1a0
> > > > src/network.c:network_connect()
> > > > src/network.c:network_connect_psk() ask_passphrase: true
> > > >
> > > > And I'm not able to connect to my network/
> > > >
> > > > We can observe that the agent disconnect before the
> > > > network_connect(), Is it a normal behaviour ?
> > > >
> > > > So my question is how to use the RegisterAgent method in order to
> > > > connect to a psk Network with DBUS ?
> > >
> > > IWD has a simple agent service written in Python for reference:
> > > https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/test/si
> > > mple
> > > -
> > > agent
> >
> > I have read this code but maybe not understand it.
> > Does I need to create my own Agent ? Wich respect the doc agent-api
> > here :
> > https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/doc/agent
> > -api.txt
> >
> > Why can't I use the IWD agent which iwctl use ?
> 
> You can use iwctl as the agent, and you already did this to connect above.
> What's the problem doing it this way?

Actually it is not a problem, I just want to only use the IWD D-BUS interface in order to connect to a WPA2 Network.
My use of iwctl is here to confirm It can works.
I need to register a Agent in order to calculate the PSK to make the ssid.psk config file but I cannot figure out how Agent registering works.
What I understand in the python example is that I should create my own Agent, that implements the same method and properties form the documentation. 
And so I was wondering if only for test purposes I can be able to use the iwctl Agent in order to connect to my WPA2 network.

Thanks,
Clément

> 
> Thanks,
> Jame
> 
> >
> > Thanks
> >
> > >
> > > Thanks,
> > > James
> > >
> > > >
> > > > Thanks in advance
> > > >
> > > >
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: No Agent registered when calling Connect method
  2023-03-27  7:16       ` clement.legoffic
@ 2023-04-05 10:26         ` Joakim Lotsengård
  0 siblings, 0 replies; 6+ messages in thread
From: Joakim Lotsengård @ 2023-04-05 10:26 UTC (permalink / raw)
  To: clement.legoffic; +Cc: iwd

Hi,

On Mon, 27 Mar 2023 at 09:24, clement.legoffic@kelio.com
<clement.legoffic@kelio.com> wrote:
> > >
> > > Why can't I use the IWD agent which iwctl use ?
> >
> > You can use iwctl as the agent, and you already did this to connect above.
> > What's the problem doing it this way?
>
> Actually it is not a problem, I just want to only use the IWD D-BUS interface in order to connect to a WPA2 Network.
> My use of iwctl is here to confirm It can works.
> I need to register a Agent in order to calculate the PSK to make the ssid.psk config file but I cannot figure out how Agent registering works.
> What I understand in the python example is that I should create my own Agent, that implements the same method and properties form the documentation.
> And so I was wondering if only for test purposes I can be able to use the iwctl Agent in order to connect to my WPA2 network.
>

If it helps you, we have written an MIT-licensed iwd_client lib, based
on libell for DBUS. Written in C. It is intended to be used by some
stand alone device (embedded device) to scan and configure SSID+WPA
PSK from some daemon. In our case it is over a bluetooth connection.
Sadly, it is only half of the daemon we have for this, so there is no
example, nor any more documentation than the code itself. I can't
support you with it. Code is below to use as you want. It has a basic
iwd_client_connect("ssid", "key") and handles agenting in the
background. It does need the libell mainloop to be running.

https://github.com/orbital-systems/iwd_client

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-05 10:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23  9:52 No Agent registered when calling Connect method clement.legoffic
2023-03-23 23:02 ` James Prestwood
2023-03-24  9:42   ` clement.legoffic
2023-03-24 15:13     ` James Prestwood
2023-03-27  7:16       ` clement.legoffic
2023-04-05 10:26         ` Joakim Lotsengård

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).