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: connman-vpnd does not reconnect after resume (Patrik Flykt)
   2. Re: [PATCH] PacRunner:Domains are looked up to match the host
      (Tomasz Bursztyka)
   3. Re: [PATCH] PacRunner:Domains are looked up to match the host
      (David Woodhouse)
   4. Re: [PATCH] [Pacrunner]: use memmove() instead of g_memmove()
      (Patrik Flykt)
   5. Re: API to get List of Connected STA's to an AP's (Patrik Flykt)


----------------------------------------------------------------------

Message: 1
Date: Fri, 10 Jun 2016 12:07:38 +0300
From: Patrik Flykt <[email protected]>
To: Vasiliy Tolstov <[email protected]>
Cc: connman <[email protected]>, Daniel Wagner <[email protected]>
Subject: Re: connman-vpnd does not reconnect after resume
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Tue, 2016-06-07 at 13:20 +0300, Vasiliy Tolstov wrote:
> Passpharases not needed. I conntct without passphrase. Also i have a
> note, that after laptop open sometimes i need to disconnect vpn
> because it in state not connected and not disconnected.

Due to unknown reasons this can happen, and I have seen it sometimes in
the past with openconnect. Does a reconnect solve your problem in all
cases? If yes, there is something going on between the VPN daemon and
connman-vpnd that doesn't properly work or convey the state(s) the VPN
daemon is in. Which needs more investigation, of course.


Cheers,

        Patrik


------------------------------

Message: 2
Date: Fri, 10 Jun 2016 12:10:30 +0200
From: Tomasz Bursztyka <[email protected]>
To: Atul Anand <[email protected]>, David Woodhouse
        <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] PacRunner:Domains are looked up to match the host
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"

Hi Atul,

