Send connman mailing list submissions to connman@lists.01.org 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 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. [PATCH] vpn: Configurable route environment parsing for VPN plugins. (Jussi Laakkonen) 2. Re: [PATCH] service: Add warning message why 8021x setup fails (Daniel Wagner) 3. Re: [PATCH] firewall-iptables: Fix use-after-free in firewall_remove_rules (Daniel Wagner) 4. Re: [PATCH] vpn: Configurable route environment parsing for VPN plugins. (Daniel Wagner) 5. Re: making Scan method asynchronous (Daniel Wagner) 6. Re: Issue with service reporting on a 4G modem (Daniel Wagner) 7. connman does not see any wifi carriers after cycling hardware rfkill button (KARBOWSKI Piotr) ---------------------------------------------------------------------- Message: 1 Date: Mon, 19 Feb 2018 18:22:53 +0200 From: Jussi Laakkonen <jussi.laakko...@jolla.com> To: connman@lists.01.org Subject: [PATCH] vpn: Configurable route environment parsing for VPN plugins. Message-ID: <1519057373-372-1-git-send-email-jussi.laakko...@jolla.com> This commit adds support for configurable route environment parsing functionality for VPN plugins. This way each plugin can implement own parsing functionality and register it with vpn_driver struct for provider use, since each parsing functionality is plugin driver specific. Route environment parsing functionality of OpenVPN and OpenConnect are moved to respective VPN plugin sources. --- vpn/plugins/openconnect.c | 30 +++++++++++++++++++++ vpn/plugins/openvpn.c | 25 ++++++++++++++++++ vpn/plugins/vpn.c | 21 +++++++++++++++ vpn/plugins/vpn.h | 3 +++ vpn/vpn-provider.c | 66 +++++++++-------------------------------------- vpn/vpn-provider.h | 10 +++++++ 6 files changed, 101 insertions(+), 54 deletions(-) diff --git a/vpn/plugins/openconnect.c b/vpn/plugins/openconnect.c index 87679bf..8e74479 100644 --- a/vpn/plugins/openconnect.c +++ b/vpn/plugins/openconnect.c @@ -561,11 +561,41 @@ static int oc_error_code(struct vpn_provider *provider, int exit_code) } } +static int oc_route_env_parse(struct vpn_provider *provider, const char *key, + int *family, unsigned long *idx, enum vpn_provider_route_type *type) +{ + char *end; + const char *start; + + if (g_str_has_prefix(key, "CISCO_SPLIT_INC_")) { + *family = AF_INET; + start = key + strlen("CISCO_SPLIT_INC_"); + } else if (g_str_has_prefix(key, "CISCO_IPV6_SPLIT_INC_")) { + *family = AF_INET6; + start = key + strlen("CISCO_IPV6_SPLIT_INC_"); + } else + return -EINVAL; + + *idx = g_ascii_strtoull(start, &end, 10); + + if (strncmp(end, "_ADDR", 5) == 0) + *type = VPN_PROVIDER_ROUTE_TYPE_ADDR; + else if (strncmp(end, "_MASK", 5) == 0) + *type = VPN_PROVIDER_ROUTE_TYPE_MASK; + else if (strncmp(end, "_MASKLEN", 8) == 0 && *family == AF_INET6) + *type = VPN_PROVIDER_ROUTE_TYPE_MASK; + else + return -EINVAL; + + return 0; +} + static struct vpn_driver vpn_driver = { .notify = oc_notify, .connect = oc_connect, .error_code = oc_error_code, .save = oc_save, + .route_env_parse = oc_route_env_parse, }; static int openconnect_init(void) diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c index e339509..f38c0c3 100644 --- a/vpn/plugins/openvpn.c +++ b/vpn/plugins/openvpn.c @@ -470,11 +470,36 @@ static int ov_device_flags(struct vpn_provider *provider) return IFF_TUN; } +static int ov_route_env_parse(struct vpn_provider *provider, const char *key, + int *family, unsigned long *idx, enum vpn_provider_route_type *type) +{ + char *end; + const char *start; + + if (g_str_has_prefix(key, "route_network_")) { + start = key + strlen("route_network_"); + *type = VPN_PROVIDER_ROUTE_TYPE_ADDR; + } else if (g_str_has_prefix(key, "route_netmask_")) { + start = key + strlen("route_netmask_"); + *type = VPN_PROVIDER_ROUTE_TYPE_MASK; + } else if (g_str_has_prefix(key, "route_gateway_")) { + start = key + strlen("route_gateway_"); + *type = VPN_PROVIDER_ROUTE_TYPE_GW; + } else + return -EINVAL; + + *family = AF_INET; + *idx = g_ascii_strtoull(start, &end, 10); + + return 0; +} + static struct vpn_driver vpn_driver = { .notify = ov_notify, .connect = ov_connect, .save = ov_save, .device_flags = ov_device_flags, + .route_env_parse = ov_route_env_parse, }; static int openvpn_init(void) diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c index 9a42385..aeb01d6 100644 --- a/vpn/plugins/vpn.c +++ b/vpn/plugins/vpn.c @@ -585,6 +585,26 @@ static int vpn_save(struct vpn_provider *provider, GKeyFile *keyfile) return 0; } +static int vpn_route_env_parse(struct vpn_provider *provider, const char *key, + int *family, unsigned long *idx, + enum vpn_provider_route_type *type) +{ + struct vpn_driver_data *vpn_driver_data = NULL; + const char *name = NULL; + + if (!provider) + return -EINVAL; + + name = vpn_provider_get_driver_name(provider); + vpn_driver_data = g_hash_table_lookup(driver_hash, name); + + if (vpn_driver_data && vpn_driver_data->vpn_driver->route_env_parse) + return vpn_driver_data->vpn_driver->route_env_parse(provider, key, + family, idx, type); + + return 0; +} + int vpn_register(const char *name, struct vpn_driver *vpn_driver, const char *program) { @@ -606,6 +626,7 @@ int vpn_register(const char *name, struct vpn_driver *vpn_driver, data->provider_driver.remove = vpn_remove; data->provider_driver.save = vpn_save; data->provider_driver.set_state = vpn_set_state; + data->provider_driver.route_env_parse = vpn_route_env_parse; if (!driver_hash) driver_hash = g_hash_table_new_full(g_str_hash, diff --git a/vpn/plugins/vpn.h b/vpn/plugins/vpn.h index cb94bdc..863576d 100644 --- a/vpn/plugins/vpn.h +++ b/vpn/plugins/vpn.h @@ -51,6 +51,9 @@ struct vpn_driver { int (*error_code) (struct vpn_provider *provider, int exit_code); int (*save) (struct vpn_provider *provider, GKeyFile *keyfile); int (*device_flags) (struct vpn_provider *provider); + int (*route_env_parse) (struct vpn_provider *provider, const char *key, + int *family, unsigned long *idx, + enum vpn_provider_route_type *type); }; int vpn_register(const char *name, struct vpn_driver *driver, diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c index d2b3e3a..dd54ac0 100644 --- a/vpn/vpn-provider.c +++ b/vpn/vpn-provider.c @@ -37,6 +37,7 @@ #include "connman/vpn-dbus.h" #include "vpn-provider.h" #include "vpn.h" +#include "plugins/vpn.h" static DBusConnection *connection; static GHashTable *provider_hash; @@ -2423,61 +2424,18 @@ int vpn_provider_set_nameservers(struct vpn_provider *provider, return 0; } -enum provider_route_type { - PROVIDER_ROUTE_TYPE_NONE = 0, - PROVIDER_ROUTE_TYPE_MASK = 1, - PROVIDER_ROUTE_TYPE_ADDR = 2, - PROVIDER_ROUTE_TYPE_GW = 3, -}; - static int route_env_parse(struct vpn_provider *provider, const char *key, int *family, unsigned long *idx, - enum provider_route_type *type) + enum vpn_provider_route_type *type) { - char *end; - const char *start; + if (!provider) + return -EINVAL; DBG("name %s", provider->name); - if (!strcmp(provider->type, "openvpn")) { - if (g_str_has_prefix(key, "route_network_")) { - start = key + strlen("route_network_"); - *type = PROVIDER_ROUTE_TYPE_ADDR; - } else if (g_str_has_prefix(key, "route_netmask_")) { - start = key + strlen("route_netmask_"); - *type = PROVIDER_ROUTE_TYPE_MASK; - } else if (g_str_has_prefix(key, "route_gateway_")) { - start = key + strlen("route_gateway_"); - *type = PROVIDER_ROUTE_TYPE_GW; - } else - return -EINVAL; - - *family = AF_INET; - *idx = g_ascii_strtoull(start, &end, 10); - - } else if (!strcmp(provider->type, "openconnect")) { - if (g_str_has_prefix(key, "CISCO_SPLIT_INC_")) { - *family = AF_INET; - start = key + strlen("CISCO_SPLIT_INC_"); - } else if (g_str_has_prefix(key, - "CISCO_IPV6_SPLIT_INC_")) { - *family = AF_INET6; - start = key + strlen("CISCO_IPV6_SPLIT_INC_"); - } else - return -EINVAL; - - *idx = g_ascii_strtoull(start, &end, 10); - - if (strncmp(end, "_ADDR", 5) == 0) - *type = PROVIDER_ROUTE_TYPE_ADDR; - else if (strncmp(end, "_MASK", 5) == 0) - *type = PROVIDER_ROUTE_TYPE_MASK; - else if (strncmp(end, "_MASKLEN", 8) == 0 && - *family == AF_INET6) { - *type = PROVIDER_ROUTE_TYPE_MASK; - } else - return -EINVAL; - } + if (provider->driver && provider->driver->route_env_parse) + return provider->driver->route_env_parse(provider, key, family, idx, + type); return 0; } @@ -2488,7 +2446,7 @@ int vpn_provider_append_route(struct vpn_provider *provider, struct vpn_route *route; int ret, family = 0; unsigned long idx = 0; - enum provider_route_type type = PROVIDER_ROUTE_TYPE_NONE; + enum vpn_provider_route_type type = VPN_PROVIDER_ROUTE_TYPE_NONE; DBG("key %s value %s", key, value); @@ -2513,15 +2471,15 @@ int vpn_provider_append_route(struct vpn_provider *provider, } switch (type) { - case PROVIDER_ROUTE_TYPE_NONE: + case VPN_PROVIDER_ROUTE_TYPE_NONE: break; - case PROVIDER_ROUTE_TYPE_MASK: + case VPN_PROVIDER_ROUTE_TYPE_MASK: route->netmask = g_strdup(value); break; - case PROVIDER_ROUTE_TYPE_ADDR: + case VPN_PROVIDER_ROUTE_TYPE_ADDR: route->network = g_strdup(value); break; - case PROVIDER_ROUTE_TYPE_GW: + case VPN_PROVIDER_ROUTE_TYPE_GW: route->gateway = g_strdup(value); break; } diff --git a/vpn/vpn-provider.h b/vpn/vpn-provider.h index bdc5f5c..96452c1 100644 --- a/vpn/vpn-provider.h +++ b/vpn/vpn-provider.h @@ -57,6 +57,13 @@ enum vpn_provider_error { VPN_PROVIDER_ERROR_AUTH_FAILED = 3, }; +enum vpn_provider_route_type { + VPN_PROVIDER_ROUTE_TYPE_NONE = 0, + VPN_PROVIDER_ROUTE_TYPE_MASK = 1, + VPN_PROVIDER_ROUTE_TYPE_ADDR = 2, + VPN_PROVIDER_ROUTE_TYPE_GW = 3, +}; + struct vpn_provider; struct connman_ipaddress; @@ -134,6 +141,9 @@ struct vpn_provider_driver { int (*save) (struct vpn_provider *provider, GKeyFile *keyfile); int (*set_state)(struct vpn_provider *provider, enum vpn_provider_state state); + int (*route_env_parse) (struct vpn_provider *provider, const char *key, + int *family, unsigned long *idx, + enum vpn_provider_route_type *type); }; int vpn_provider_driver_register(struct vpn_provider_driver *driver); -- 2.7.4 ------------------------------ Message: 2 Date: Mon, 19 Feb 2018 17:41:18 +0100 From: Daniel Wagner <w...@monom.org> To: connman@lists.01.org Subject: Re: [PATCH] service: Add warning message why 8021x setup fails Message-ID: <f752048a-01d1-408b-bb51-83f2bc36f...@monom.org> Content-Type: text/plain; charset=utf-8; format=flowed On 02/10/2018 11:14 AM, Daniel Wagner wrote: > ConnMan can be a bit more verbose why it fails to setup a > network. Just to return -EINVAL makes it hard to find out why a > provisioning setup doesn't work. No one complained, so I went ahead and applied the patch. ------------------------------ Message: 3 Date: Mon, 19 Feb 2018 17:42:47 +0100 From: Daniel Wagner <w...@monom.org> To: Slava Monich <slava.mon...@jolla.com> Cc: connman@lists.01.org Subject: Re: [PATCH] firewall-iptables: Fix use-after-free in firewall_remove_rules Message-ID: <42329b8a-6a4d-e959-8906-d32973fcd...@monom.org> Content-Type: text/plain; charset=utf-8; format=flowed Hi Slava, On 02/13/2018 09:45 PM, Slava Monich wrote: > g_list_previous was accessing the pointer deallocated by g_list_remove. > g_list_free_full does it right. Oops, good catch. Patch applied. Thanks, Daniel ------------------------------ Message: 4 Date: Mon, 19 Feb 2018 17:48:09 +0100 From: Daniel Wagner <w...@monom.org> To: Jussi Laakkonen <jussi.laakko...@jolla.com>, connman@lists.01.org Subject: Re: [PATCH] vpn: Configurable route environment parsing for VPN plugins. Message-ID: <613c009d-2af2-73c7-f061-bb9cd501e...@monom.org> Content-Type: text/plain; charset=utf-8; format=flowed Hi Jussi, On 02/19/2018 05:22 PM, Jussi Laakkonen wrote: > This commit adds support for configurable route environment parsing > functionality for VPN plugins. This way each plugin can implement own > parsing functionality and register it with vpn_driver struct for > provider use, since each parsing functionality is plugin driver specific. > > Route environment parsing functionality of OpenVPN and OpenConnect are > moved to respective VPN plugin sources. Patch applied. Thanks, Daniel ------------------------------ Message: 5 Date: Mon, 19 Feb 2018 17:58:28 +0100 From: Daniel Wagner <w...@monom.org> To: Vasyl Vavrychuk <vvavryc...@gmail.com> Cc: connman@lists.01.org Subject: Re: making Scan method asynchronous Message-ID: <2f6ec1b6-aedb-9720-3de6-b053924d8...@monom.org> Content-Type: text/plain; charset=utf-8; format=flowed Hi Vasyl, On 02/13/2018 10:52 PM, Vasyl Vavrychuk wrote: > I would like to make P2P_FIND_TIMEOUT large than 30 seconds locally. > Potentially it can be very large value even infinite. > > But then connmanctl's 'scan p2p' command will timeout because connman > client has 120 seconds D-Bus reply timeout. > > In my opinion it would be better if > 1. Make Scan method being asynchronous in the sense it returns upon scan > start. The API documentation for p2p already reads as it could be asynchronous. In case of P2P technology, results will be signaled via the PeersChanged signal from the manager interface. Do you want to make Scan() completely asynchronous or just for p2p? I fear we should not change the current Scan() behavior for any other technology because it breaks the API. If the p2p folks would like to change that to asynchronous I could be convinced to accept it. But it is ugly. > 2. Add Scanning property. That is what UI does, for example here > http://git.merproject.org/mer-core/libconnman-qt/blob/master/plugin/technologymodel.h > they manage their own m_scanning field. Yes, that makes sense but as said above I fear we can't change Scan() without breaking applications. This would be something for 2.x. Thanks, Daniel ------------------------------ Message: 6 Date: Mon, 19 Feb 2018 18:02:13 +0100 From: Daniel Wagner <w...@monom.org> To: Bassem BOUBAKER <bassem.bouba...@actia.fr> Cc: "connman@lists.01.org" <connman@lists.01.org>, "of...@ofono.org" <of...@ofono.org> Subject: Re: Issue with service reporting on a 4G modem Message-ID: <c2267ed4-5ae8-e7db-565e-9c694aa13...@monom.org> Content-Type: text/plain; charset=utf-8; format=flowed Hi Bassem, [added ofono mailing list] On 02/16/2018 11:24 AM, Bassem BOUBAKER wrote: > Hello community, > > I'm having connman version 1.31 along side with ofono running on my board. > > When I activate a context on my 4G modem using ofono, connman creates two > services: one is cellular and the other is ethernet. > > *AR Wired ethernet_XX_cable > *AO XXX cellular_XXX_context1 > > In this case, the ideal state is that connman reports only one cellular > technology related to the modem. > > When digging into the logs, I feels like a new ethernet device is enumerated > and connman creates the appropriate service for it. > > Knowing that my modem net interface is using "cdc_ether" driver, does anyone > have an idea about what could be the issue here? From you description I understand that the modem creates an additional ethernet interface? Could you post the corresponding logs (or post a link to the logs)? I am also not sure what the exact question is. I suspect you want to see only one interface and not two.. Thanks, Daniel ------------------------------ Message: 7 Date: Mon, 19 Feb 2018 18:16:09 +0100 From: KARBOWSKI Piotr <piotr.karbow...@gmail.com> To: "connman@lists.01.org" <connman@lists.01.org> Subject: connman does not see any wifi carriers after cycling hardware rfkill button Message-ID: <2335ddd0-ad1f-74c8-1222-96be72652...@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Hi, It appears that the momment I double tap fn+print screen (rfkill) hotkey (so, block followed by unblock), connman looses wifi support until restart. If I try to force scan via `scan wifi`, I get: connmanctl> scan wifi Error /net/connman/technology/wifi: No carrier I can confirm that `rfkill` reports all as unblocked. Any suggestion how can I make connman recovery after such event? -- Piotr. ------------------------------ Subject: Digest Footer _______________________________________________ connman mailing list connman@lists.01.org https://lists.01.org/mailman/listinfo/connman ------------------------------ End of connman Digest, Vol 28, Issue 12 ***************************************