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: Search domain persistence (Sven Schwedas)
   2. [PATCH 1/6] proxy: Fix handling of proxy->domains
      (David Woodhouse)
   3. [PATCH 2/6] js: Add proxy argument to JS execute() methods.
      (David Woodhouse)


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

Message: 1
Date: Mon, 20 Jun 2016 14:34:59 +0200
From: Sven Schwedas <[email protected]>
To: Patrik Flykt <[email protected]>, [email protected]
Subject: Re: Search domain persistence
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

Sorry for the delay, but for the past week I always managed to drain the
battery while moving between locations and never got around to reproduce
the problem. (So, contrary to my original impression, it's not
persistent across reboots.)

On 2016-06-10 13:12, Patrik Flykt wrote:
> On Fri, 2016-06-03 at 17:08 +0200, Sven Schwedas wrote:
>> On 1.32 (possibly also older versions, haven't checked) I'm seeing an
>> annoying problem: Search domains persist across networks and reboots
>> and DHCP search domains of the currently active network are only
>> appended. After roaming between a few networks, this creates an
>> absolute mess of an /etc/resolv.conf. Is this intended behaviour? How
>> can I disable this if so?
>
> You must be running connmand with --nodnsproxy, right? The intended
> behavior is that without dnsproxy only the current search domain gets
> written into /etc/resolv.conf, so this behavior must be a bug.

Oh, sorry, yes.

main.conf:

> [General]
> AllowHostnameUpdates=false
> DefaultAutoConnectTechnologies=ethernet,wifi
> PreferredTechnologies=ethernet,wifi
> SingleConnectedTechnology=true


> This is 1.32 from upstream, i.e. not packaged by a distro?

Packaged by Arch Linux:

>
https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/connman

Their only patch affects the polkit configuration, it's otherwise
upstream-ish.

> Can you list
> the search domains (Domains and Domains.Configuration from connmanctl
> services XXXX) for each service and the resulting /etc/resolv.conf
> when you move between networks?

First connected network after boot (ethernet):

  Domains = [ ad.tao.at ]
  Domains.Configuration = [  ]

=>

# Generated by Connection Manager
search ad.tao.at ad.tao.at
nameserver 192.168.17.1


After disabling Ethernet and reconnecting to the same network via wifi,
no changes.


Putting the device into suspend to RAM and resuming at the second
location, connman connects to the local wifi:

  Domains = [ shun.yaki-syndicate.de ]
  Domains.Configuration = [  ]

=>

# Generated by Connection Manager
search shun.yaki-syndicate.de ad.tao.at ad.tao.at
nameserver 192.168.10.1


"connmanctl services" only shows the wifi active, not ethernet nor the
old wifi-AP. Cycling rfkill doesn't change the output of either.


Suspend to RAM again, return to first location, put laptop on docking
station, power on; connman connects to ethernet:

  Domains = [ ad.tao.at ]
  Domains.Configuration = [  ]

=>

# Generated by Connection Manager
search shun.yaki-syndicate.de ad.tao.at ad.tao.at
nameserver 192.168.17.1


Disconnect all, connect to a different wifi without search domains
configured:

  Domains = [  ]
  Domains.Configuration = [  ]

=>

# Generated by Connection Manager
search shun.yaki-syndicate.de ad.tao.at ad.tao.at
nameserver 192.168.101.42



And from here on it seems I'm stuck with the broken resolvconf.
Switching to wifi, switching back to ethernet, ? results in the same
broken resolvconf search entry.

==========

FWIW, the first two networks are using dnsmasq as DHCP server with the
following relevant configuration snippets:

> # DNS domain
> dhcp-option=15,"ad.tao.at"
> domain=ad.tao.at

and

> domain=shun.yaki-syndicate.de


Setting the search domain twice for the first network probably comes
from the slight misconfiguration I should fix at some point, but it
doesn't expain the retention.

--
Mit freundlichen Gr??en, / Best Regards,
Sven Schwedas, Systemadministrator
Mail/XMPP [email protected] | Skype sven.schwedas
TAO Beratungs- und Management GmbH | Lendplatz 45 | A8020 Graz
https://software.tao.at | Tel +43 680 301 7167

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 648 bytes
Desc: OpenPGP digital signature
URL: 
<http://lists.01.org/pipermail/connman/attachments/20160620/e9c6ba46/attachment-0001.asc>

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

Message: 2
Date: Mon, 20 Jun 2016 14:24:15 +0100
From: David Woodhouse <[email protected]>
To: [email protected]
Subject: [PATCH 1/6] proxy: Fix handling of proxy->domains
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

In create_proxy_config() we were calling pacrunner_proxy_set_domains(),
which was returning an error if passed a NULL list of domains.

Then we were calling pacrunner_proxy_set_auto() or one of its friends,
which all call reset_proxy() and *delete* the list of domains, if one
was set.

Treat proxy->domains like proxy->interface, and don't reset it in
reset_proxy(). And fix up pacrunner_proxy_set_domains() so that it
happily accepts a NULL domains list and behaves appropriately. As
a side-effect, this stops pacrunner_proxy_set_domains() from being
additive ? if you call it a second time it'll clear the original set
and set just the ones you've just passed, instead of adding new
domains to the list. Which is a much saner semantic.
---
 src/proxy.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/proxy.c b/src/proxy.c
index 2ebc75d..536345f 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -115,10 +115,6 @@ static void reset_proxy(struct pacrunner_proxy *proxy)
 
        __pacrunner_manual_destroy_excludes(proxy->excludes);
        proxy->excludes = NULL;
-
-       if (proxy->domains)
-               g_list_free_full(proxy->domains, proxy_domain_destroy);
-       proxy->domains = NULL;
 }
 
 void pacrunner_proxy_unref(struct pacrunner_proxy *proxy)
