diff mbox series

[bug#60752] services: connman: Add iwd backend support.

Message ID 874jsvc3ms.fsf@riseup.net
State New
Headers show
Series [bug#60752] services: connman: Add iwd backend support. | expand

Commit Message

Declan Tsien Jan. 12, 2023, 12:56 p.m. UTC

Comments

Bruno Victal Jan. 12, 2023, 2:12 p.m. UTC | #1
Hi,

Does connman absolutely require a wireless adapter backend?
IMO if that's not the case, neither iwd nor wpa-supplicant backends should be pulled by connman. (or at least they should be required only if they are present among the services field)
This is because not every machine comes or wants to use a wireless adapter.


Cheers,
Bruno
Declan Tsien Jan. 12, 2023, 2:31 p.m. UTC | #2
Bruno Victal <mirai@makinata.eu> writes:

>
> IMO if that's not the case, neither iwd nor wpa-supplicant backends should be pulled by connman. (or at least they should be required only if they are present among the services field)
> This is because not every machine comes or wants to use a wireless adapter.
>

Right, are you suggesting removing wpa-supplicant from requirement
field?

Yeah, it would make more sense and fit my needs too.
Bruno Victal Jan. 12, 2023, 2:53 p.m. UTC | #3
On 2023-01-12 14:31, Declan Tsien wrote:
> Bruno Victal <mirai@makinata.eu> writes:
> 
>>
>> IMO if that's not the case, neither iwd nor wpa-supplicant backends should be pulled by connman. (or at least they should be required only if they are present among the services field)
>> This is because not every machine comes or wants to use a wireless adapter.
>>
> 
> Right, are you suggesting removing wpa-supplicant from requirement
> field?

If that's possible, yes.
Declan Tsien Jan. 12, 2023, 3:22 p.m. UTC | #4
Bruno Victal <mirai@makinata.eu> writes:

> On 2023-01-12 14:31, Declan Tsien wrote:
>> Bruno Victal <mirai@makinata.eu> writes:
>> 
>>>
>>> IMO if that's not the case, neither iwd nor wpa-supplicant backends should be pulled by connman. (or at least they should be required only if they are present among the services field)
>>> This is because not every machine comes or wants to use a wireless adapter.
>>>
>> 
>> Right, are you suggesting removing wpa-supplicant from requirement
>> field?
>
> If that's possible, yes.

I think that is a question for people with more knowledge in this regard.

But to my experiencing using connman and iwd. I think it's OK.
Now I am running these two shepherd services separately

- connman (without wpa-supplicant and iwd)
- iwd

This patch can be closed without applying.

Thanks for clarifying things for me.
Declan Tsien Jan. 14, 2023, 1:54 a.m. UTC | #5
Started a new thread since the subject has changed
https://issues.guix.gnu.org/60800
Andrew Tropin Jan. 16, 2023, 5:22 p.m. UTC | #6
On 2023-01-14 09:54, Declan Tsien wrote:

> Started a new thread since the subject has changed
> https://issues.guix.gnu.org/60800

Let's keep the discussion in this thread, not to lose the context.

BTW, there is a retitle command for debbugs in case it necessary to
change the title of the bug. 


From what I see wpa-supplicant requirement is not needed, as Bruno
mentioned, there are use cases, where connman can be used without
wpa-supplicant or wireless backend at all.

According to the documentation I was able to find, to enable iwd support
--wifi=iwd_agent should be added to connmand, so I applied the first
patch with a few adjustments: Completely removed wpa-supplicant
requirement, realigned the code.  Unfortunately, I don't use connman and
can't easily check, Declan, could you please confirm that iwd is now
working correctly with connman?
Declan Tsien Jan. 17, 2023, 12:30 a.m. UTC | #7
Andrew Tropin <andrew@trop.in> writes:

> On 2023-01-14 09:54, Declan Tsien wrote:
>
>> Started a new thread since the subject has changed
>> https://issues.guix.gnu.org/60800
>
> Let's keep the discussion in this thread, not to lose the context.
>
> BTW, there is a retitle command for debbugs in case it necessary to
> change the title of the bug. 
>

Thanks.

>
> From what I see wpa-supplicant requirement is not needed, as Bruno
> mentioned, there are use cases, where connman can be used without
> wpa-supplicant or wireless backend at all.
>
> According to the documentation I was able to find, to enable iwd support
> --wifi=iwd_agent should be added to connmand, so I applied the first
> patch with a few adjustments: Completely removed wpa-supplicant
> requirement, realigned the code.  Unfortunately, I don't use connman and
> can't easily check, Declan, could you please confirm that iwd is now
> working correctly with connman?
>
> -- 
> Best regards,
> Andrew Tropin

Yeah, Its working.

In my case, --wifi=iwd_agent is not required either when using iwd.
But it should be useful when wpa-supplicant and iwd services are both
in the system.

Best regards,
Declan Tsien
diff mbox series

Patch

From d15947bcbfd16b1509df555a2b05a5639dec923a Mon Sep 17 00:00:00 2001
From: Declan Tsien <declantsien@riseup.net>
Date: Thu, 12 Jan 2023 18:37:51 +0800
Subject: [PATCH] services: connman: Add iwd backend support.

* gnu/services/networking.scm (connman-configuration)[iwd?]: New
field.
(connman-shepherd-service): Applied iwd? logic.
* doc/guix.texi: Add information about connman-configuration iwd? option.
---
 doc/guix.texi               |  3 +++
 gnu/services/networking.scm | 13 +++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 751d0957d8..ac483dacb9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19726,6 +19726,9 @@  The connman package to use.
 
 @item @code{disable-vpn?} (default: @code{#f})
 When true, disable connman's vpn plugin.
+
+@item @code{iwd?} (default: @code{#f})
+When true, ConnMan uses iwd to connect to wireless networks.
 @end table
 @end deftp
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 702404bc6c..f24c8f7063 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -19,6 +19,7 @@ 
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2022 Andrew Tropin <andrew@trop.in>
+;;; Copyright © 2022 Declan Tsien <declantsien@riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1265,7 +1266,8 @@  (define-record-type* <connman-configuration>
   (connman      connman-configuration-connman
                 (default connman))
   (disable-vpn? connman-configuration-disable-vpn?
-                (default #f)))
+                (default #f))
+  (iwd? connman-configuration-iwd? (default #f)))
 
 (define (connman-activation config)
   (let ((disable-vpn? (connman-configuration-disable-vpn? config)))
@@ -1281,18 +1283,21 @@  (define (connman-shepherd-service config)
   (and
    (connman-configuration? config)
    (let ((connman      (connman-configuration-connman config))
-         (disable-vpn? (connman-configuration-disable-vpn? config)))
+         (disable-vpn? (connman-configuration-disable-vpn? config))
+         (iwd? (connman-configuration-iwd? config)))
      (list (shepherd-service
             (documentation "Run Connman")
             (provision '(networking))
             (requirement
-             '(user-processes dbus-system loopback wpa-supplicant))
+             (append '(user-processes dbus-system loopback)
+                     (if iwd? '(iwd) '(wpa-supplicant))))
             (start #~(make-forkexec-constructor
                       (list (string-append #$connman
                                            "/sbin/connmand")
                             "--nodaemon"
                             "--nodnsproxy"
-                            #$@(if disable-vpn? '("--noplugin=vpn") '()))
+                            #$@(if disable-vpn? '("--noplugin=vpn") '())
+                            #$@(if iwd? '("--wifi=iwd_agent") '()))
 
                       ;; As connman(8) notes, when passing '-n', connman
                       ;; "directs log output to the controlling terminal in
-- 
2.38.1