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] src/proxy.c: modify the proxy_lookup ()
supporting non-browser schemes (David Woodhouse)
2. Re: [PATCH RFC] service: Add AlwaysConnect feature (Patrik Flykt)
----------------------------------------------------------------------
Message: 1
Date: Sun, 14 Aug 2016 20:30:32 +0100
From: David Woodhouse <[email protected]>
To: Atul Anand <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: [PATCH] src/proxy.c: modify the proxy_lookup ()
supporting non-browser schemes
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
On Mon, 2016-08-15 at 00:23 +0530, Atul Anand wrote:
> As discussed, the proxy lookup for browser and non browser schemes should
> be handled in an order as follows:
> A request for a "browser" protocol would match the following configs
> order of preference (if they exist):
> ? Matching "Domains", BrowserOnly==TRUE
> ? Matching "Domains", BrowserOnly==FALSE
> ? Domains==NULL, BrowserOnly==TRUE
> ? Domains==NULL, BrowserOnly==FALSE
OK. So if the first exists we can return it immediately. Otherwise we
have to return the best option of the other three (in order)...
It'd be good to see specific test cases for all these (checking we
don't return an option that's further down the above list). You've
added some, but I don't think you cover *all* of the fallback
combinations.
> A request for a non-browser protocol would match the following:
> ? Matching "Domains", BrowserOnly==FALSE
> ? Domains==NULL, BrowserOnly==FALSE (except if a config exists with
> Matching "Domains", BrowserOnly==TRUE, in which case we need to
> return NULL).
Likewise test cases for these.
> -int pacrunner_proxy_set_domains(struct pacrunner_proxy *proxy, char
> **domains)
> +static gboolean check_browser_protocol(const char *url)
> +{
> + static const char *browser_schemes[] = {
> + "http://",
> + "https://",
> + "ftp://",
> + "socks://",
> + "socks4://",
> + "socks5://",
> + "nntp://",
> + "nntps://",
> + };
No. SOCKS is not a "browser protocol". In fact, SOCKS isn't something
you should *ever* see in a request. SOCKS is something you'd see in the
*answer* from PacRunner, never in the question.
Nobody would ever ask "what proxy do I use to access the proxy?".
That would be stupid.
Ah, let's add Milan to Cc just for that :)
> + guint i;
> +
> + for(i = 0; i < G_N_ELEMENTS(browser_schemes); i++) {
> + if(strncmp(browser_schemes[i], url, strlen(browser_schemes[i]))
> + == 0)
> + return TRUE;
> + }
> +
> + return FALSE;
> +}
> +
> +int pacrunner_proxy_set_domains(struct pacrunner_proxy *proxy, char
> **domains,
> + gboolean browser_only)
> {
> int len;
> char *slash, **domain;
> char ip[INET6_ADDRSTRLEN + 1];
>
> - DBG("proxy %p domains %p", proxy, domains);
> + DBG("proxy %p domains %p browser-only %u", proxy,
> + domains, browser_only);
> +
> + proxy->browser_only = browser_only;
>
> if (!proxy)
> return -EINVAL;
> @@ -479,13 +507,17 @@ static int compare_host_in_domain(const char *host,
> struct proxy_domain *match)
> char *pacrunner_proxy_lookup(const char *url, const char *host)
> {
> GList *l, *list;
> + gboolean browser_request, remember = FALSE;
> struct in_addr ip4_addr;
> struct in6_addr ip6_addr;
> - struct pacrunner_proxy *selected_proxy = NULL, *default_proxy = NULL;
> + struct pacrunner_proxy *selected_proxy = NULL;
> + struct pacrunner_proxy *default_browser = NULL, *default_all = NULL;
> int protocol = 0;
>
> DBG("url %s host %s", url, host);
>
> + browser_request = check_browser_protocol(url);
> +
> pthread_mutex_lock(&proxy_mutex);
> while (proxy_updating)
> pthread_cond_wait(&proxy_cond, &proxy_mutex);
> @@ -516,8 +548,11 @@ char *pacrunner_proxy_lookup(const char *url, const char
> *host)
> struct pacrunner_proxy *proxy = list->data;
>
> if (!proxy->domains) {
> - if (!default_proxy)
> - default_proxy = proxy;
> + if (proxy->browser_only && !default_browser)
> + default_browser = proxy;
> + else if (!proxy->browser_only && !default_all)
> + default_all = proxy;
> +
> continue;
> }
>
> @@ -531,27 +566,71 @@ char *pacrunner_proxy_lookup(const char *url, const
> char *host)
> case 4:
> if (compare_legacy_ip_in_net(&ip4_addr,
> data) == 0) {
> - selected_proxy = proxy;
> DBG("match proxy %p Legacy IP range %s",
> proxy, data->domain);
> - goto found;
> + if (browser_request) {
> + if (proxy->browser_only) {
> + selected_proxy = proxy;
> + goto matches;
> + } else if (!selected_proxy)
> + selected_proxy = proxy;
> + }
> + else {
> + if (!proxy->browser_only) {
> + selected_proxy = proxy;
> + goto matches;
> + } else {
> + /*
> + * Remember that domain
> + * matched config exist
> + * ed with browser_only
> + * TRUE.(We shouldn't
> + * fallback default_all)
> + */
> + remember = TRUE;
> + }
> + }
> }
> break;
> case 6:
> if (compare_ipv6_in_net(&ip6_addr,
> data) == 0) {
> - selected_proxy = proxy;
> DBG("match proxy %p IPv6 range %s",
> proxy, data->domain);
> - goto found;
> + if (browser_request) {
> + if (proxy->browser_only) {
> + selected_proxy = proxy;
> + goto matches;
> + } else if (!selected_proxy)
> + selected_proxy = proxy;
> + }
> + else {
> + if (!proxy->browser_only) {
> + selected_proxy = proxy;
> + goto matches;
> + } else
> + remember = TRUE;
> + }
> }
> break;
> default:
> if (compare_host_in_domain(host, data) == 0) {
> - selected_proxy = proxy;
> DBG("match proxy %p DNS domain %s",
> proxy, data->domain);
> - goto found;
> + if (browser_request) {
> + if (proxy->browser_only) {
> + selected_proxy = proxy;
> + goto matches;
> + } else if (!selected_proxy)
> + selected_proxy = proxy;
> + }
> + else {
> + if (!proxy->browser_only) {
> + selected_proxy = proxy;
> + goto matches;
> + } else
> + remember = TRUE;
> + }
> }
> break;
> }
> @@ -559,11 +638,20 @@ char *pacrunner_proxy_lookup(const char *url, const
> char *host)
> }
>
> if (!selected_proxy) {
> - DBG("default proxy %p", default_proxy);
> - selected_proxy = default_proxy;
> + if (browser_request) {
> + DBG("default proxy browser %p all %p",
> + default_browser, default_all);
> + if (default_browser)
> + selected_proxy = default_browser;
> + else
> + selected_proxy = default_all;
> + } else if (!browser_request && !remember) {
> + DBG("default proxy all %p", default_all);
> + selected_proxy = default_all;
> + }
> }
I'm not convinced this actually meets the criteria at the top of the
email. I think I prefer the version I sent out on Friday (at 18:32:10
+0200), which has an implementation that more closely matches the
documented requirements.
--
dwmw2
-------------- 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/20160814/6327f90e/attachment-0001.bin>
------------------------------
Message: 2
Date: Mon, 15 Aug 2016 12:59:24 +0300
From: Patrik Flykt <[email protected]>
To: Collin Richards <[email protected]>, [email protected]
Subject: Re: [PATCH RFC] service: Add AlwaysConnect feature
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"
Hi,
On Mon, 2016-07-25 at 16:13 -0500, Collin Richards wrote:
> +# Always connect all services that have autoconnect set to true. The default
> +# behavior (AlwaysConnect = false) will only connect the services if it is a
> +# higher preference technology than any services that are already connected.
> +# This setting is overriden if SingleConnectedTechnologies is enabled.
> +# AlwaysConnect = false
Had a discussion with Marcel, and this feature is better expressed as
AlwaysConnectedTechnologies that takes a list of technologies. This way
it is possible to define which technologies are to be always connected
instead of all.
SingleConnectedTechnologies, if defined, takes precedence
over?AlwaysConnectedTechnologies.
Could you spin a new patch based on the above?
Cheers,
Patrik
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 10, Issue 12
***************************************