Send connman mailing list submissions to connman@lists.01.org To subscribe or unsubscribe via email, send a message with subject or body 'help' to connman-requ...@lists.01.org
You can reach the person managing the list at connman-ow...@lists.01.org When replying, please edit your Subject line so it is more specific than "Re: Contents of connman digest..." Today's Topics: 1. Re: [PATCH 2/2] wireguard: Copy interfance names obeying lengths rules (Daniel Wagner) 2. [PATCH v1 1/4] service: Remove unused __connman_service_disconnect_all() (Daniel Wagner) 3. [PATCH v1 0/4] Teach autoconnect algorithm native mode (Daniel Wagner) 4. [PATCH v1 2/4] network: Add __connman_network_native_autoconnect() (Daniel Wagner) 5. [PATCH v1 3/4] service: Factor autoconnect trigger code into a new function (Daniel Wagner) 6. [PATCH v1 4/4] service: Teach autoconnect algorithm native mode (Daniel Wagner) 7. WiFi P2P connection (Jupiter) ---------------------------------------------------------------------- Date: Mon, 5 Apr 2021 17:32:43 +0200 From: Daniel Wagner <w...@monom.org> Subject: Re: [PATCH 2/2] wireguard: Copy interfance names obeying lengths rules To: connman@lists.01.org Message-ID: <20210405153243.xjhoeimqpje3h...@beryllium.lan> Content-Type: text/plain; charset=utf-8 On Mon, Apr 05, 2021 at 05:29:43PM +0200, Daniel Wagner wrote: > gcc points out the destination buffer has the same size the specified > bound for the string. > > warning: ‘__builtin_strncpy’ specified bound 16 equals destination size > [-Wstringop-truncation] > > Let's make sure we do not overflow the buffer (should not happen as > the names are provide by the kernel and hence should fit). Patch applied ------------------------------ Date: Mon, 5 Apr 2021 20:34:14 +0200 From: Daniel Wagner <w...@monom.org> Subject: [PATCH v1 1/4] service: Remove unused __connman_service_disconnect_all() To: connman@lists.01.org Cc: Daniel Wagner <w...@monom.org> Message-ID: <20210405183417.1017-2-w...@monom.org> There is no user for this function. Remove it. --- src/connman.h | 1 - src/service.c | 30 ------------------------------ 2 files changed, 31 deletions(-) diff --git a/src/connman.h b/src/connman.h index 898174cbfc03..35dae6223a50 100644 --- a/src/connman.h +++ b/src/connman.h @@ -749,7 +749,6 @@ int __connman_service_indicate_default(struct connman_service *service); int __connman_service_connect(struct connman_service *service, enum connman_service_connect_reason reason); int __connman_service_disconnect(struct connman_service *service); -int __connman_service_disconnect_all(void); void __connman_service_set_active_session(bool enable, GSList *list); void __connman_service_auto_connect(enum connman_service_connect_reason reason); bool __connman_service_remove(struct connman_service *service); diff --git a/src/service.c b/src/service.c index 7dfa89f23164..30f5f64915c6 100644 --- a/src/service.c +++ b/src/service.c @@ -6810,36 +6810,6 @@ int __connman_service_disconnect(struct connman_service *service) return err; } -int __connman_service_disconnect_all(void) -{ - struct connman_service *service; - GSList *services = NULL, *list; - GList *iter; - - DBG(""); - - for (iter = service_list; iter; iter = iter->next) { - service = iter->data; - - if (!is_connected(service->state)) - break; - - services = g_slist_prepend(services, service); - } - - for (list = services; list; list = list->next) { - struct connman_service *service = list->data; - - service->ignore = true; - - __connman_service_disconnect(service); - } - - g_slist_free(services); - - return 0; -} - /** * lookup_by_identifier: * @identifier: service identifier -- 2.30.2 ------------------------------ Date: Mon, 5 Apr 2021 20:34:13 +0200 From: Daniel Wagner <w...@monom.org> Subject: [PATCH v1 0/4] Teach autoconnect algorithm native mode To: connman@lists.01.org Cc: Daniel Wagner <w...@monom.org> Message-ID: <20210405183417.1017-1-w...@monom.org> The iwd plugin support native autoconnect so we need to disable the core autoconnect algorithm in this case. Only lightly tested. I saw some corner case with iwd's autoconnect algorithm. For example there are two network net0 and net1. Both have autoconnect set. iwd connects to net0. Then net0 dissapears and iwd chooses to connect net1. Now user decides to disconnect from net1. After that net0 appears again, iwd doesn't auto connect to it anymore. Daniel Wagner (4): service: Remove unused __connman_service_disconnect_all() network: Add __connman_network_native_autoconnect() service: Factor autoconnect trigger code into a new function service: Teach autoconnect algorithm native mode include/service.h | 1 + src/connman.h | 2 +- src/network.c | 7 +++ src/service.c | 132 ++++++++++++++++++++++++---------------------- 4 files changed, 77 insertions(+), 65 deletions(-) -- 2.30.2 ------------------------------ Date: Mon, 5 Apr 2021 20:34:15 +0200 From: Daniel Wagner <w...@monom.org> Subject: [PATCH v1 2/4] network: Add __connman_network_native_autoconnect() To: connman@lists.01.org Cc: Daniel Wagner <w...@monom.org> Message-ID: <20210405183417.1017-3-w...@monom.org> This function allows to query if the network/transport supports native autoconnect such as iwd. --- src/connman.h | 1 + src/network.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/connman.h b/src/connman.h index 35dae6223a50..c70999c5fbd2 100644 --- a/src/connman.h +++ b/src/connman.h @@ -616,6 +616,7 @@ const char *__connman_network_get_type(struct connman_network *network); const char *__connman_network_get_group(struct connman_network *network); const char *__connman_network_get_ident(struct connman_network *network); bool __connman_network_get_weakness(struct connman_network *network); +bool __connman_network_native_autoconnect(struct connman_network *network); int __connman_config_init(); void __connman_config_cleanup(void); diff --git a/src/network.c b/src/network.c index 256e3b5f1c12..b12bbc091b0c 100644 --- a/src/network.c +++ b/src/network.c @@ -2120,6 +2120,13 @@ int connman_network_set_autoconnect(struct connman_network *network, return network->driver->set_autoconnect(network, autoconnect); } +bool __connman_network_native_autoconnect(struct connman_network *network) +{ + if (!network->driver || !network->driver->set_autoconnect) + return false; + return true; +} + uint16_t connman_network_get_wifi_channel(struct connman_network *network) { return network->wifi.channel; -- 2.30.2 ------------------------------ Date: Mon, 5 Apr 2021 20:34:16 +0200 From: Daniel Wagner <w...@monom.org> Subject: [PATCH v1 3/4] service: Factor autoconnect trigger code into a new function To: connman@lists.01.org Cc: Daniel Wagner <w...@monom.org> Message-ID: <20210405183417.1017-4-w...@monom.org> Let's move the autoconnect code from __conman_service_create_network() into it's own function. This seperates the init/setup code from the autoconnect logic. --- src/service.c | 74 ++++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/src/service.c b/src/service.c index 30f5f64915c6..5bb7f12594ce 100644 --- a/src/service.c +++ b/src/service.c @@ -7337,6 +7337,45 @@ static void update_from_network(struct connman_service *service, service_list_sort(); } +static void trigger_autoconnect(struct connman_service *service) +{ + struct connman_device *device; + + connman_network_set_autoconnect(service->network, + service->favorite && service->autoconnect); + if (service->favorite) { + device = connman_network_get_device(service->network); + if (device && !connman_device_get_scanning(device, + CONNMAN_SERVICE_TYPE_UNKNOWN)) { + + switch (service->type) { + case CONNMAN_SERVICE_TYPE_UNKNOWN: + case CONNMAN_SERVICE_TYPE_SYSTEM: + case CONNMAN_SERVICE_TYPE_P2P: + break; + + case CONNMAN_SERVICE_TYPE_GADGET: + case CONNMAN_SERVICE_TYPE_ETHERNET: + if (service->autoconnect) { + __connman_service_connect(service, + CONNMAN_SERVICE_CONNECT_REASON_AUTO); + break; + } + + /* fall through */ + case CONNMAN_SERVICE_TYPE_BLUETOOTH: + case CONNMAN_SERVICE_TYPE_GPS: + case CONNMAN_SERVICE_TYPE_VPN: + case CONNMAN_SERVICE_TYPE_WIFI: + case CONNMAN_SERVICE_TYPE_CELLULAR: + do_auto_connect(service, + CONNMAN_SERVICE_CONNECT_REASON_AUTO); + break; + } + } + } +} + /** * __connman_service_create_from_network: * @network: network structure @@ -7346,7 +7385,6 @@ static void update_from_network(struct connman_service *service, struct connman_service * __connman_service_create_from_network(struct connman_network *network) { struct connman_service *service; - struct connman_device *device; const char *ident, *group; char *name; unsigned int *auto_connect_types, *favorite_types; @@ -7420,39 +7458,7 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne service_register(service); service_schedule_added(service); - connman_network_set_autoconnect(network, - service->favorite && service->autoconnect); - if (service->favorite) { - device = connman_network_get_device(service->network); - if (device && !connman_device_get_scanning(device, - CONNMAN_SERVICE_TYPE_UNKNOWN)) { - - switch (service->type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - case CONNMAN_SERVICE_TYPE_P2P: - break; - - case CONNMAN_SERVICE_TYPE_GADGET: - case CONNMAN_SERVICE_TYPE_ETHERNET: - if (service->autoconnect) { - __connman_service_connect(service, - CONNMAN_SERVICE_CONNECT_REASON_AUTO); - break; - } - - /* fall through */ - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_CELLULAR: - do_auto_connect(service, - CONNMAN_SERVICE_CONNECT_REASON_AUTO); - break; - } - } - } + trigger_autoconnect(service); __connman_notifier_service_add(service, service->name); -- 2.30.2 ------------------------------ Date: Mon, 5 Apr 2021 20:34:17 +0200 From: Daniel Wagner <w...@monom.org> Subject: [PATCH v1 4/4] service: Teach autoconnect algorithm native mode To: connman@lists.01.org Cc: Daniel Wagner <w...@monom.org> Message-ID: <20210405183417.1017-5-w...@monom.org> When network supports native autoconnnect skip the internal autoconnect algorithm for this network. Introduce for this a new CONNMAN_SERVICE_CONNECT_REASON_NATIVE and track the service connection reason. XXX: Calling connect once at the beginning gets iwd crashing. More Debugging needed. --- include/service.h | 1 + src/service.c | 86 +++++++++++++++++++++++++++++++---------------- 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/include/service.h b/include/service.h index 4a129b49315e..8f6b36b486c0 100644 --- a/include/service.h +++ b/include/service.h @@ -94,6 +94,7 @@ enum connman_service_connect_reason { CONNMAN_SERVICE_CONNECT_REASON_AUTO = 1, CONNMAN_SERVICE_CONNECT_REASON_USER = 2, CONNMAN_SERVICE_CONNECT_REASON_SESSION = 3, + CONNMAN_SERVICE_CONNECT_REASON_NATIVE = 4, }; struct connman_service; diff --git a/src/service.c b/src/service.c index 5bb7f12594ce..c3e6de0bde48 100644 --- a/src/service.c +++ b/src/service.c @@ -195,6 +195,8 @@ static const char *reason2string(enum connman_service_connect_reason reason) return "auto"; case CONNMAN_SERVICE_CONNECT_REASON_SESSION: return "session"; + case CONNMAN_SERVICE_CONNECT_REASON_NATIVE: + return "native"; } return "unknown"; @@ -3490,6 +3492,13 @@ static void do_auto_connect(struct connman_service *service, service->type == CONNMAN_SERVICE_TYPE_WIFI)) return; + /* + * Do not use the builtin auto connect, instead rely on the + * native auto connect feature of the service. + */ + if (service->connect_reason == CONNMAN_SERVICE_CONNECT_REASON_NATIVE) + return; + /* * Run service auto connect for other than VPN services. Afterwards * start also VPN auto connect process. @@ -4215,6 +4224,12 @@ static bool auto_connect_service(GList *services, continue; } + if (service->connect_reason == + CONNMAN_SERVICE_CONNECT_REASON_NATIVE) { + DBG("service %p uses native autonnect, skip", service); + continue; + } + if (service->pending || is_connecting(service->state) || is_connected(service->state)) { @@ -6716,6 +6731,11 @@ int __connman_service_connect(struct connman_service *service, DBG("service %p err %d", service, err); + if (service->autoconnect && + reason == CONNMAN_SERVICE_CONNECT_REASON_USER) { + DBG("service %p switch connecting reason to native", service); + reason = CONNMAN_SERVICE_CONNECT_REASON_NATIVE; + } service->connect_reason = reason; if (err >= 0) @@ -7340,39 +7360,47 @@ static void update_from_network(struct connman_service *service, static void trigger_autoconnect(struct connman_service *service) { struct connman_device *device; + bool native; - connman_network_set_autoconnect(service->network, - service->favorite && service->autoconnect); - if (service->favorite) { - device = connman_network_get_device(service->network); - if (device && !connman_device_get_scanning(device, - CONNMAN_SERVICE_TYPE_UNKNOWN)) { - - switch (service->type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - case CONNMAN_SERVICE_TYPE_P2P: - break; + if (!service->favorite) + return; - case CONNMAN_SERVICE_TYPE_GADGET: - case CONNMAN_SERVICE_TYPE_ETHERNET: - if (service->autoconnect) { - __connman_service_connect(service, - CONNMAN_SERVICE_CONNECT_REASON_AUTO); - break; - } + native = __connman_network_native_autoconnect(service->network); + if (native && service->autoconnect) { + DBG("trigger native autoconnect"); + connman_network_set_autoconnect(service->network, true); + /* XXX this kills iwd */ + /* __connman_service_connect(service, */ + /* CONNMAN_SERVICE_CONNECT_REASON_NATIVE); */ + return; + } - /* fall through */ - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_CELLULAR: - do_auto_connect(service, - CONNMAN_SERVICE_CONNECT_REASON_AUTO); - break; - } + device = connman_network_get_device(service->network); + if (device && connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_UNKNOWN)) + return; + + switch (service->type) { + case CONNMAN_SERVICE_TYPE_UNKNOWN: + case CONNMAN_SERVICE_TYPE_SYSTEM: + case CONNMAN_SERVICE_TYPE_P2P: + break; + + case CONNMAN_SERVICE_TYPE_GADGET: + case CONNMAN_SERVICE_TYPE_ETHERNET: + if (service->autoconnect) { + __connman_service_connect(service, + CONNMAN_SERVICE_CONNECT_REASON_AUTO); + break; } + + /* fall through */ + case CONNMAN_SERVICE_TYPE_BLUETOOTH: + case CONNMAN_SERVICE_TYPE_GPS: + case CONNMAN_SERVICE_TYPE_VPN: + case CONNMAN_SERVICE_TYPE_WIFI: + case CONNMAN_SERVICE_TYPE_CELLULAR: + do_auto_connect(service, CONNMAN_SERVICE_CONNECT_REASON_AUTO); + break; } } -- 2.30.2 ------------------------------ Date: Tue, 6 Apr 2021 12:23:55 +1000 From: Jupiter <jupiter....@gmail.com> Subject: WiFi P2P connection To: connman <connman@lists.01.org> Message-ID: <CAA=hcWShZe0qJsWyi41x-Jr2gVW-52u=djcryn6so8pohax...@mail.gmail.com> Content-Type: text/plain; charset="UTF-8" Hi, I am currently using connman to config WiFi to connect to WiFi routers, here is the setting: [global] OfflineMode=false [WiFi] Enable=true Tethering=false [Cellular] Enable=true Tethering=false I now need to set up a WiFi P2P connection, my WiFi module supports P2P, what should I change to set up a WiFi P2P connection in a connman setting? Thank you. Kind regards, - jupiter ------------------------------ Subject: Digest Footer _______________________________________________ connman mailing list -- connman@lists.01.org To unsubscribe send an email to connman-le...@lists.01.org ------------------------------ End of connman Digest, Vol 66, Issue 4 **************************************