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: [PATCHv2 3/5] openvpn: Add support for tap devices
      (Hendrik Donner)
   2. Re: [PATCHv2 5/5] vpnc: Add support for tap devices
      (Hendrik Donner)
   3. Re: [PATCHv2 3/5] openvpn: Add support for tap devices
      (Patrik Flykt)
   4. Re: [PATCHv2 5/5] vpnc: Add support for tap devices (Patrik Flykt)
   5. Re: [PATCH] Add AlwaysUseFallbackNameservers flag in the
      configuration file. (Patrik Flykt)
   6. [PATCH] ipconfig: Get DHCP Server Address and provide to
      application (Saurav Babu)
   7. [PATCH] iptables-unit: Fixed dereferencing null pointer in
      assert_rule() (Nishant Chaprana)
   8. Re: [PATCH] ipconfig: Get DHCP Server Address and provide to
      application (Patrik Flykt)


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

Message: 1
Date: Mon, 29 Feb 2016 22:03:32 +0100
From: Hendrik Donner <[email protected]>
To: Patrik Flykt <[email protected]>
Cc: [email protected]
Subject: Re: [PATCHv2 3/5] openvpn: Add support for tap devices
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

Hello,

On 02/29/2016 09:40 AM, Patrik Flykt wrote:
> 
>       Hi,
> 
> On Sat, 2016-02-27 at 20:38 +0100, Hendrik Donner wrote:
>> Implement support for the OpenVPN.DeviceType configuration option by
>> implementing the device flags function and configuring OpenVPN properly.
>>
>> Signed-off-by: Hendrik Donner <[email protected]>
> 
> We don't use Signed-off-bys in ConnMan, I'd scrape it off when applying
> anyway so...
> 

 ok, will leave it out in v3...

>> ---
>>  vpn/plugins/openvpn.c | 23 ++++++++++++++++++++++-
>>  1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
>> index 9ee5795..814d635 100644
>> --- a/vpn/plugins/openvpn.c
>> +++ b/vpn/plugins/openvpn.c
>> @@ -29,6 +29,7 @@
>>  #include <unistd.h>
>>  #include <stdio.h>
>>  #include <net/if.h>
>> +#include <linux/if_tun.h>
>>  
>>  #include <glib.h>
>>  
>> @@ -71,6 +72,7 @@ struct {
>>      { "OpenVPN.CompLZO", "--comp-lzo", 0 },
>>      { "OpenVPN.RemoteCertTls", "--remote-cert-tls", 1 },
>>      { "OpenVPN.ConfigFile", "--config", 1 },
>> +    { "OpenVPN.DeviceType", NULL, 1 },
>>  };
>>  
>>  struct nameserver_entry {
>> @@ -362,7 +364,15 @@ static int ov_connect(struct vpn_provider *provider,
>>                                      connman_task_get_path(task));
>>  
>>      connman_task_add_argument(task, "--dev", if_name);
>> -    connman_task_add_argument(task, "--dev-type", "tun");
>> +    option = vpn_provider_get_string(provider, "OpenVPN.DeviceType");
>> +    if (option) {
>> +            connman_task_add_argument(task, "--dev-type", option);
>> +    } else {
>> +            /*
>> +             * Default to tun for backwards compatibility.
>> +             */
>> +            connman_task_add_argument(task, "--dev-type", "tun");
>> +    }
>>  
>>      connman_task_add_argument(task, "--persist-tun", NULL);
>>  
>> @@ -395,10 +405,21 @@ done:
>>      return err;
>>  }
>>  
>> +static int ov_device_flags(struct vpn_provider *provider)
>> +{
>> +    const char *tun;
> 
> Nitpick: empty line between variables and code.

Ok.

> 
>> +    tun = vpn_provider_get_string(provider, "OpenVPN.DeviceType");
>> +    if (tun) {
>> +            return g_str_equal(tun, "tap") ? IFF_TAP : IFF_TUN;
> 
> Here it'd be better if only "tun" or "tap" were accepted with anything
> else giving an error message.

But still falling back to IFF_TUN or completly failing device creation
in the caller?

> 
>> +    }
> 
> Nitpick: Empty line here too.

Ok.

Best regards,
Hendrik

> 
>> +    return IFF_TUN;
>> +}
>> +
>>  static struct vpn_driver vpn_driver = {
>>      .notify = ov_notify,
>>      .connect        = ov_connect,
>>      .save           = ov_save,
>> +    .device_flags = ov_device_flags,
>>  };
>>  
>>  static int openvpn_init(void)
> 
> 
>       Patrik
> 



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

