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] vpn: Use Connect2 method only when D-Bus sender is
      set (Jussi Laakkonen)
   2. Re: [PATCH] vpn: Use Connect2 method only when D-Bus sender
      is set (Slava Monich)
   3. Re: [PATCH] vpn: Use Connect2 method only when D-Bus sender
      is set (Jussi Laakkonen)
   4. [PATCH 1/3] vpn: Use Connect2 method only when D-Bus sender
      is set (Jussi Laakkonen)
   5. [PATCH 2/3] doc: Add Connect2 D-Bus method description to VPN
      connection API (Jussi Laakkonen)
   6. [PATCH 3/3] vpn: Move definition of Connect2 to VPN
      connection D-Bus API header (Jussi Laakkonen)


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

Message: 1
Date: Fri, 28 Sep 2018 10:56:58 +0300
From: Jussi Laakkonen <[email protected]>
To: [email protected]
Subject: [PATCH] vpn: Use Connect2 method only when D-Bus sender is
        set
Message-ID: <[email protected]>

This fix addresses the issue of not being able to connect a VPN if it
has autoconnect set and connection is triggered by connmand. In such
case dbus_sender is not set and call to Connect2 method of
net.connman.vpn.Connection cannot be done.

This amends changes of commit 3997c1595fe44d7c85215fd1cd89ecf778c62206.
---
 plugins/vpn.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/plugins/vpn.c b/plugins/vpn.c
index 3d067a49..5282cb0f 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -546,15 +546,18 @@ static int connect_provider(struct connection_data *data, 
void *user_data,
 #define VPN_CONNECT2 "Connect2"
 
        /* We need to pass original dbus sender to connman-vpnd,
-        * use a Connect2 method for that.
+        * use a Connect2 method for that if the original dbus sender is set.
+        * Connect method requires no parameter, Connect2 requires dbus sender
+        * name to be set.
         */
        message = dbus_message_new_method_call(VPN_SERVICE, data->path,
                                        VPN_CONNECTION_INTERFACE,
-                                       VPN_CONNECT2);
+                                       dbus_sender && *dbus_sender ?
+                                               VPN_CONNECT2 : VPN_CONNECT);
        if (!message)
                return -ENOMEM;
 
-       if (dbus_sender)
+       if (dbus_sender && *dbus_sender)
                dbus_message_append_args(message, DBUS_TYPE_STRING,
                                        &dbus_sender, NULL);
        else
-- 
2.11.0



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

Message: 2
Date: Fri, 28 Sep 2018 11:57:17 +0300
From: Slava Monich <[email protected]>
To: [email protected]
Subject: Re: [PATCH] vpn: Use Connect2 method only when D-Bus sender
        is set
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed

