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. [PATCH v0 0/2] OpenVPN logging (Daniel Wagner)
   2. [PATCH v0 1/2] openvpn: Fix stdout/stderr forwarding from
      deamon (Daniel Wagner)
   3. [PATCH v0 2/2] openvpn: Add verbose flag (Daniel Wagner)
   4. Re: [PATCH] PacRunner:Domains are looked up to match the host
      (David Woodhouse)


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

Message: 1
Date: Wed,  8 Jun 2016 09:54:13 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v0 0/2] OpenVPN logging
Message-ID: <[email protected]>

From: Daniel Wagner <[email protected]>

Hi,

I am debugging some network setups here and found out that we don't
log anything from OpenVPN which is pretty sad. Let's fix this.

cheers,
daniel

Daniel Wagner (2):
  openvpn: Fix stdout/stderr forwarding from deamon
  openvpn: Add verbose flag

 vpn/plugins/openvpn.c | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 5 deletions(-)

-- 
2.5.5


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

Message: 2
Date: Wed,  8 Jun 2016 09:54:14 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v0 1/2] openvpn: Fix stdout/stderr forwarding from
        deamon
Message-ID: <[email protected]>

From: Daniel Wagner <[email protected]>

The OpenVPN daemon syslog command has no effect for some unknown
reason. So let's forward the log output to our program.

As we are using connman_task_run() wrong we need to read from
the FDs instead.
---
 vpn/plugins/openvpn.c | 48 +++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 43 insertions(+), 5 deletions(-)

diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
index 75bdcd4..8bce9d2 100644
--- a/vpn/plugins/openvpn.c
+++ b/vpn/plugins/openvpn.c
@@ -308,13 +308,53 @@ static int task_append_config_data(struct vpn_provider 
*provider,
        return 0;
 }
 
+static gboolean can_read_data(GIOChannel *chan,
+                                GIOCondition cond, gpointer data)
+{
+       gchar *str;
+       gsize size;
+
+       if (cond == G_IO_HUP) {
+               g_io_channel_unref(chan);
+               return FALSE;
+       }
+
+       g_io_channel_read_line(chan, &str, &size, NULL, NULL);
+       printf(str);
+       g_free(str);
+
+       return TRUE;
+}
+
+static int setup_log_read(int stdout_fd, int stderr_fd)
+{
+       GIOChannel *chan;
+       int watch;
+
+       chan = g_io_channel_unix_new(stdout_fd);
+       g_io_channel_set_close_on_unref(chan, TRUE);
+       watch = g_io_add_watch(chan, G_IO_IN, can_read_data, NULL);
+       g_io_channel_unref(chan);
+
+       if (watch == 0)
+               return -EIO;
+
+       chan = g_io_channel_unix_new(stderr_fd);
+       g_io_channel_set_close_on_unref(chan, TRUE);
+       watch = g_io_add_watch(chan, G_IO_IN, can_read_data, NULL);
+       g_io_channel_unref(chan);
+
+       return watch == 0? -EIO : 0;
+}
+
 static int ov_connect(struct vpn_provider *provider,
                        struct connman_task *task, const char *if_name,
                        vpn_provider_connect_cb_t cb, const char *dbus_sender,
                        void *user_data)
 {
        const char *option;
-       int err = 0, fd;
+       int stdout_fd, stderr_fd;
+       int err = 0;
 
        option = vpn_provider_get_string(provider, "Host");
        if (!option) {
@@ -343,8 +383,6 @@ static int ov_connect(struct vpn_provider *provider,
                connman_task_add_argument(task, "--client", NULL);
        }
 
-       connman_task_add_argument(task, "--syslog", NULL);
-
        connman_task_add_argument(task, "--script-security", "2");
 
        connman_task_add_argument(task, "--up",
@@ -389,15 +427,15 @@ static int ov_connect(struct vpn_provider *provider,
         */
        connman_task_add_argument(task, "--ping-restart", "0");
 
-       fd = fileno(stderr);
        err = connman_task_run(task, vpn_died, provider,
-                       NULL, &fd, &fd);
+                       NULL, &stdout_fd, &stderr_fd);
        if (err < 0) {
                connman_error("openvpn failed to start");
                err = -EIO;
                goto done;
        }
 
+       err = setup_log_read(stdout_fd, stderr_fd);
 done:
        if (cb)
                cb(provider, user_data, err);
-- 
2.5.5


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

Message: 3
Date: Wed,  8 Jun 2016 09:54:15 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v0 2/2] openvpn: Add verbose flag
Message-ID: <[email protected]>

From: Daniel Wagner <[email protected]>

Allow the user to set the verbosity which is helpful while
debugging network setups.
---
 vpn/plugins/openvpn.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
index 8bce9d2..28adf30 100644
--- a/vpn/plugins/openvpn.c
+++ b/vpn/plugins/openvpn.c
@@ -73,6 +73,7 @@ struct {
        { "OpenVPN.RemoteCertTls", "--remote-cert-tls", 1 },
        { "OpenVPN.ConfigFile", "--config", 1 },
        { "OpenVPN.DeviceType", NULL, 1 },
+       { "OpenVPN.Verb", "--verb", 1 },
 };
 
 struct nameserver_entry {
-- 
2.5.5


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

Message: 4
Date: Wed, 08 Jun 2016 11:43:08 +0100
From: David Woodhouse <[email protected]>
To: Atul Anand <[email protected]>, [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 Tue, 2016-06-07 at 17:11 +0530, Atul Anand wrote:
> @@ -37,8 +40,19 @@ struct pacrunner_proxy {
> ?     char *script;
> ?     GList **servers;
> ?     GList **excludes;
> +     GList *domains;
> ?};
> ?
> +typedef struct {
> +     char *domain;
> +     int proto;
> +     union {
> +             struct in_addr ip4;
> +             struct in6_addr ip6;
> +     } addr;
> +     int mask;
> +} Domain;
> +
> ?static GList *proxy_list = NULL;
> ?static pthread_mutex_t proxy_mutex;
> ?static pthread_cond_t proxy_cond;
> @@ -77,6 +91,23 @@ struct pacrunner_proxy *pacrunner_proxy_ref(struct 
> pacrunner_proxy *proxy)
> ?     return proxy;
> ?}
> ?
> +static Domain * domain_new(void)

Do not be frightened of the word "struct". You are writing code in C.
Do not obfuscate it.

Call your structure, "struct domain". Or "struct proxy_domain" if you
prefer. Not "Domain". Don't use capital letters, and don't typedef the
'struct' out of it.

You probably don't need a 'domain_new()' function which is a one-line
call to g_malloc0(). And your domain_destroy() function probably
doesn't need to memset it to zero right before freeing it.

Other than that, looking good. Did you test the bits of the matching
logic which I basically typed in without really thinking about them,
intending you to pay attention to the details? :)

We should extend the tests in unit/ to install parallel proxy configs,
then do some test queries and ensure that the correct results are
reported for various subdomains/IP ranges.

-- 
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/20160608/17445699/attachment-0001.bin>

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

Subject: Digest Footer

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


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

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

Reply via email to