Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. Re: [PATCH] Add 'DefaultFavoriteTechnologies' to settings
(Daniel Wagner)
2. Re: [PATCH 1/2] rtnl: Bail out if interface name is
blacklisted (Daniel Wagner)
3. Re: [PATCH 2/2] wifi: Make wfd_service_registered variable
static (Daniel Wagner)
4. Re: [PATCH 1/3] README: mention address conflict detection,
RFC 5227 (Daniel Wagner)
5. [PATCH v2 1/3] Add macro to determine configuration array
size (Ryan Schaefer)
6. [PATCH v2 2/3] From: Ryan Schaefer
<[email protected]> (Ryan Schaefer)
----------------------------------------------------------------------
Message: 1
Date: Mon, 4 Jun 2018 07:51:00 +0200
From: Daniel Wagner <[email protected]>
To: Ryan Schaefer <[email protected]>, [email protected]
Subject: Re: [PATCH] Add 'DefaultFavoriteTechnologies' to settings
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi Ryan,
Sorry it took a bit longer to get a chance to look at your patch. Please
inline your patch next time, it makes the reviewing a bit easier. 'git
send-email' is quite handy for that job.
> From 21a5b034de25f12d9b0cd2dcb3a29c6c160ac583 Mon Sep 17 00:00:00 2001
> From: Ryan Schaefer <[email protected]>
> Date: Thu, 24 May 2018 09:22:47 -0700
> Subject: [PATCH] Add 'DefaultFavoriteTechnologies' to settings
>
> This setting can be used to enable other technologies (namely usb
> gadget clients) to be connected to automatically on start.
>
> Signed-off-by: Ryan Schaefer <[email protected]>
We don't do SoB in this project.
> ---
> doc/connman.conf.5.in | 6 ++++++
> plugins/gadget.c | 4 ++++
> src/main.c | 24 ++++++++++++++++++++++++
> src/service.c | 24 +++++++++---------------
> 4 files changed, 43 insertions(+), 15 deletions(-)
>
> diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
> index 95b177f..66cdfff 100644
> --- a/doc/connman.conf.5.in
> +++ b/doc/connman.conf.5.in
> @@ -67,6 +67,12 @@ for this entry when empty is ethernet,wifi,cellular.
> Services that are automatically connected must have been
> set up and saved to storage beforehand.
> .TP
> +.BI DefaultFavoriteTechnologies= technology\fR[,...]
> +List of technologies that are marked favorite by default,
> +separated by commas ",". The default value for this entry
> +when empty is ethernet. Connects to services from this
> +technology even if not setup and saved to storage.
> +.TP
> .BI AlwaysConnectedTechnologies= technology\fR[,...]
> List of technoolgies which are always connected regardless
> of PreferredTechnologies setting (AutoConnect = true). The
> diff --git a/plugins/gadget.c b/plugins/gadget.c
> index 94f6648..1b44bbb 100644
> --- a/plugins/gadget.c
> +++ b/plugins/gadget.c
> @@ -270,6 +270,8 @@ static void gadget_tech_enable_tethering(struct
> connman_technology *technology,
> connman_inet_ifup(index);
>
> connman_inet_add_to_bridge(index, bridge);
> +
> + gadget_tethering = true;
This looks like it should go into a patch of its own, explaining what
you fix.
> }
> }
>
> @@ -286,6 +288,8 @@ static void gadget_tech_disable_tethering(struct
> connman_technology *technology,
> connman_inet_ifdown(index);
>
> connman_technology_tethering_notify(technology, false);
> +
> + gadget_tethering = false;
see above.
> }
> }
>
> diff --git a/src/main.c b/src/main.c
> index 3e6449a..a443e10 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -52,6 +52,11 @@ static char *default_auto_connect[] = {
> NULL
> };
>
> +static char *default_favorite[] = {
> + "ethernet",
> + NULL
> +};
> +
Since we have preferred_techs as name I would say you should also use
the same name pattern, that is default_favorite_techs in the above example.
> static char *default_blacklist[] = {
> "vmnet",
> "vboxnet",
> @@ -66,6 +71,7 @@ static struct {
> bool bg_scan;
> char **pref_timeservers;
> unsigned int *auto_connect;
> + unsigned int *favorite;
and here. I stop now repeating myself :)
> unsigned int *preferred_techs;
> unsigned int *always_connected_techs;
> char **fallback_nameservers;
> @@ -83,6 +89,7 @@ static struct {
> .bg_scan = true,
> .pref_timeservers = NULL,
> .auto_connect = NULL,
> + .favorite = NULL,
> .preferred_techs = NULL,
> .always_connected_techs = NULL,
> .fallback_nameservers = NULL,
> @@ -101,6 +108,7 @@ static struct {
> #define CONF_BG_SCAN "BackgroundScanning"
> #define CONF_PREF_TIMESERVERS "FallbackTimeservers"
> #define CONF_AUTO_CONNECT "DefaultAutoConnectTechnologies"
> +#define CONF_FAVORITE "DefaultFavoriteTechnologies"
> #define CONF_ALWAYS_CONNECTED_TECHS "AlwaysConnectedTechnologies"
> #define CONF_PREFERRED_TECHS "PreferredTechnologies"
> #define CONF_FALLBACK_NAMESERVERS "FallbackNameservers"
> @@ -261,6 +269,8 @@ static void parse_config(GKeyFile *config)
> if (!config) {
> connman_settings.auto_connect =
> parse_service_types(default_auto_connect, 3);
> + connman_settings.favorite =
> + parse_service_types(default_favorite, 1);
I do not like the open code length of the NULL terminate array. Maybe a
macro would help
#define CONF_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]) - 1)
> connman_settings.blacklisted_interfaces =
> g_strdupv(default_blacklist);
> return;
> @@ -292,6 +302,16 @@ static void parse_config(GKeyFile *config)
> connman_settings.auto_connect =
> parse_service_types(default_auto_connect, 3);
>
> + str_list = __connman_config_get_string_list(config, "General",
> + CONF_FAVORITE, &len, &error);
> +
> + if (!error)
> + connman_settings.favorite =
> + parse_service_types(str_list, len);
> + else
> + connman_settings.favorite =
> + parse_service_types(default_favorite, 1);
> +
> g_strfreev(str_list);
>
> g_clear_error(&error);
> @@ -631,6 +651,9 @@ unsigned int *connman_setting_get_uint_list(const char
> *key)
> if (g_str_equal(key, CONF_AUTO_CONNECT))
> return connman_settings.auto_connect;
>
> + if (g_str_equal(key, CONF_FAVORITE))
> + return connman_settings.favorite;
> +
> if (g_str_equal(key, CONF_PREFERRED_TECHS))
> return connman_settings.preferred_techs;
>
> @@ -822,6 +845,7 @@ int main(int argc, char *argv[])
> g_strfreev(connman_settings.pref_timeservers);
>
> g_free(connman_settings.auto_connect);
> + g_free(connman_settings.favorite);
> g_free(connman_settings.preferred_techs);
> g_strfreev(connman_settings.fallback_nameservers);
> g_strfreev(connman_settings.blacklisted_interfaces);
> diff --git a/src/service.c b/src/service.c
> index 2289d54..e87355c 100644
> --- a/src/service.c
> +++ b/src/service.c
> @@ -6944,7 +6944,7 @@ struct connman_service *
> __connman_service_create_from_network(struct connman_ne
> struct connman_device *device;
> const char *ident, *group;
> char *name;
> - unsigned int *auto_connect_types;
> + unsigned int *auto_connect_types, *favorite_types;
> int i, index;
>
> DBG("network %p", network);
> @@ -6989,20 +6989,14 @@ struct connman_service *
> __connman_service_create_from_network(struct connman_ne
> }
> }
>
> - switch (service->type) {
> - case CONNMAN_SERVICE_TYPE_UNKNOWN:
> - case CONNMAN_SERVICE_TYPE_SYSTEM:
> - case CONNMAN_SERVICE_TYPE_BLUETOOTH:
> - case CONNMAN_SERVICE_TYPE_GPS:
> - case CONNMAN_SERVICE_TYPE_VPN:
> - case CONNMAN_SERVICE_TYPE_GADGET:
> - case CONNMAN_SERVICE_TYPE_WIFI:
> - case CONNMAN_SERVICE_TYPE_CELLULAR:
> - case CONNMAN_SERVICE_TYPE_P2P:
> - break;
> - case CONNMAN_SERVICE_TYPE_ETHERNET:
> - service->favorite = true;
> - break;
> + favorite_types =
> connman_setting_get_uint_list("DefaultFavoriteTechnologies");
Is it possible that favority_types could be a NULL pointer? The
corresponding code for preferred technologies at least tests the pointer
first before using it.
> + service->favorite = false;
> + for (i = 0; favorite_types &&
> + favorite_types[i] != 0; i++) {
Just keep the above in the same line. The preferred technology code
snippet has the same formatting issue, it is a left over where we
dropped some of the bool testing redundancy from the code base. No need
to make it the standard pattern :)
> + if (service->type == favorite_types[i]) {
> + service->favorite = true;
> + break;
> + }
> }
>
> service->state_ipv4 = service->state_ipv6 = CONNMAN_SERVICE_STATE_IDLE;
Thanks,
Daniel
------------------------------
Message: 2
Date: Mon, 4 Jun 2018 08:02:58 +0200
From: Daniel Wagner <[email protected]>
To: Peter Meerwald-Stadler <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 1/2] rtnl: Bail out if interface name is
blacklisted
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Hi Peter,
On Wed, May 30, 2018 at 12:29:52AM +0200, Peter Meerwald-Stadler wrote:
> blacklisting an interface doesn't work for me after
> commit d81f21e3 (rtnl: retry to add ether interface after renaming)
Can you eleborate a bit what's going on, expecially on the interaction
with the commit you mentioned?
> Signed-off-by: Peter Meerwald-Stadler <[email protected]>
We still don't do SoB :)
> ---
> src/rtnl.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/rtnl.c b/src/rtnl.c
> index 8080ff01..cba5ef7a 100644
> --- a/src/rtnl.c
> +++ b/src/rtnl.c
> @@ -127,6 +127,7 @@ static void read_uevent(struct interface_data *interface)
> if (ether_blacklisted(name)) {
> interface->service_type = CONNMAN_SERVICE_TYPE_UNKNOWN;
> interface->device_type = CONNMAN_DEVICE_TYPE_UNKNOWN;
> + goto out;
> } else {
> interface->service_type = CONNMAN_SERVICE_TYPE_ETHERNET;
> interface->device_type = CONNMAN_DEVICE_TYPE_ETHERNET;
Thanks,
Daniel
------------------------------
Message: 3
Date: Mon, 4 Jun 2018 08:05:06 +0200
From: Daniel Wagner <[email protected]>
To: Peter Meerwald-Stadler <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 2/2] wifi: Make wfd_service_registered variable
static
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Hi Peter,
On Wed, May 30, 2018 at 12:29:53AM +0200, Peter Meerwald-Stadler wrote:
> Signed-off-by: Peter Meerwald-Stadler <[email protected]>
> ---
> plugins/wifi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/plugins/wifi.c b/plugins/wifi.c
> index dc08c6af..5b050469 100644
> --- a/plugins/wifi.c
> +++ b/plugins/wifi.c
> @@ -167,7 +167,7 @@ static GList *iface_list = NULL;
>
> static GList *pending_wifi_device = NULL;
> static GList *p2p_iface_list = NULL;
> -bool wfd_service_registered = false;
> +static bool wfd_service_registered = false;
>
> static void start_autoscan(struct connman_device *device);
> static int tech_set_tethering(struct connman_technology *technology,
Patch applied.
Thanks,
Daniel
------------------------------
Message: 4
Date: Mon, 4 Jun 2018 08:05:42 +0200
From: Daniel Wagner <[email protected]>
To: Peter Meerwald-Stadler <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 1/3] README: mention address conflict detection,
RFC 5227
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Hi Peter,
All three patches applied.
Thanks,
Daniel
------------------------------
Message: 5
Date: Mon, 4 Jun 2018 10:37:29 -0700
From: Ryan Schaefer <[email protected]>
To: [email protected], [email protected]
Cc: Ryan Schaefer <[email protected]>
Subject: [PATCH v2 1/3] Add macro to determine configuration array
size
Message-ID:
<[email protected]>
From: Ryan Schaefer <[email protected]>
---
src/main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
index 5c732ae..e22d8b2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -62,6 +62,8 @@ static char *default_blacklist[] = {
NULL
};
+#define CONF_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]) - 1)
+
static struct {
bool bg_scan;
char **pref_timeservers;
@@ -272,7 +274,7 @@ static void parse_config(GKeyFile *config)
if (!config) {
connman_settings.auto_connect =
- parse_service_types(default_auto_connect, 3);
+ parse_service_types(default_auto_connect,
CONF_ARRAY_SIZE(default_auto_connect));
connman_settings.blacklisted_interfaces =
g_strdupv(default_blacklist);
return;
@@ -302,7 +304,7 @@ static void parse_config(GKeyFile *config)
parse_service_types(str_list, len);
else
connman_settings.auto_connect =
- parse_service_types(default_auto_connect, 3);
+ parse_service_types(default_auto_connect,
CONF_ARRAY_SIZE(default_auto_connect));
g_strfreev(str_list);
--
2.7.4
------------------------------
Message: 6
Date: Mon, 4 Jun 2018 10:37:30 -0700
From: Ryan Schaefer <[email protected]>
To: [email protected], [email protected]
Cc: Ryan Schaefer <[email protected]>
Subject: [PATCH v2 2/3] From: Ryan Schaefer
<[email protected]>
Message-ID:
<[email protected]>
From: Ryan Schaefer <[email protected]>
This setting can be used to enable other technologies (namely usb
gadget client ethernet devices) to be connected to automatically on
start. Gadget ethernet clients previously do no automatically connect
on boot if the service has not been connected to manually previously.
Additionally, gadget ethernet clients are sometimes assigned random MAC
addresses on boot, so after a reboot, a manually connected gadget
technology will not automatically connect because the service now has a
different name.
See this issue for additional information on random MAC addresses:
https://01.org/jira/browse/CM-57
---
doc/connman.conf.5.in | 6 ++++++
src/main.c | 24 ++++++++++++++++++++++++
src/service.c | 23 ++++++++---------------
3 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
index caf7052..d2c96f6 100644
--- a/doc/connman.conf.5.in
+++ b/doc/connman.conf.5.in
@@ -72,6 +72,12 @@ for this entry when empty is ethernet,wifi,cellular.
Services that are automatically connected must have been
set up and saved to storage beforehand.
.TP
+.BI DefaultFavoriteTechnologies= technology\fR[,...]
+List of technologies that are marked favorite by default,
+separated by commas ",". The default value for this entry
+when empty is ethernet. Connects to services from this
+technology even if not setup and saved to storage.
+.TP
.BI AlwaysConnectedTechnologies= technology\fR[,...]
List of technoolgies which are always connected regardless
of PreferredTechnologies setting (AutoConnect = true). The
diff --git a/src/main.c b/src/main.c
index e22d8b2..f220461 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,6 +52,11 @@ static char *default_auto_connect[] = {
NULL
};
+static char *default_favorite_techs[] = {
+ "ethernet",
+ NULL
+};
+
static char *default_blacklist[] = {
"vmnet",
"vboxnet",
@@ -68,6 +73,7 @@ static struct {
bool bg_scan;
char **pref_timeservers;
unsigned int *auto_connect;
+ unsigned int *favorite_techs;
unsigned int *preferred_techs;
unsigned int *always_connected_techs;
char **fallback_nameservers;
@@ -88,6 +94,7 @@ static struct {
.bg_scan = true,
.pref_timeservers = NULL,
.auto_connect = NULL,
+ .favorite_techs = NULL,
.preferred_techs = NULL,
.always_connected_techs = NULL,
.fallback_nameservers = NULL,
@@ -109,6 +116,7 @@ static struct {
#define CONF_BG_SCAN "BackgroundScanning"
#define CONF_PREF_TIMESERVERS "FallbackTimeservers"
#define CONF_AUTO_CONNECT "DefaultAutoConnectTechnologies"
+#define CONF_FAVORITE "DefaultFavoriteTechnologies"
#define CONF_ALWAYS_CONNECTED_TECHS "AlwaysConnectedTechnologies"
#define CONF_PREFERRED_TECHS "PreferredTechnologies"
#define CONF_FALLBACK_NAMESERVERS "FallbackNameservers"
@@ -275,6 +283,8 @@ static void parse_config(GKeyFile *config)
if (!config) {
connman_settings.auto_connect =
parse_service_types(default_auto_connect,
CONF_ARRAY_SIZE(default_auto_connect));
+ connman_settings.favorite_techs =
+ parse_service_types(default_favorite_techs,
CONF_ARRAY_SIZE(default_favorite_techs));
connman_settings.blacklisted_interfaces =
g_strdupv(default_blacklist);
return;
@@ -306,6 +316,16 @@ static void parse_config(GKeyFile *config)
connman_settings.auto_connect =
parse_service_types(default_auto_connect,
CONF_ARRAY_SIZE(default_auto_connect));
+ str_list = __connman_config_get_string_list(config, "General",
+ CONF_FAVORITE, &len, &error);
+
+ if (!error)
+ connman_settings.favorite_techs =
+ parse_service_types(str_list, len);
+ else
+ connman_settings.favorite_techs =
+ parse_service_types(default_favorite_techs,
CONF_ARRAY_SIZE(default_favorite_techs));
+
g_strfreev(str_list);
g_clear_error(&error);
@@ -684,6 +704,9 @@ unsigned int *connman_setting_get_uint_list(const char *key)
if (g_str_equal(key, CONF_AUTO_CONNECT))
return connman_settings.auto_connect;
+ if (g_str_equal(key, CONF_FAVORITE))
+ return connman_settings.favorite_techs;
+
if (g_str_equal(key, CONF_PREFERRED_TECHS))
return connman_settings.preferred_techs;
@@ -875,6 +898,7 @@ int main(int argc, char *argv[])
g_strfreev(connman_settings.pref_timeservers);
g_free(connman_settings.auto_connect);
+ g_free(connman_settings.favorite_techs);
g_free(connman_settings.preferred_techs);
g_strfreev(connman_settings.fallback_nameservers);
g_strfreev(connman_settings.blacklisted_interfaces);
diff --git a/src/service.c b/src/service.c
index 03bfb7b..4f819a6 100644
--- a/src/service.c
+++ b/src/service.c
@@ -7145,7 +7145,7 @@ struct connman_service *
__connman_service_create_from_network(struct connman_ne
struct connman_device *device;
const char *ident, *group;
char *name;
- unsigned int *auto_connect_types;
+ unsigned int *auto_connect_types, *favorite_types;
int i, index;
DBG("network %p", network);
@@ -7190,20 +7190,13 @@ struct connman_service *
__connman_service_create_from_network(struct connman_ne
}
}
- switch (service->type) {
- case CONNMAN_SERVICE_TYPE_UNKNOWN:
- case CONNMAN_SERVICE_TYPE_SYSTEM:
- case CONNMAN_SERVICE_TYPE_BLUETOOTH:
- case CONNMAN_SERVICE_TYPE_GPS:
- case CONNMAN_SERVICE_TYPE_VPN:
- case CONNMAN_SERVICE_TYPE_GADGET:
- case CONNMAN_SERVICE_TYPE_WIFI:
- case CONNMAN_SERVICE_TYPE_CELLULAR:
- case CONNMAN_SERVICE_TYPE_P2P:
- break;
- case CONNMAN_SERVICE_TYPE_ETHERNET:
- service->favorite = true;
- break;
+ favorite_types =
connman_setting_get_uint_list("DefaultFavoriteTechnologies");
+ service->favorite = false;
+ for (i = 0; favorite_types && favorite_types[i] != 0; i++) {
+ if (service->type == favorite_types[i]) {
+ service->favorite = true;
+ break;
+ }
}
service->state_ipv4 = service->state_ipv6 = CONNMAN_SERVICE_STATE_IDLE;
--
2.7.4
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 32, Issue 1
**************************************