connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* request for feature
@ 2022-03-03 22:41 KeithG
  2022-03-04  9:11 ` Daniel Wagner
  0 siblings, 1 reply; 10+ messages in thread
From: KeithG @ 2022-03-03 22:41 UTC (permalink / raw)
  To: connman

Group,

iwd has recently added a feature which can allow headless wireless
configuration:

client: add AP scanning support to iwctl

Would it be acceptable or possible to add the possibility to do a
'connmanctl scan' when iwd is configured as AP? Currently, connman
does not work with iwd in this mode. This addition would allow us to
ditch hostapd for the headless music player we are working on.
Currently we use connman with iwd for normal connections, but when we
are trying to do headless wireless configuration, we fire up
hostapd/dnsmasq. We would like to just use connman and iwd if
possible.

Keith

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

* Re: request for feature
  2022-03-03 22:41 request for feature KeithG
@ 2022-03-04  9:11 ` Daniel Wagner
  2022-03-04  9:13   ` Daniel Wagner
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Wagner @ 2022-03-04  9:11 UTC (permalink / raw)
  To: KeithG; +Cc: connman

On Thu, Mar 03, 2022 at 04:41:36PM -0600, KeithG wrote:
> Group,
> 
> iwd has recently added a feature which can allow headless wireless
> configuration:
> 
> client: add AP scanning support to iwctl
> 
> Would it be acceptable or possible to add the possibility to do a
> 'connmanctl scan' when iwd is configured as AP? Currently, connman
> does not work with iwd in this mode. This addition would allow us to
> ditch hostapd for the headless music player we are working on.
> Currently we use connman with iwd for normal connections, but when we
> are trying to do headless wireless configuration, we fire up
> hostapd/dnsmasq. We would like to just use connman and iwd if
> possible.

plugins/iwd.c:cm_device_scan() needs to be extended to use the new iwd
API net.connman.iwd.AccessPoint Scan(). Shouldn't be too complex to do.

Completely untested:

diff --git a/plugins/iwd.c b/plugins/iwd.c
index ee3ed83e5957..0704945d3e88 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -591,7 +591,7 @@ static int cm_device_disable(struct connman_device *device)
 	return set_device_powered(device, false);
 }
 
-static void cm_device_scan_cb(DBusMessage *message, void *user_data)
+static void cm_device_scan_station_cb(DBusMessage *message, void *user_data)
 {
 	const char *path = user_data;
 	struct iwd_station *iwds;
@@ -607,22 +607,52 @@ static void cm_device_scan_cb(DBusMessage *message, void *user_data)
 	}
 }
 
+static void cm_device_scan_ap_cb(DBusMessage *message, void *user_data)
+{
+	const char *path = user_data;
+	struct iwd_ap *iwdap;
+
+	iwdap = g_hash_table_lookup(access_points, path);
+	if (!iwdap)
+		return;
+
+	if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR) {
+		const char *dbus_error = dbus_message_get_error_name(message);
+
+		DBG("%s scan failed: %s", path, dbus_error);
+	}
+}
+
 static int cm_device_scan(struct connman_device *device,
 				struct connman_device_scan_params *params)
 {
 	struct iwd_device *iwdd = connman_device_get_data(device);
-	struct iwd_station *iwds;
 
-	if (strcmp(iwdd->mode, "station"))
-		return -EINVAL;
+	if (strcmp(iwdd->mode, "station")) {
+		struct iwd_station *iwds;
 
-	iwds = g_hash_table_lookup(stations, iwdd->path);
-	if (!iwds)
-		return -EIO;
+		iwds =	g_hash_table_lookup(stations, iwdd->path);
+		if (!iwds)
+			return -EIO;
 
-	if (!g_dbus_proxy_method_call(iwds->proxy, "Scan",
-			NULL, cm_device_scan_cb, g_strdup(iwds->path), g_free))
-		return -EIO;
+		if (!g_dbus_proxy_method_call(iwds->proxy, "Scan",
+				NULL, cm_device_scan_station_cb,
+				g_strdup(iwds->path), g_free))
+			return -EIO;
+	} else if (strcmp(iwdd->mode, "AP")) {
+		struct iwd_ap *iwdap;
+
+		iwdap = g_hash_table_lookup(access_points, iwdd->path);
+		if (!iwdap)
+			return -EIO;
+
+		if (!g_dbus_proxy_method_call(iwdap->proxy, "Scan",
+				NULL, cm_device_scan_ap_cb,
+				g_strdup(iwdap->path), g_free))
+			return -EIO;
+	} else {
+		return -EINVAL;
+	}
 
 	return -EINPROGRESS;
 }

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

* Re: request for feature
  2022-03-04  9:11 ` Daniel Wagner