On 28/09/18 10:56, Jussi Laakkonen wrote:
> This fix addresses the issue of not being able to connect a VPN if it
> has autoconnect set and connection is triggered by connmand. In such
> case dbus_sender is not set and call to Connect2 method of
> net.connman.vpn.Connection cannot be done.
>
> This amends changes of commit 3997c1595fe44d7c85215fd1cd89ecf778c62206.
> ---
>   plugins/vpn.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/plugins/vpn.c b/plugins/vpn.c
> index 3d067a49..5282cb0f 100644
> --- a/plugins/vpn.c
> +++ b/plugins/vpn.c
> @@ -546,15 +546,18 @@ static int connect_provider(struct connection_data 
> *data, void *user_data,
>   #define VPN_CONNECT2 "Connect2"

doc/vpn-connection-api.txt needs to be updated too, there's no Connect2 
method there.

And the right place for VPN_CONNECT2 definition is vpn-dbus.h, next to 
VPN_CONNECT.

Cheers,
-Slava


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

Message: 3
Date: Fri, 28 Sep 2018 15:11:16 +0300
From: Jussi Laakkonen <[email protected]>
To: Slava Monich <[email protected]>, [email protected]
Subject: Re: [PATCH] vpn: Use Connect2 method only when D-Bus sender
        is set
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed

On 9/28/18 11:57 AM, Slava Monich wrote:
> On 28/09/18 10:56, Jussi Laakkonen wrote:
>> This fix addresses the issue of not being able to connect a VPN if it
>> has autoconnect set and connection is triggered by connmand. In such
>> case dbus_sender is not set and call to Connect2 method of
>> net.connman.vpn.Connection cannot be done.
>>
>> This amends changes of commit 3997c1595fe44d7c85215fd1cd89ecf778c62206.
>> ---
>> ? plugins/vpn.c | 9 ++++++---
>> ? 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/plugins/vpn.c b/plugins/vpn.c
>> index 3d067a49..5282cb0f 100644
>> --- a/plugins/vpn.c
>> +++ b/plugins/vpn.c
>> @@ -546,15 +546,18 @@ static int connect_provider(struct 
>> connection_data *data, void *user_data,
>> ? #define VPN_CONNECT2 "Connect2"
> 
> doc/vpn-connection-api.txt needs to be updated too, there's no Connect2 
> method there.
> 
> And the right place for VPN_CONNECT2 definition is vpn-dbus.h, next to 
> VPN_CONNECT.
> 
> Cheers,
> -Slava

Hi,

Yeah, sure, ignore this single patch. I'll make the changes introduced 
here and send a patch set.

- Jussi


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

Message: 4
Date: Fri, 28 Sep 2018 15:33:04 +0300
From: Jussi Laakkonen <[email protected]>
To: [email protected]
Subject: [PATCH 1/3] vpn: Use Connect2 method only when D-Bus sender
        is set
Message-ID: <[email protected]>

This fix addresses the issue of not being able to connect a VPN if it
has autoconnect set and connection is triggered by connmand. In such
case dbus_sender is not set and call to Connect2 method of
net.connman.vpn.Connection cannot be done.

Also, print correct D-Bus method called in case of error. If the
dbus_sender is not set or is empty Connect() will be used instead of
Connect2().

This amends changes of commit 3997c1595fe44d7c85215fd1cd89ecf778c62206.
---
 plugins/vpn.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/plugins/vpn.c b/plugins/vpn.c
index 3d067a49..2064bfc0 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -546,15 +546,18 @@ static int connect_provider(struct connection_data *data, 
void *user_data,
 #define VPN_CONNECT2 "Connect2"
 
        /* We need to pass original dbus sender to connman-vpnd,
-        * use a Connect2 method for that.
+        * use a Connect2 method for that if the original dbus sender is set.
+        * Connect method requires no parameter, Connect2 requires dbus sender
+        * name to be set.
         */
        message = dbus_message_new_method_call(VPN_SERVICE, data->path,
                                        VPN_CONNECTION_INTERFACE,
-                                       VPN_CONNECT2);
+                                       dbus_sender && *dbus_sender ?
+                                               VPN_CONNECT2 : VPN_CONNECT);
        if (!message)
                return -ENOMEM;
 
-       if (dbus_sender)
+       if (dbus_sender && *dbus_sender)
                dbus_message_append_args(message, DBUS_TYPE_STRING,
                                        &dbus_sender, NULL);
        else
@@ -563,7 +566,8 @@ static int connect_provider(struct connection_data *data, 
void *user_data,
        if (!dbus_connection_send_with_reply(connection, message,
                                                &call, DBUS_TIMEOUT)) {
                connman_error("Unable to call %s.%s()",
-                       VPN_CONNECTION_INTERFACE, VPN_CONNECT2);
+                       VPN_CONNECTION_INTERFACE, dbus_sender && *dbus_sender ?
+                                               VPN_CONNECT2 : VPN_CONNECT);
                dbus_message_unref(message);
                return -EINVAL;
        }
-- 
2.11.0



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

Message: 5
Date: Fri, 28 Sep 2018 15:33:05 +0300
From: Jussi Laakkonen <[email protected]>
To: [email protected]
Subject: [PATCH 2/3] doc: Add Connect2 D-Bus method description to VPN
        connection API
Message-ID: <[email protected]>

Add description of Connect2() to VPN connection API txt. Connect2() was
introduced in commit 3997c1595fe44d7c85215fd1cd89ecf778c62206.
---
 doc/vpn-connection-api.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/doc/vpn-connection-api.txt b/doc/vpn-connection-api.txt
index a814a388..1fd3be26 100644
--- a/doc/vpn-connection-api.txt
+++ b/doc/vpn-connection-api.txt
@@ -39,6 +39,19 @@ Methods              dict GetProperties()  [experimental]
                        Possible Errors: [connection].Error.InvalidArguments
                                        [connection].Error.InProgress
 
+               void Connect2(string dbus_sender) [experimental]
+
+                       Connect this VPN connection. The Connect2() is a
+                       wrapper for Connect() allowing to pass original D-Bus
+                       sender when proxying the connection request. The
+                       Connect2() will wait until the connection is created or
+                       there is an error. The error description is returned in
+                       dbus error.
+
+                       Possible Errors: [connection].Error.InvalidArguments
+                                       [connection].Error.InProgress
+
+
                void Disconnect() [experimental]
 
                        Disconnect this VPN connection. If the connection is
-- 
2.11.0



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

Message: 6
Date: Fri, 28 Sep 2018 15:33:06 +0300
From: Jussi Laakkonen <[email protected]>
To: [email protected]
Subject: [PATCH 3/3] vpn: Move definition of Connect2 to VPN
        connection D-Bus API header
Message-ID: <[email protected]>

Move Connect2() method definition into vpn-dbus.h. Connect2() was
introduced in commit 3997c1595fe44d7c85215fd1cd89ecf778c62206.
---
 include/vpn-dbus.h | 1 +
 plugins/vpn.c      | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/vpn-dbus.h b/include/vpn-dbus.h
index 01780cbd..07743bd0 100644
--- a/include/vpn-dbus.h
+++ b/include/vpn-dbus.h
@@ -48,6 +48,7 @@ extern "C" {
 #define PROPERTY_CHANGED               "PropertyChanged"
 #define GET_CONNECTIONS                        "GetConnections"
 #define VPN_CONNECT                    "Connect"
+#define VPN_CONNECT2                   "Connect2"
 #define VPN_DISCONNECT                 "Disconnect"
 #define VPN_REMOVE                     "Remove"
 
diff --git a/plugins/vpn.c b/plugins/vpn.c
index 2064bfc0..22d69a36 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -543,8 +543,6 @@ static int connect_provider(struct connection_data *data, 
void *user_data,
 
        data->connect_pending = false;
 
-#define VPN_CONNECT2 "Connect2"
-
        /* We need to pass original dbus sender to connman-vpnd,
         * use a Connect2 method for that if the original dbus sender is set.
         * Connect method requires no parameter, Connect2 requires dbus sender
-- 
2.11.0



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

Subject: Digest Footer

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


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

End of connman Digest, Vol 35, Issue 13
***************************************

Reply via email to