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] technology: Allow raw key for tethering (i.e. 64
      bytes in hexadecimal representation) (Patrik Flykt)
   2. Re: [PATCH] technology: Allow raw key for tethering (i.e. 64
      bytes in hexadecimal representation) (Jose Blanquicet)
   3. dhcp failure and link local (Prasant J)
   4. [PATCH v2] technology: Allow raw key for tethering (i.e. 64
      bytes in hexadecimal representation) (Jose Blanquicet)
   5. RE: [PATCH v2] nat: Remember previous IPv4 forwarding value
      (Blanquicet-Melendez Jose (MM))
   6. Re: dhcp failure and link local (Patrik Flykt)
   7. Re: [PATCH v2] technology: Allow raw key for tethering (i.e.
      64 bytes in hexadecimal representation) (Patrik Flykt)
   8. [PATCH] nat: Open IPv4 forwarding file with proper mode
      (Patrik Flykt)


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

Message: 1
Date: Fri, 15 Apr 2016 09:28:58 +0300
From: Patrik Flykt <[email protected]>
To: Jose Blanquicet <[email protected]>, [email protected]
Subject: Re: [PATCH] technology: Allow raw key for tethering (i.e. 64
        bytes in hexadecimal representation)
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Thu, 2016-04-14 at 11:18 +0200, Jose Blanquicet wrote:
> Although the gsupplicant component allows to use a raw key when a new?
> network is being created through the function add_network_security_psk,?
> the technology component does not allow it because in order to set the?
> property TetheringPassphrase the string's length must be within the?
> range [8, 63], otherwise it will be taken as wrong value without check?
> if it is a raw key.
> 
> ---
> ?src/technology.c | 10 +++++++++-
> ?1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/src/technology.c b/src/technology.c
> index 1891d06..ffc34ca 100644
> --- a/src/technology.c
> +++ b/src/technology.c
> @@ -917,13 +917,21 @@ static DBusMessage *set_property(DBusConnection *conn,
> ?             }
> ?     } else if (g_str_equal(name, "TetheringPassphrase")) {
> ?             const char *str;
> +             int i;
> +             size_t len;
> 
> ?             dbus_message_iter_get_basic(&value, &str);
> +             len = strlen(str);
> ?
> ?             if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
> ?                     return __connman_error_not_supported(msg);
> ?
> -             if (strlen(str) < 8 || strlen(str) > 63)
> +             if (len == 64) {
> +                     for (i = 0; i < 64; i++)
> +                             if (!g_ascii_isxdigit(str[i]))
> +                                     return 
> __connman_error_passphrase_required(msg);
> +             }
> +             else if (len < 8 || len > 63)
> ?                     return __connman_error_passphrase_required(msg);
> ?
> ?             if (g_strcmp0(technology->tethering_passphrase, str) != 0) {

WiFi passphrase/password checking already exists in
service.c,?check_passphrase(). If that function were exported in
src/connman.h for example as __connman_service_check_passphrase(), the
password check can be done centrally in one
place.?CONNMAN_SERVICE_SECURITY_PSK is the only WiFi security type
currently used for tethering.


Cheers,

        Patrik



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

Message: 2
Date: Fri, 15 Apr 2016 09:28:40 +0200
From: Jose Blanquicet <[email protected]>
To: Patrik Flykt <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] technology: Allow raw key for tethering (i.e. 64
        bytes in hexadecimal representation)
Message-ID:
        <CAFC8iJJxfU+wpF2DTr1W=t4iten571094lnsbziwreagyxa...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi,

I agree, you are right. I'll send a second version of the patch
following your suggestions.

Best regards,

Jose Blanquicet

On Fri, Apr 15, 2016 at 8:28 AM, Patrik Flykt
<[email protected]> wrote:
> On Thu, 2016-04-14 at 11:18 +0200, Jose Blanquicet wrote:
>> Although the gsupplicant component allows to use a raw key when a new
>> network is being created through the function add_network_security_psk,
>> the technology component does not allow it because in order to set the
>> property TetheringPassphrase the string's length must be within the
>> range [8, 63], otherwise it will be taken as wrong value without check
>> if it is a raw key.
>>
>> ---
>>  src/technology.c | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/technology.c b/src/technology.c
>> index 1891d06..ffc34ca 100644
>> --- a/src/technology.c
>> +++ b/src/technology.c
>> @@ -917,13 +917,21 @@ static DBusMessage *set_property(DBusConnection *conn,
>>               }
>>       } else if (g_str_equal(name, "TetheringPassphrase")) {
>>               const char *str;
>> +             int i;
>> +             size_t len;
>>
>>               dbus_message_iter_get_basic(&value, &str);
>> +             len = strlen(str);
>>
>>               if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
>>                       return __connman_error_not_supported(msg);
>>
>> -             if (strlen(str) < 8 || strlen(str) > 63)
>> +             if (len == 64) {
>> +                     for (i = 0; i < 64; i++)
>> +                             if (!g_ascii_isxdigit(str[i]))
>> +                                     return 
>> __connman_error_passphrase_required(msg);
>> +             }
>> +             else if (len < 8 || len > 63)
>>                       return __connman_error_passphrase_required(msg);
>>
>>               if (g_strcmp0(technology->tethering_passphrase, str) != 0) {
>
> WiFi passphrase/password checking already exists in
> service.c, check_passphrase(). If that function were exported in
> src/connman.h for example as __connman_service_check_passphrase(), the
> password check can be done centrally in one
> place. CONNMAN_SERVICE_SECURITY_PSK is the only WiFi security type
> currently used for tethering.
>
>
> Cheers,
>
>         Patrik
>


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

Message: 3
Date: Fri, 15 Apr 2016 13:15:03 +0530
From: Prasant J <[email protected]>
To: [email protected]
Subject: dhcp failure and link local
Message-ID:
        <CAA2DH4vmBNJ9=qf3pkdf-rxjcmdntv-mgecny+-2y3p-nz4...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi,

I'm working with imx6q based system (using yocto jethro release). It
uses connman version 1.28.


I have observed is that when the dhcp server does not respond, connman
treis 6 times (after every 6 secs) and then falls back to ipv4ll
address.
Then after every 65-66 secs this is repeated (ipv4ll address does not change).


I want my embedded linux system to stop looking out for DHCP server
(stop sending DISCOVERY packets) after ipv4ll address is assigned.
Is it possible? If yes, do I need to change the code or is there a
configuration file?


Any inputs will be of help to me.


Regards, Pj


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

Message: 4
Date: Fri, 15 Apr 2016 09:47:30 +0200
From: Jose Blanquicet <[email protected]>
To: [email protected]
Subject: [PATCH v2] technology: Allow raw key for tethering (i.e. 64
        bytes in hexadecimal representation)
Message-ID: <[email protected]>

Although the gsupplicant component allows to use a raw key when a new 
network is being created through the function add_network_security_psk, 
the technology component does not allow it because in order to set the 
property TetheringPassphrase the string's length must be within the 
range [8, 63], otherwise it will be taken as wrong value without check 
if it is a raw key.

This patch uses Wi-Fi passphrase/password checking already implemented 
in service.c, check_passphrase(), exporting it in src/connman.h. The 
connman_service_security argument is hard-coded to 
CONNMAN_SERVICE_SECURITY_PSK because it is the only Wi-Fi security type 
currently supported for thethering.

---
 src/connman.h    | 2 ++
 src/service.c    | 4 ++--
 src/technology.c | 6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/connman.h b/src/connman.h
index c74ab91..e849ed8 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -781,6 +781,8 @@ void __connman_service_set_agent_identity(struct 
connman_service *service,
 int __connman_service_set_passphrase(struct connman_service *service,
                                        const char *passphrase);
 const char *__connman_service_get_passphrase(struct connman_service *service);
+int __connman_service_check_passphrase(enum connman_service_security security,
+                                       const char *passphrase);
 int __connman_service_reset_ipconfig(struct connman_service *service,
                enum connman_ipconfig_type type, DBusMessageIter *array,
                enum connman_service_state *new_state);
                
diff --git a/src/service.c b/src/service.c
index a54e4da..768426b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2831,7 +2831,7 @@ void __connman_service_set_agent_identity(struct 
connman_service *service,
                                        service->agent_identity);
 }
 
-static int check_passphrase(enum connman_service_security security,
+int __connman_service_check_passphrase(enum connman_service_security security,
                const char *passphrase)
 {
        guint i;
@@ -2898,7 +2898,7 @@ int __connman_service_set_passphrase(struct 
connman_service *service,
                        service->security != CONNMAN_SERVICE_SECURITY_8021X)
                return -EINVAL;
 
-       err = check_passphrase(service->security, passphrase);
+       err = __connman_service_check_passphrase(service->security, passphrase);
 
        if (err < 0)
                return err;
                
diff --git a/src/technology.c b/src/technology.c
index 1891d06..442557b 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -841,7 +841,7 @@ static DBusMessage *set_property(DBusConnection *conn,
        struct connman_technology *technology = data;
        DBusMessageIter iter, value;
        const char *name;
-       int type;
+       int type, err;
 
        DBG("conn %p", conn);
 
@@ -923,7 +923,9 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
                        return __connman_error_not_supported(msg);
 
-               if (strlen(str) < 8 || strlen(str) > 63)
+               err = 
__connman_service_check_passphrase(CONNMAN_SERVICE_SECURITY_PSK, 
+                                                       str);
+               if (err < 0)
                        return __connman_error_passphrase_required(msg);
 
                if (g_strcmp0(technology->tethering_passphrase, str) != 0) {
-- 
1.9.1



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

Message: 5
Date: Fri, 15 Apr 2016 08:53:41 +0000
From: "Blanquicet-Melendez Jose (MM)"
        <[email protected]>
To: Patrik Flykt <[email protected]>,
        "[email protected]" <[email protected]>
Subject: RE: [PATCH v2] nat: Remember previous IPv4 forwarding value
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"


Hi,

After this patch was applied I have not been able to enable tethering. Through 
debugging I found that function __connman_nat_enable returns the error: "Cannot 
enable NAT -9/Bad file descriptor", this error is gotten when parameter 
ip_forward is trying to be modified by editing the file with write() fucntion. 

Trying to find the reason of the error I added the O_RDWR mode in open() to 
check if it was a permissions problem but it did not work and it continue 
giving the same error. Next, I tried to come back to fopen() instead of use 
open() and it worked. 

What do you think is happening? What is wrong when file 
"/proc/sys/net/ipv4/ip_forward" is handled with the system calls 
open/read/write instead of standard functions fopen/fprintf/fscanf?

Best regards,

Jose Blanquicet
      
-----Original Message-----
From: connman [mailto:[email protected]] On Behalf Of Patrik Flykt
Sent: marted? 12 aprile 2016 15:02
To: [email protected]
Subject: [PATCH v2] nat: Remember previous IPv4 forwarding value

When NAT is enabled, store the previous IPv4 forwarding setting so that it can 
be restored to its former value when disabling NAT.
---

v2: Fix err = -errno and fix a few conditionals to be more readable

src/nat.c | 40 ++++++++++++++++++++++++++++++----------
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/src/nat.c b/src/nat.c
index 063f085..b739e11 100644
--- a/src/nat.c
+++ b/src/nat.c
@@ -25,7 +25,10 @@
 #endif
 
 #include <errno.h>
-#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "connman.h"
 
@@ -42,20 +45,37 @@ struct connman_nat {
 
 static int enable_ip_forward(bool enable)  {
-       FILE *f;
+       static char value = 0;
+       int f, err = 0;
 
-       f = fopen("/proc/sys/net/ipv4/ip_forward", "r+");
-       if (!f)
+       if ((f = open("/proc/sys/net/ipv4/ip_forward", O_CLOEXEC)) < 0)
                return -errno;
 
-       if (enable)
-               fprintf(f, "1");
-       else
-               fprintf(f, "0");
+       if (!value) {
+               if (read(f, &value, sizeof(value)) < 0)
+                       value = 0;
+       }
 
-       fclose(f);
+       if (enable) {
+               char allow = '1';
 
-       return 0;
+               if (write (f, &allow, sizeof(allow)) < 0)
+                       err = -errno;
+       } else {
+               char deny = '0';
+
+               if (value)
+                       deny = value;
+
+               if (write(f, &deny, sizeof(deny)) < 0)
+                       err = -errno;
+
+               value = 0;
+       }
+
+       close(f);
+
+       return err;
 }
 
 static int enable_nat(struct connman_nat *nat)
--
2.8.0.rc3

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


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

Message: 6
Date: Fri, 15 Apr 2016 12:44:35 +0300
From: Patrik Flykt <[email protected]>
To: Prasant J <[email protected]>, [email protected]
Subject: Re: dhcp failure and link local
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2016-04-15 at 13:15 +0530, Prasant J wrote:
> I want my embedded linux system to stop looking out for DHCP server
> (stop sending DISCOVERY packets) after ipv4ll address is assigned.
> Is it possible? If yes, do I need to change the code or is there a
> configuration file?

Not really. Other users actually run into the opposite problem, which
was that their DHCP server was not immediately reachable, and wanted to
get out of a situation with link-local IPv4 decently quickly.

Cheers,

        Patrik



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

Message: 7
Date: Fri, 15 Apr 2016 12:48:09 +0300
From: Patrik Flykt <[email protected]>
To: Jose Blanquicet <[email protected]>, [email protected]
Subject: Re: [PATCH v2] technology: Allow raw key for tethering (i.e.
        64 bytes in hexadecimal representation)
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2016-04-15 at 09:47 +0200, Jose Blanquicet wrote:
> Although the gsupplicant component allows to use a raw key when a
> new?
> network is being created through the function
> add_network_security_psk,?
> the technology component does not allow it because in order to set
> the?
> property TetheringPassphrase the string's length must be within the?
> range [8, 63], otherwise it will be taken as wrong value without
> check?
> if it is a raw key.
> 
> This patch uses Wi-Fi passphrase/password checking already
> implemented?
> in service.c, check_passphrase(), exporting it in src/connman.h. The?
> connman_service_security argument is hard-coded to?
> CONNMAN_SERVICE_SECURITY_PSK because it is the only Wi-Fi security
> type?
> currently supported for thethering.

Applied with whitespace scrubbing end of line?err =
__connman_service_check_passphrase(...


        Patrik



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

Message: 8
Date: Fri, 15 Apr 2016 13:19:53 +0300
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [PATCH] nat: Open IPv4 forwarding file with proper mode
Message-ID:
        <[email protected]>

The file needs to be read and written to.
---

Yes, something wasn't right. Thanks to Jose for noticing this!

     Patrik

src/nat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nat.c b/src/nat.c
index b739e11..33ae6df 100644
--- a/src/nat.c
+++ b/src/nat.c
@@ -48,7 +48,7 @@ static int enable_ip_forward(bool enable)
        static char value = 0;
        int f, err = 0;
 
-       if ((f = open("/proc/sys/net/ipv4/ip_forward", O_CLOEXEC)) < 0)
+       if ((f = open("/proc/sys/net/ipv4/ip_forward", O_CLOEXEC | O_RDWR)) < 0)
                return -errno;
 
        if (!value) {
-- 
2.8.0.rc3



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

Subject: Digest Footer

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


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

End of connman Digest, Vol 6, Issue 11
**************************************

Reply via email to