@ 2022-03-04  9:13   ` Daniel Wagner
  2022-03-04 15:22     ` KeithG
  2022-03-07  9:06     ` Daniel Wagner
  0 siblings, 2 replies; 10+ messages in thread
From: Daniel Wagner @ 2022-03-04  9:13 UTC (permalink / raw)
  To: KeithG; +Cc: connman

On Fri, Mar 04, 2022 at 10:11:07AM +0100, Daniel Wagner wrote:
>  static int cm_device_scan(struct connman_device *device,
>  				struct connman_device_scan_params *params)
>  {
>  	struct iwd_device *iwdd = connman_device_get_data(device);
> -	struct iwd_station *iwds;
>  
> -	if (strcmp(iwdd->mode, "station"))
> -		return -EINVAL;
> +	if (strcmp(iwdd->mode, "station")) {

obviously !strcmp()

> +		struct iwd_station *iwds;
>  
> -	iwds = g_hash_table_lookup(stations, iwdd->path);
> -	if (!iwds)
> -		return -EIO;
> +		iwds =	g_hash_table_lookup(stations, iwdd->path);
> +		if (!iwds)
> +			return -EIO;
>  
> -	if (!g_dbus_proxy_method_call(iwds->proxy, "Scan",
> -			NULL, cm_device_scan_cb, g_strdup(iwds->path), g_free))
> -		return -EIO;
> +		if (!g_dbus_proxy_method_call(iwds->proxy, "Scan",
> +				NULL, cm_device_scan_station_cb,
> +				g_strdup(iwds->path), g_free))
> +			return -EIO;
> +	} else if (strcmp(iwdd->mode, "AP")) {

and here too

> +		struct iwd_ap *iwdap;
> +
> +		iwdap = g_hash_table_lookup(access_points, iwdd->path);
> +		if (!iwdap)
> +			return -EIO;
> +
> +		if (!g_dbus_proxy_method_call(iwdap->proxy, "Scan",
> +				NULL, cm_device_scan_ap_cb,
> +				g_strdup(iwdap->path), g_free))
> +			return -EIO;
> +	} else {
> +		return -EINVAL;
> +	}
>  
>  	return -EINPROGRESS;
>  }

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

* Re: request for feature
  2022-03-04  9:13   ` Daniel Wagner
@ 2022-03-04 15:22     ` KeithG
  2022-03-04 15:41       ` Daniel Wagner
  2022-03-07  9:06     ` Daniel Wagner
  1 sibling, 1 reply; 10+ messages in thread
From: KeithG @ 2022-03-04 15:22 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: connman

Made those 2 edits, built a package and will test it tonight.

Thanks!

Keith
On Fri, Mar 4, 2022 at 3:13 AM Daniel Wagner <wagi@monom.org> wrote:
>
> On Fri, Mar 04, 2022 at 10:11:07AM +0100, Daniel Wagner wrote:
> >  static int cm_device_scan(struct connman_device *device,
> >                               struct connman_device_scan_params *params)
> >  {
> >       struct iwd_device *iwdd = connman_device_get_data(device);
> > -     struct iwd_station *iwds;
> >
> > -     if (strcmp(iwdd->mode, "station"))
> > -             return -EINVAL;
> > +     if (strcmp(iwdd->mode, "station")) {
>
> obviously !strcmp()
>
> > +             struct iwd_station *iwds;
> >
> > -     iwds = g_hash_table_lookup(stations, iwdd->path);
> > -     if (!iwds)
> > -             return -EIO;
> > +             iwds =  g_hash_table_lookup(stations, iwdd->path);
> > +             if (!iwds)
> > +                     return -EIO;
> >
> > -     if (!g_dbus_proxy_method_call(iwds->proxy, "Scan",
> > -                     NULL, cm_device_scan_cb, g_strdup(iwds->path), g_free))
> > -             return -EIO;
> > +             if (!g_dbus_proxy_method_call(iwds->proxy, "Scan",
> > +                             NULL, cm_device_scan_station_cb,
> > +                             g_strdup(iwds->path), g_free))
> > +                     return -EIO;
> > +     } else if (strcmp(iwdd->mode, "AP")) {
>
> and here too
>
> > +             struct iwd_ap *iwdap;
> > +
> > +             iwdap = g_hash_table_lookup(access_points, iwdd->path);
> > +             if (!iwdap)
> > +                     return -EIO;
> > +
> > +             if (!g_dbus_proxy_method_call(iwdap->proxy, "Scan",
> > +                             NULL, cm_device_scan_ap_cb,
> > +                             g_strdup(iwdap->path), g_free))
> > +                     return -EIO;
> > +     } else {
> > +             return -EINVAL;
> > +     }
> >
> >       return -EINPROGRESS;
> >  }

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

* Re: request for feature
  2022-03-04 15:22     ` KeithG
@ 2022-03-04 15:41       ` Daniel Wagner
  2022-03-05  3:48         ` KeithG
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Wagner @ 2022-03-04 15:41 UTC (permalink / raw)
  To: KeithG; +Cc: connman

On Fri, Mar 04, 2022 at 09:22:29AM -0600, KeithG wrote:
> Made those 2 edits, built a package and will test it tonight.

I'll try to give it a go as well.

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

