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] gdhcp: Don't send DHCPREQUEST if last assigned IP is
Link Local Address (Saurav Babu)
2. Re: [PATCH] main: Create parent directories if not created
(Patrik Flykt)
3. Re: [PATCH] vpn: Add an optional configuration option to the
VPN plugin for choosing the device type. (Hendrik Donner)
----------------------------------------------------------------------
Message: 1
Date: Wed, 03 Feb 2016 19:41:09 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] gdhcp: Don't send DHCPREQUEST if last assigned IP is
Link Local Address
Message-ID:
<[email protected]>
In the following scenario:
1. connman is connected to a service and Link Local Address is obtained.
2. Disconnect the service.
3. Connect the service again.
connman tries to send DHCPREQUEST with last assigned IP which was Link
Local Address.
This patch makes connman to send DHCPDISCOVER when last assigned IP was
Link Local Address.
---
gdhcp/client.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 3bf8cb2..9012b38 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2832,7 +2832,8 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const
char *last_address)
addr = 0;
} else {
addr = ntohl(inet_addr(last_address));
- if (addr == 0xFFFFFFFF) {
+ if (addr == 0xFFFFFFFF || ((addr & LINKLOCAL_ADDR) ==
+ LINKLOCAL_ADDR)) {
addr = 0;
} else if (dhcp_client->last_address != last_address) {
g_free(dhcp_client->last_address);
--
1.9.1
------------------------------
Message: 2
Date: Wed, 03 Feb 2016 17:15:56 +0200
From: Patrik Flykt <[email protected]>
To: Saurav Babu <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] main: Create parent directories if not created
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"
On Wed, 2016-02-03 at 19:37 +0530, Saurav Babu wrote:
> When connman tries to create STORAGEDIR and its parent directory(/var/lib)
> doesn't exist then it fails to create STORAGEDIR. This patch creates
> parent directories also if they don't exist.
Hmm. This is normally handled by OS installation or image creation.
If /var/lib really does not exist, consider using systemd tmpfiles.d
instead.
Cheers,
Patrik
> ---
> src/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/main.c b/src/main.c
> index e46fa7b..17f0c95 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -617,7 +617,7 @@ int main(int argc, char *argv[])
> }
> }
>
> - if (mkdir(STORAGEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
> + if (g_mkdir_with_parents(STORAGEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
> S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) {
> if (errno != EEXIST)
> perror("Failed to create storage directory");
------------------------------
Message: 3
Date: Wed, 3 Feb 2016 19:56:53 +0100
From: Hendrik Donner <[email protected]>
To: [email protected]
Subject: Re: [PATCH] vpn: Add an optional configuration option to the
VPN plugin for choosing the device type.
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252
On 01/10/2016 03:50 PM, Hendrik Donner wrote:
> This allows to use virtual tap devices and removes the hardcoded default to
> virtual tun devices.
>
> Signed-off-by: Hendrik Donner <[email protected]>
> ---
> Only tested with OpenVPN. I have no idea if one of the other VPN plugins
> would benefit from tap device support.
>
> doc/connman-vpn-provider.config.5.in | 6 +++++-
> doc/vpn-config-format.txt | 2 ++
> vpn/plugins/openvpn.c | 2 +-
> vpn/plugins/vpn.c | 18 ++++++++++++------
> 4 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/doc/connman-vpn-provider.config.5.in
> b/doc/connman-vpn-provider.config.5.in
> index 5393260..c50fc46 100644
> --- a/doc/connman-vpn-provider.config.5.in
> +++ b/doc/connman-vpn-provider.config.5.in
> @@ -48,12 +48,16 @@ VPN server IP address.
> .BI Domain= domain
> Domain name for the VPN service.
> .TP
> -The following field is optional:
> +The following fields are optional:
> .TP
> .BI Networks= network / netmask / gateway [,...]
> Networks behind the VPN. If all traffic should go through the VPN, this
> field can be left out. The gateway can be left out. For IPv6 addresses,
> only the prefix length is accepted as the netmask.
> +.TP
> +.BI DeviceType= tun \fR|\fB tap
> +Whether the VPN should use a tun (OSI layer 3) or tap (OSI layer 2) device.
> +Defaults to tun if omitted.
> .SS OpenConnect
> The following keys can be used for \fBopenconnect\fP(8) networks:
> .TP
> diff --git a/doc/vpn-config-format.txt b/doc/vpn-config-format.txt
> index 1f5bac8..e33acfc 100644
> --- a/doc/vpn-config-format.txt
> +++ b/doc/vpn-config-format.txt
> @@ -44,6 +44,8 @@ VPN related parameters (M = mandatory, O = optional):
> is network/netmask/gateway. The gateway can be left out. (O)
> Example: 192.168.100.0/24/10.1.0.1,192.168.200.0/255.255.255.0/10.1.0.2
> For IPv6 addresses only prefix length is accepted like this 2001:db8::1/64
> +- DeviceType: Whether the VPN should use a tun (OSI layer 3) or tap
> + (OSI layer 2) device. Value is "tun" (default) or "tap" (O)
>
> OpenConnect VPN supports following options (see openconnect(8) for details):
> Option name OpenConnect option Description
> diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
> index 9ee5795..c920dc3 100644
> --- a/vpn/plugins/openvpn.c
> +++ b/vpn/plugins/openvpn.c
> @@ -71,6 +71,7 @@ struct {
> { "OpenVPN.CompLZO", "--comp-lzo", 0 },
> { "OpenVPN.RemoteCertTls", "--remote-cert-tls", 1 },
> { "OpenVPN.ConfigFile", "--config", 1 },
> + { "DeviceType", "--dev-type", 1 },
> };
>
> struct nameserver_entry {
> @@ -362,7 +363,6 @@ 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");
>
> connman_task_add_argument(task, "--persist-tun", NULL);
>
> diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c
> index 1b5af6e..a031c42 100644
> --- a/vpn/plugins/vpn.c
> +++ b/vpn/plugins/vpn.c
> @@ -56,6 +56,7 @@ struct vpn_data {
> unsigned int watch;
> enum vpn_state state;
> struct connman_task *task;
> + int tun_flags;
> };
>
> struct vpn_driver_data {
> @@ -89,7 +90,7 @@ static int stop_vpn(struct vpn_provider *provider)
> return 0;
>
> memset(&ifr, 0, sizeof(ifr));
> - ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
> + ifr.ifr_flags = data->tun_flags | IFF_NO_PI;
> sprintf(ifr.ifr_name, "%s", data->if_name);
>
> fd = open("/dev/net/tun", O_RDWR | O_CLOEXEC);
> @@ -335,7 +336,7 @@ static DBusMessage *vpn_notify(struct connman_task *task,
> return NULL;
> }
>
> -static int vpn_create_tun(struct vpn_provider *provider)
> +static int vpn_create_tun(struct vpn_provider *provider, int flags)
> {
> struct vpn_data *data = vpn_provider_get_data(provider);
> struct ifreq ifr;
> @@ -355,7 +356,7 @@ static int vpn_create_tun(struct vpn_provider *provider)
> }
>
> memset(&ifr, 0, sizeof(ifr));
> - ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
> + ifr.ifr_flags = flags | IFF_NO_PI;
>
> for (i = 0; i < 256; i++) {
> sprintf(ifr.ifr_name, "vpn%d", i);
> @@ -371,6 +372,7 @@ static int vpn_create_tun(struct vpn_provider *provider)
> goto exist_err;
> }
>
> + data->tun_flags = flags;
> data->if_name = (char *)g_strdup(ifr.ifr_name);
> if (!data->if_name) {
> connman_error("Failed to allocate memory");
> @@ -411,8 +413,8 @@ static int vpn_connect(struct vpn_provider *provider,
> {
> struct vpn_data *data = vpn_provider_get_data(provider);
> struct vpn_driver_data *vpn_driver_data;
> - const char *name;
> - int ret = 0;
> + const char *name, *tun;
> + int ret = 0, tun_flags = IFF_TUN;
> enum vpn_state state = VPN_STATE_UNKNOWN;
>
> if (data)
> @@ -460,7 +462,11 @@ static int vpn_connect(struct vpn_provider *provider,
> }
>
> if (vpn_driver_data->vpn_driver->flags != VPN_FLAG_NO_TUN) {
> - ret = vpn_create_tun(provider);
> + tun = vpn_provider_get_string(provider, "DeviceType");
> + if (g_str_equal(tun, "tap")) {
> + tun_flags = IFF_TAP;
> + }
> + ret = vpn_create_tun(provider, tun_flags);
> if (ret < 0)
> goto exist_err;
> }
>
Ping, i got no reaction so far.
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 4, Issue 4
*************************************