@@ -133,6 +129,9 @@ void pacrunner_proxy_unref(struct pacrunner_proxy *proxy)
 
        reset_proxy(proxy);
 
+       g_list_free_full(proxy->domains, proxy_domain_destroy);
+       proxy->domains = NULL;
+
        g_free(proxy->interface);
        g_free(proxy);
 }
@@ -168,8 +167,11 @@ int pacrunner_proxy_set_domains(struct pacrunner_proxy 
*proxy, char **domains)
        if (!proxy)
                return -EINVAL;
 
+       g_list_free_full(proxy->domains, proxy_domain_destroy);
+       proxy->domains = NULL;
+
        if (!domains)
-               return -EINVAL;
+               return 0;
 
        for (domain = domains; *domain; domain++) {
                struct proxy_domain *data;
-- 
2.7.4

-- 
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/20160620/3add9e78/attachment-0001.bin>

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

Message: 3
Date: Mon, 20 Jun 2016 14:24:49 +0100
From: David Woodhouse <[email protected]>
To: [email protected]
Subject: [PATCH 2/6] js: Add proxy argument to JS execute() methods.
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

For now, just make the back ends automatically switch over, if
they're being invoked on a different context to the last invocation.
We'll fix them shortly to support multiple contexts.
---
 plugins/mozjs.c   |  8 ++++++--
 plugins/v8.cc     | 10 +++++++---
 src/js.c          |  5 +++--
 src/js.h          |  3 ++-
 src/pacrunner.h   |  3 ++-
 src/proxy.c       |  2 +-
 unit/test-mozjs.c | 16 ++++++++++------
 7 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/plugins/mozjs.c b/plugins/mozjs.c
index af91fea..77a0c13 100644
--- a/plugins/mozjs.c
+++ b/plugins/mozjs.c
@@ -222,17 +222,21 @@ static int mozjs_set_proxy(struct pacrunner_proxy *proxy)
        return 0;
 }
 
-static char * mozjs_execute(const char *url, const char *host)
+static char * mozjs_execute(struct pacrunner_proxy *proxy, const char *url,
+                           const char *host)
 {
        JSBool result;
        jsval rval, args[2];
        char *answer, *g_answer;
 
-       DBG("url %s host %s", url, host);
+       DBG("proxy %p url %s host %s", proxy, url, host);
 
        if (!jsctx)
                return NULL;
 
+       if (proxy != current_proxy && mozjs_set_proxy(proxy))
+               return NULL;
+
        pthread_mutex_lock(&mozjs_mutex);
 
        JS_BeginRequest(jsctx);
diff --git a/plugins/v8.cc b/plugins/v8.cc
index 6cb28ca..e947bed 100644
--- a/plugins/v8.cc
+++ b/plugins/v8.cc
@@ -251,11 +251,15 @@ static int v8_set_proxy(struct pacrunner_proxy *proxy)
 }
 
 
-static char *v8_execute(const char *url, const char *host)
+static char *v8_execute(struct pacrunner_proxy *proxy, const char *url,
+                       const char *host)
 {
-       v8::Locker lck;
+       DBG("proxy %p url %s host %s", proxy, url, host);
+
+       if (current_proxy != proxy && v8_set_proxy(proxy))
+               return NULL;
 
-       DBG("url %s host %s", url, host);
+       v8::Locker lck;
 
        if (jsctx.IsEmpty() || jsfn.IsEmpty())
                return NULL;
diff --git a/src/js.c b/src/js.c
index 84b8ada..ff08cee 100644
--- a/src/js.c
+++ b/src/js.c
@@ -69,7 +69,8 @@ int __pacrunner_js_set_proxy(struct pacrunner_proxy *proxy)
        return -ENXIO;
 }
 
-char *__pacrunner_js_execute(const char *url, const char *host)
+char *__pacrunner_js_execute(struct pacrunner_proxy *proxy, const char *url,
+                            const char *host)
 {
        GSList *list;
 
@@ -77,7 +78,7 @@ char *__pacrunner_js_execute(const char *url, const char 
*host)
                struct pacrunner_js_driver *driver = list->data;
 
                if (driver->execute)
-                       return driver->execute(url, host);
+                       return driver->execute(proxy, url, host);
        }
 
        return NULL;