* Re: request for feature
  2022-03-04 15:41       ` Daniel Wagner
@ 2022-03-05  3:48         ` KeithG
  2022-03-07  7:47           ` Daniel Wagner
  0 siblings, 1 reply; 10+ messages in thread
From: KeithG @ 2022-03-05  3:48 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: connman

Daniel,

Is there something else that needs to be set? iwctl will 'scan while
in ap' connmanctl does not, yet.
# iwctl ap wlan0 scan
# iwctl ap wlan0 get-networks
                                    Networks
--------------------------------------------------------------------------------
            Property            Value
--------------------------------------------------------------------------------
            Name                spg2
            SignalStrength      -4000
            Type                psk

            Name                Edventures
            SignalStrength      -5400
            Type                psk

            Name                spg3
            SignalStrength      -5500
            Type                psk
...
# connmanctl technologies
/net/connman/technology/ethernet
  Name = Wired
  Type = ethernet
  Powered = True
  Connected = False
  Tethering = False
  TetheringFreq = 2412
/net/connman/technology/wifi
  Name = WiFi
  Type = wifi
  Powered = True
  Connected = False
  Tethering = False
  TetheringFreq = 2412
/net/connman/technology/bluetooth
  Name = Bluetooth
  Type = bluetooth
  Powered = True
  Connected = False
  Tethering = False
  TetheringFreq = 0
# connmanctl scan wifi
Error /net/connman/technology/wifi: Not supported
# connmanctl services

Keith

On Fri, Mar 4, 2022 at 9:41 AM Daniel Wagner <wagi@monom.org> wrote:
>
> On Fri, Mar 04, 2022 at 09:22:29AM -0600, KeithG wrote:
> > Made those 2 edits, built a package and will test it tonight.
>
> I'll try to give it a go as well.

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

* Re: request for feature
  2022-03-05  3:48         ` KeithG
@ 2022-03-07  7:47           ` Daniel Wagner
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Wagner @ 2022-03-07  7:47 UTC (permalink / raw)
  To: KeithG; +Cc: connman

On Fri, Mar 04, 2022 at 09:48:20PM -0600, KeithG wrote:
> # connmanctl scan wifi
> Error /net/connman/technology/wifi: Not supported

This might be some checks in the core which prevents the
scan.... debugging session ahead...

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

* Re: request for feature
  2022-03-04  9:13   ` Daniel Wagner
  2022-03-04 15:22     ` KeithG
@ 2022-03-07  9:06     ` Daniel Wagner
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Wagner @ 2022-03-07  9:06 UTC (permalink / raw)
  To: KeithG; +Cc: connman

On Fri, Mar 04, 2022 at 10:13:01AM +0100, Daniel Wagner wrote:
> > +	} else if (strcmp(iwdd->mode, "AP")) {
> 
> and here too

and it's "ap" not "AP". I was not able to test it as my USB stick seems
not to support this feature. Though if you issue an scan from the cli it
ends up here and the proxy is called here. So in theory this should work
now. Give the patch I just send out another test run please. Thanks!

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

* Re: Request for feature
  2022-04-12  7:23 Request " Vishwanath Chandapur
@ 2022-04-14 19:03 ` Daniel Wagner
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Wagner @ 2022-04-14 19:03 UTC (permalink / raw)
  To: Vishwanath Chandapur; +Cc: connman

Hi,

On Tue, Apr 12, 2022 at 12:53:17PM +0530, Vishwanath Chandapur wrote:
> Group,
> 
> In the current design of connman, if a client fails to discover a DHCP
> server, it will assign IPV4LL ip address.
> In some systems it is not desirable.
> 
> Hence it will be good to have a runtime config like "fallback-ipv4ll".
> 
> Please let me know your feedback so I can create a patch for this?

It's not the first time hearing this. Sure, though I would like to see
that the config option can be oversteered via the D-Bus API.

Thanks,
Daniel

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

* Request for feature
@ 2022-04-12  7:23 Vishwanath Chandapur
  2022-04-14 19:03 ` Daniel Wagner
  0 siblings, 1 reply; 10+ messages in thread
From: Vishwanath Chandapur @ 2022-04-12  7:23 UTC (permalink / raw)
  To: connman

Group,

In the current design of connman, if a client fails to discover a DHCP
server, it will assign IPV4LL ip address.
In some systems it is not desirable.

Hence it will be good to have a runtime config like "fallback-ipv4ll".

Please let me know your feedback so I can create a patch for this?

With Regards
Vishwa

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

end of thread, other threads:[~2022-04-14 19:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 22:41 request for feature KeithG
2022-03-04  9:11 ` Daniel Wagner
2022-03-04  9:13   ` Daniel Wagner
2022-03-04 15:22     ` KeithG
2022-03-04 15:41       ` Daniel Wagner
2022-03-05  3:48         ` KeithG
2022-03-07  7:47           ` Daniel Wagner
2022-03-07  9:06     ` Daniel Wagner
2022-04-12  7:23 Request " Vishwanath Chandapur
2022-04-14 19:03 ` Daniel Wagner

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).