> +int pacrunner_proxy_set_domains(struct pacrunner_proxy *proxy, char 
> **domains)
> +{
> +     int len;
> +     char **domain;
> +     char ip[INET6_ADDRSTRLEN + 1];
> +
> +     DBG("proxy %p domains %p", proxy, domains);
> +
> +     if (!proxy)
> +             return -EINVAL;
> +
> +     if (!domains)
> +             return -EINVAL;
> +
> +     for (domain = (char **)domains; *domain; domain++) {
> +             Domain *data = domain_new();
> +             g_return_val_if_fail(data != NULL, -EINVAL);
> +
> +             char *slash = strchr(*domain, '/');
> +             if (slash) {

You could refactor the logic: if (!slash) { ... put the else logic 
inside here, + continue; in the end }

Thus all the code below could be indented less.
> +                     len = slash - *domain;
> +                     if (len > INET6_ADDRSTRLEN)
> +                             return -EINVAL;
> +                     strncpy(ip, *domain, len);
> +                     ip[len] = '\0';
> +
> +                     if (inet_pton(AF_INET, ip, &(data->addr.ip4)) == 1) {
> +                             data->domain = NULL;
> +                             data->proto = 4;
> +                             errno = 0;
> +                             data->mask = strtol(slash + 1, NULL, 10);
> +                             if (errno || data->mask > 32)
> +                                     return -EINVAL;
> +
> +                             proxy->domains = g_list_append(proxy->domains, 
> data);
> +                     } else if (inet_pton(AF_INET6, ip, &(data->addr.ip6)) 
> == 1) {
> +                             data->domain = NULL;
> +                             data->proto = 6;
> +                             errno = 0;
> +                             data->mask = strtol(slash + 1, NULL, 10);
> +                             if (errno || data->mask > 128)
> +                                     return -EINVAL;
> +
> +                             proxy->domains = g_list_append(proxy->domains, 
> data);
> +                     } else
> +                             return -EINVAL;
> +             } else {
> +                     data->domain = g_strdup(*domain);
> +                     data->proto = 0;
> +
> +                     proxy->domains = g_list_append(proxy->domains, data);
> +             }
> +     }
> +
> +     return 0;
> +}
> +
>   static int set_method(struct pacrunner_proxy *proxy,
>                                       enum pacrunner_proxy_method method)
>   {
> @@ -326,8 +418,12 @@ int pacrunner_proxy_disable(struct pacrunner_proxy 
> *proxy)
>   
>   char *pacrunner_proxy_lookup(const char *url, const char *host)
>   {
> -     GList *list;
> -     struct pacrunner_proxy *selected_proxy = NULL;
> +     int i;
> +     GList *l, *list;
> +     struct in_addr ip4_addr;
> +     struct in6_addr ip6_addr;
> +     struct pacrunner_proxy *selected_proxy = NULL, *default_proxy = NULL;
> +     int protocol = 0;
>   
>       DBG("url %s host %s", url, host);
>   
> @@ -340,17 +436,82 @@ char *pacrunner_proxy_lookup(const char *url, const 
> char *host)
>               return NULL;
>       }
>   
> +     if (inet_pton(AF_INET, host, &ip4_addr) == 1) {
> +             protocol = 4;
> +     } else if (inet_pton(AF_INET6, host, &ip6_addr) == 1) {
> +             protocol = 6;
> +     } else if (host[0] == '[') {
> +             char ip[INET6_ADDRSTRLEN + 1];
> +             int len = strlen(host);
> +
> +             if (len < INET6_ADDRSTRLEN + 2 && host[len - 1] == ']') {
> +                     strncpy(ip, host + 1, len - 2);
> +                     ip[len - 2] = '\0';
> +
> +                     if (inet_pton(AF_INET6, ip, &ip6_addr) == 1)
> +                             protocol = 6;
> +             }
> +     }
> +
>       for (list = g_list_first(proxy_list); list; list = g_list_next(list)) {
>               struct pacrunner_proxy *proxy = list->data;
>   
> -             if (proxy->method == PACRUNNER_PROXY_METHOD_MANUAL ||
> -                             proxy->method == PACRUNNER_PROXY_METHOD_AUTO) {
> -                     selected_proxy = proxy;
> -                     break;
> -             } else if (proxy->method == PACRUNNER_PROXY_METHOD_DIRECT)
> -                     selected_proxy = proxy;
> +             if (proxy->domains) {

Better putting this for loop below in its own inline function.

> +                     for (l = g_list_first(proxy->domains); l; l = 
> g_list_next(l)) {
> +                             Domain *data = l->data;
> +                             int shift;
> +
> +                             if (data->proto != protocol)
> +                                     continue;
> +
> +                             switch(protocol) {
> +                             case 4:
> +                                     if (ntohl(ip4_addr.s_addr ^ 
> data->addr.ip4.s_addr)
> +                                                     >> (32 - data->mask)) {
> +                                             selected_proxy = proxy;
> +                                             goto found;
> +                                     }
> +
> +                             no_match:
> +                                     break;
> +
> +                             case 6:
> +                                     for (i = 0; i < (data->mask)/8; i++)
> +                                             if (ip6_addr.s6_addr[i] != 
> data->addr.ip6.s6_addr[i])
> +                                                     goto no_match;
> +
> +                                     if ((data->mask) % 8) {
> +                                             /* 1-7 bits left to compare */
> +                                             shift = 8 - (data->mask - 
> (i*8));
> +                                             if ((ip6_addr.s6_addr[i] >> 
> shift) !=
> +                                                     
> (data->addr.ip6.s6_addr[i] >> shift))
> +                                                     goto no_match;
> +                                     }
> +                                     selected_proxy = proxy;
> +                                     goto found;
> +
> +                             default:
> +                                     if (g_str_has_suffix(host, 
> data->domain)) {
> +                                             size_t hlen = strlen(host);
> +                                             size_t dlen = 
> strlen(data->domain);
> +
> +                                             if (hlen == dlen || host[hlen - 
> dlen -1] == '.') {
> +                                                     selected_proxy = proxy;
> +                                                     goto found;
> +                                             }
> +                                     }
> +                                     break;
> +                             }
> +                     }
> +             } else if (!default_proxy) {
> +                     default_proxy = proxy;
> +             }
>       }
>   
> +     if (!selected_proxy)
> +             selected_proxy = default_proxy;
> +
> +found:
>       pthread_mutex_unlock(&proxy_mutex);
>   
>       if (!selected_proxy)
> -- 2.5.5

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.01.org/pipermail/connman/attachments/20160610/459e9581/attachment-0001.html>

------------------------------

Message: 3
Date: Fri, 10 Jun 2016 11:18:58 +0100
From: David Woodhouse <[email protected]>
To: Tomasz Bursztyka <[email protected]>, Atul Anand
        <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] PacRunner:Domains are looked up to match the host
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