diff --git a/src/js.h b/src/js.h
index 91143d1..ea76849 100644
--- a/src/js.h
+++ b/src/js.h
@@ -27,7 +27,8 @@ struct pacrunner_js_driver {
        const char *name;
        int priority;
        int (*set_proxy) (struct pacrunner_proxy *proxy);
-       char *(*execute)(const char *url, const char *host);
+       char *(*execute)(struct pacrunner_proxy *proxy, const char *url,
+                        const char *host);
 };
 
 int pacrunner_js_driver_register(struct pacrunner_js_driver *driver);
diff --git a/src/pacrunner.h b/src/pacrunner.h
index db534cf..71913bb 100644
--- a/src/pacrunner.h
+++ b/src/pacrunner.h
@@ -110,4 +110,5 @@ char *__pacrunner_mozjs_execute(const char *url, const char 
*host);
 int __pacrunner_js_init(void);
 void __pacrunner_js_cleanup(void);
 int __pacrunner_js_set_proxy(struct pacrunner_proxy *proxy);
-char *__pacrunner_js_execute(const char *url, const char *host);
+char *__pacrunner_js_execute(struct pacrunner_proxy *proxy, const char *url,
+                            const char *host);
diff --git a/src/proxy.c b/src/proxy.c
index 536345f..e913a3a 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -565,7 +565,7 @@ found:
                                                selected_proxy->servers,
                                                selected_proxy->excludes);
        case PACRUNNER_PROXY_METHOD_AUTO:
-               return __pacrunner_js_execute(url, host);
+               return __pacrunner_js_execute(selected_proxy, url, host);
        }
 
        return NULL;
diff --git a/unit/test-mozjs.c b/unit/test-mozjs.c
index 8ac9741..7ccdee9 100644
--- a/unit/test-mozjs.c
+++ b/unit/test-mozjs.c
@@ -97,7 +97,7 @@ static void test_single_execute_without_pac(void)
 
        g_assert(mozjs_init() == 0);
 
-       result = __pacrunner_js_execute(EXAMPLE_URL, EXAMPLE_HOST);
+       result = __pacrunner_js_execute(proxy, EXAMPLE_URL, EXAMPLE_HOST);
        g_test_message("result: %s", result);
 
        mozjs_exit();
@@ -111,7 +111,8 @@ static void test_multiple_execute_without_pac(void)
        g_assert(mozjs_init() == 0);
 
        for (i = 0; i < MULTIPLE_COUNT; i++) {
-               result = __pacrunner_js_execute(EXAMPLE_URL, EXAMPLE_HOST);
+               result = __pacrunner_js_execute(proxy, EXAMPLE_URL,
+                                               EXAMPLE_HOST);
                g_test_message("result %d: %s", i, result);
        }
 
@@ -126,7 +127,7 @@ static void test_single_execute_with_direct_pac(void)
 
        g_assert(pacrunner_proxy_set_auto(proxy, NULL, DIRECT_PAC) == 0);
 
-       result = __pacrunner_js_execute(EXAMPLE_URL, EXAMPLE_HOST);
+       result = __pacrunner_js_execute(proxy, EXAMPLE_URL, EXAMPLE_HOST);
        g_test_message("result: %s", result);
 
        pacrunner_proxy_disable(proxy);
@@ -144,7 +145,8 @@ static void test_multiple_execute_with_direct_pac(void)
        g_assert(pacrunner_proxy_set_auto(proxy, NULL, DIRECT_PAC) == 0);
 
        for (i = 0; i < MULTIPLE_COUNT; i++) {
-               result = __pacrunner_js_execute(EXAMPLE_URL, EXAMPLE_HOST);
+               result = __pacrunner_js_execute(proxy, EXAMPLE_URL,
+                                               EXAMPLE_HOST);
                g_test_message("result %d: %s", i, result);
        }
 
@@ -163,7 +165,8 @@ static void test_massive_execute_with_direct_pac(void)
        g_assert(pacrunner_proxy_set_auto(proxy, NULL, DIRECT_PAC) == 0);
 
        for (i = 0; i < MASSIVE_COUNT; i++) {
-               result = __pacrunner_js_execute(EXAMPLE_URL, EXAMPLE_HOST);
+               result = __pacrunner_js_execute(proxy, EXAMPLE_URL,
+                                               EXAMPLE_HOST);
                g_test_message("result %d: %s", i, result);
        }
 
@@ -182,7 +185,8 @@ static void test_multiple_execute_with_example_pac(void)
        g_assert(pacrunner_proxy_set_auto(proxy, NULL, EXAMPLE_PAC) == 0);
 
        for (i = 0; i < MULTIPLE_COUNT; i++) {
-               result = __pacrunner_js_execute(EXAMPLE_URL, EXAMPLE_HOST);
+               result = __pacrunner_js_execute(proxy, EXAMPLE_URL,
+                                               EXAMPLE_HOST);
                g_test_message("result %d: %s", i, result);
        }
 
-- 
2.7.4

-- 
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/20160620/ebec06a8/attachment.bin>

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

Subject: Digest Footer

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


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

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

Reply via email to