Message: 2
Date: Mon, 29 Feb 2016 22:33:02 +0100
From: Hendrik Donner <[email protected]>
To: Patrik Flykt <[email protected]>
Cc: [email protected]
Subject: Re: [PATCHv2 5/5] vpnc: Add support for tap devices
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

Hello,

On 02/29/2016 09:45 AM, Patrik Flykt wrote:
> 
>       Hi,
> 
> On Sat, 2016-02-27 at 20:38 +0100, Hendrik Donner wrote:
>> Implement support for the VPNC.InferfaceMode configuration option by
>> implementing the device flags function and configuring VPNC properly.
>>
>> Signed-off-by: Hendrik Donner <[email protected]>
>> ---
>> Only compile tested.
>>
>>  vpn/plugins/vpnc.c | 22 +++++++++++++++++-----
>>  1 file changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/vpn/plugins/vpnc.c b/vpn/plugins/vpnc.c
>> index e358d63..afe1958 100644
>> --- a/vpn/plugins/vpnc.c
>> +++ b/vpn/plugins/vpnc.c
>> @@ -29,6 +29,7 @@
>>  #include <unistd.h>
>>  #include <stdio.h>
>>  #include <net/if.h>
>> +#include <linux/if_tun.h>
>>  
>>  #include <glib.h>
>>  
>> @@ -80,6 +81,7 @@ struct {
>>      { "VPNC.SingleDES", "Enable Single DES", NULL, OPT_BOOLEAN, true },
>>      { "VPNC.NoEncryption", "Enable no encryption", NULL, OPT_BOOLEAN,
>>                                                                      true },
>> +    { "VPNC.InterfaceMode", "Interface Mode", "tun", OPT_STRING, true },
>>  };
>>  
>>  static int vc_notify(DBusMessage *msg, struct vpn_provider *provider)
>> @@ -287,7 +289,6 @@ static int vc_connect(struct vpn_provider *provider,
>>      connman_task_add_argument(task, "--no-detach", NULL);
>>  
>>      connman_task_add_argument(task, "--ifname", if_name);
>> -    connman_task_add_argument(task, "--ifmode", "tun");
>>  
>>      connman_task_add_argument(task, "--script",
>>                              SCRIPTDIR "/openconnect-script");
>> @@ -329,11 +330,22 @@ static int vc_error_code(struct vpn_provider 
>> *provider, int exit_code)
>>      }
>>  }
> 
> Doesn't connman_task_add_argument(task, "--ifmode", "tun"); need to be
> set if there is no option specifying tun? Or is the --dev-type given as
> default for openvpn in patch 3/5 unnecessary?
> 

the VPNC plugin works differently, because struct vpnc_options contains
default values. I added VPNC.InterfaceMode with "tun" as default, that
should be applied when the configuration is written in
vc_write_config_data if no other value got specified. And man 8 vpnc
says tun is the default, so i guess the connman_task_add_argument(task,
"--ifmode", "tun"); line wasn't even needed in the first place.

I know see that this is probably not working: all values in struct
vpnc_options get piped to vpnc because vpnc prompts for them in a
specififc order and i guess it won't even prompt for the Interface Mode.
It should work with the same logic that I implemented for the  OpenVPN
plugin, will change that for v3.


According to man 8 openvpn, --dev-type is needed when the device name
does not begin with "tun" or "tap", so the OpenVPN plugin needs to be
more explicit.