On Fri, 2016-06-10 at 12:10 +0200, Tomasz Bursztyka wrote:
> 
> Better putting this for loop below in its own inline function.

Heh. Atul's original incarnation of this had a
pacrunner_cmp_host_domain() function which three entirely separate code
paths, only one of which was ever taken, depending on which one of
three arguments was non-NULL. I really didn't like that, so I removed
it and put all the code inline instead:

http://git.infradead.org/users/dwmw2/pacrunner.git/commitdiff/80c071437

Personally, I don't get overly worked up about code being over 80
characters if it's actually easier to read that way. But after
discussion just now on IRC, I've suggested that Atul could take each of
the three separate comparisons and make *those* into separate
functions:

static int compare_legacy_ip_in_net(struct in_addr *host, struct in_addr 
*match, int mask);
static int compare_ipv6_in_net(struct in6_addr *host, struct in6_addr *match, 
int mask);
static int compare_host_in_domain(const char *host, const char *domain);


(Maybe we'd pass 'struct proxy_domain'  instead of the last 1 or 2
arguments to each of those).

-- 
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5760 bytes
Desc: not available
URL: 
<http://lists.01.org/pipermail/connman/attachments/20160610/b87ff54e/attachment-0001.bin>

------------------------------

Message: 4
Date: Fri, 10 Jun 2016 14:04:14 +0300
From: Patrik Flykt <[email protected]>
To: Atul Anand <[email protected]>, [email protected]
Subject: Re: [PATCH] [Pacrunner]: use memmove() instead of g_memmove()
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Thu, 2016-06-09 at 03:06 +0530, Atul Anand wrote:
> g_memmove() has been deprecated since GLib 2.40.
> Build fails with newer versions of GLib.
> ---

Yes, this is already part of upstream so it has been taken care of.

        Patrik

> ?pacrunner/unit/test-pacrunner.c | 2 +-
> ?1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pacrunner/unit/test-pacrunner.c b/pacrunner/unit/test-
> pacrunner.c
> index 70e2dbe..f234a35 100644
> --- a/pacrunner/unit/test-pacrunner.c
> +++ b/pacrunner/unit/test-pacrunner.c
> @@ -107,7 +107,7 @@ static gchar **_g_strappendv(gchar **str_array,
> const gchar *str)
> ?     }
> ?
> ?     if (str_array) {
> -             g_memmove(result, str_array, length * sizeof(gchar
> *));
> +             memmove(result, str_array, length * sizeof(gchar
> *));
> ?             memset(str_array, 0, length * sizeof(gchar *));
> ?     }
> ?


------------------------------

Message: 5
Date: Fri, 10 Jun 2016 14:06:15 +0300
From: Patrik Flykt <[email protected]>
To: "Lamsoge, Abhijit" <[email protected]>,
        "[email protected]" <[email protected]>
Subject: Re: API to get List of Connected STA's to an AP's
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Thu, 2016-06-09 at 12:42 +0000, Lamsoge, Abhijit wrote:
> Hi Patrick/All,
> 
> I have a few queries after long time.
> 
> 1) Does connman support list of connected station/client to AP?

No.

> 2) If yes, how we can access list of connected station ?
> 3) If no, then how/where we can implement this feature??

Good question.

> I think it's quiet an important feature if it is not supported in
> connman.

What is the planned use case for this?


Cheers,

        Patrik


------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 8, Issue 12
**************************************

Reply via email to