>>  
>> +static int vc_device_flags(struct vpn_provider *provider)
>> +{
>> +    const char *tun;
> 
> Nitpick: empty line here.

Ok.

> 
>> +    tun = vpn_provider_get_string(provider, "VPNC.InterfaceMode");
> 
> This setting should be named identical after the VPNC. prefix to the one
> used for openvpn in order not to confuse the user.

The VPNC. options mirror the official VPNC configuration options (see
man 8 vpnc). The same largely holds for OpenVPN. So VPNC.InterfaceMode
is on purpose, it should look more familiar to VPNC users.

> 
>> +    if (tun) {
>> +            return g_str_equal(tun, "tap") ? IFF_TAP : IFF_TUN;
> 
> Same strictness comment applies here too, "tun", "tap" or error.
> 

So error message and fallback to tun? Or returning an error value and
failing device creation in the caller?

>> +    }
> 
> Nitpick: empty line would be nice here too, makes the code look lighter.
> 

Ok.

Best regards,
Hendrik

>> +    return IFF_TUN;
>> +}
>> +
>>  static struct vpn_driver vpn_driver = {
>> -    .notify         = vc_notify,
>> -    .connect        = vc_connect,
>> -    .error_code     = vc_error_code,
>> -    .save           = vc_save,
>> +    .notify           = vc_notify,
>> +    .connect          = vc_connect,
>> +    .error_code       = vc_error_code,
>> +    .save             = vc_save,
>> +    .device_flags = vc_device_flags,
>>  };
>>  
>>  static int vpnc_init(void)
> 
> Otherwise looks fine, thanks!
> 
>    Patrik
> 



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

Message: 3
Date: Tue, 01 Mar 2016 09:44:39 +0200
From: Patrik Flykt <[email protected]>
To: Hendrik Donner <[email protected]>
Cc: [email protected]
Subject: Re: [PATCHv2 3/5] openvpn: Add support for tap devices
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Mon, 2016-02-29 at 22:03 +0100, Hendrik Donner wrote:
> > Here it'd be better if only "tun" or "tap" were accepted with
> > anything else giving an error message.
> 
> But still falling back to IFF_TUN or completly failing device creation
> in the caller?

Falling back to IFF_TUN (including logging a warning) is a good idea, as
that has been the default since forever.

Cheers,

        Patrik




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

Message: 4
Date: Tue, 01 Mar 2016 10:01:47 +0200
From: Patrik Flykt <[email protected]>
To: Hendrik Donner <[email protected]>
Cc: [email protected]
Subject: Re: [PATCHv2 5/5] vpnc: Add support for tap devices
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"


        Hi,

On Mon, 2016-02-29 at 22:33 +0100, Hendrik Donner wrote:
> > Doesn't connman_task_add_argument(task, "--ifmode", "tun"); need to be
> > set if there is no option specifying tun? Or is the --dev-type given as
> > default for openvpn in patch 3/5 unnecessary?
> > 
> 
> the VPNC plugin works differently, because struct vpnc_options contains
> default values. I added VPNC.InterfaceMode with "tun" as default, that
> should be applied when the configuration is written in
> vc_write_config_data if no other value got specified. And man 8 vpnc
> says tun is the default, so i guess the connman_task_add_argument(task,
> "--ifmode", "tun"); line wasn't even needed in the first place.
> 
> I know see that this is probably not working: all values in struct
> vpnc_options get piped to vpnc because vpnc prompts for them in a
> specififc order and i guess it won't even prompt for the Interface Mode.
> It should work with the same logic that I implemented for the  OpenVPN
> plugin, will change that for v3.
> 
> 
> According to man 8 openvpn, --dev-type is needed when the device name
> does not begin with "tun" or "tap", so the OpenVPN plugin needs to be
> more explicit.

Ok, thanks for letting me omit reading said man page :-).

> The VPNC. options mirror the official VPNC configuration options (see
> man 8 vpnc). The same largely holds for OpenVPN. So VPNC.InterfaceMode
> is on purpose, it should look more familiar to VPNC users.

Here I'd like some consistency from ConnMan as it'd make adding options
to vpn cofiguration easier. Vpn settings are anyway only a subset of all
possible configurations, so when specifying identical behavior they
should be named the same. Unfortunately not everything went this way in
the past.

> So error message and fallback to tun? Or returning an error value and
> failing device creation in the caller?

Fallback to TUN and log a  warning.

Cheers,

        Patrik



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

Message: 5
Date: Tue, 01 Mar 2016 10:09:25 +0200
From: Patrik Flykt <[email protected]>
To: wangfe-nestlabs <[email protected]>
Cc: [email protected], Grant Erickson <[email protected]>
Subject: Re: [PATCH] Add AlwaysUseFallbackNameservers flag in the
        configuration file.
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"


        Hi,

On Mon, 2016-02-29 at 10:07 -0800, wangfe-nestlabs wrote:
> The device only supports wifi service.  The DNS servers got from ISP
> through DHCP is flaky.  To make DNS work better,  user can specify
> some backup DNS servers. And this feature is configurable, by default
> it is turned off.  Only some users experienced such problem can turn
> it on.

Perhaps Nameservers.Config or Nameservers in the .config file if the
service is provisioned can then be set to some useful values, as this
applies only to a certain ISP.

Cheers,

        Patrik




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

Message: 6
Date: Tue, 01 Mar 2016 14:25:31 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] ipconfig: Get DHCP Server Address and provide to
        application
Message-ID:
        <[email protected]>

DHCP Server Address might be useful for some application if DHCP server
is in a different network. This patch gets the DHCP Server address and
provides it to application in IPv4 Property when ipconfig->method is
CONNMAN_IPCONFIG_METHOD_DHCP.
---
 src/ipconfig.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/ipconfig.c b/src/ipconfig.c
index 0dc702b..5b96a12 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -1818,6 +1818,16 @@ void __connman_ipconfig_append_ipv4(struct 
connman_ipconfig *ipconfig,
        if (append_addr->gateway)
                connman_dbus_dict_append_basic(iter, "Gateway",
                                DBUS_TYPE_STRING, &append_addr->gateway);
+
+       if (ipconfig->method == CONNMAN_IPCONFIG_METHOD_DHCP) {
+               char *server_ip;
+               server_ip = __connman_dhcp_get_server_address(ipconfig);
+               if (server_ip) {
+                       connman_dbus_dict_append_basic(iter, "DHCPServerIP",
+                                       DBUS_TYPE_STRING, &server_ip);
+                       g_free(server_ip);
+               }
+       }
 }
 
 void __connman_ipconfig_append_ipv6(struct connman_ipconfig *ipconfig,
-- 
1.9.1



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

Message: 7
Date: Tue, 01 Mar 2016 15:18:39 +0530
From: Nishant Chaprana <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] iptables-unit: Fixed dereferencing null pointer in
        assert_rule()
Message-ID: <[email protected]>

---
 tools/iptables-unit.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/iptables-unit.c b/tools/iptables-unit.c
index 9c09867..d261106 100644
--- a/tools/iptables-unit.c
+++ b/tools/iptables-unit.c
@@ -43,15 +43,14 @@ static bool assert_rule(const char *table_name, const char 
*rule)
 
        for (i = 0; lines[i]; i++) {
                DBG("lines[%02d]: %s\n", i, lines[i]);
-               if (g_strcmp0(lines[i], rule) == 0)
-                       break;
+               if (g_strcmp0(lines[i], rule) == 0) {
+                       g_strfreev(lines);
+                       return true;
+               }
        }
-       g_strfreev(lines);
-
-       if (!lines[i])
-               return false;
 
-       return true;
+       g_strfreev(lines);
+       return false;
 }
 
 static void assert_rule_exists(const char *table_name, const char *rule)
-- 
1.9.1



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

Message: 8
Date: Tue, 01 Mar 2016 15:55:41 +0200
From: Patrik Flykt <[email protected]>
To: Saurav Babu <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] ipconfig: Get DHCP Server Address and provide to
        application
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Tue, 2016-03-01 at 14:25 +0530, Saurav Babu wrote:
> DHCP Server Address might be useful for some application if DHCP server
> is in a different network. This patch gets the DHCP Server address and
> provides it to application in IPv4 Property when ipconfig->method is
> CONNMAN_IPCONFIG_METHOD_DHCP.

And what would this be useful for?

Cheers,

        Patrik



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

Subject: Digest Footer

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


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

End of connman Digest, Vol 5, Issue 1
*************************************

Reply via email to