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] delete STORAGEDIR folders when services are removed
      (MANIEZZO Marco (MM))
   2. Re: [PATCH] Removed false null check because context will not
      be null (Patrik Flykt)
   3. Re: [PATCH v4] gsupplicant: Mem leak in wpa_s because
      "RemoveNetwork" not called (Patrik Flykt)
   4. Re: [PATCH] ofono: Fix inconsitent use of g_try_newo and free
      (Patrik Flykt)
   5. Re: [PATCH] delete STORAGEDIR folders when services are
      removed (Patrik Flykt)
   6. Re: [PATCH] bridge: corrected the format specifier for
      unsigned int (Patrik Flykt)
   7. [PATCH] gdhcp: use opened listening socket to send DHCP renew
      request (Feng Wang)


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

Message: 1
Date: Wed, 24 Feb 2016 15:14:55 +0000
From: "MANIEZZO Marco (MM)" <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [PATCH] delete STORAGEDIR folders when services are removed
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Hello,

currently when a service is removed (Remove d-bus method) some of its 
properties are cleared but its folder and files in STORAGEDIR are not deleted. 
This patch removes such data.
Immutable services have a .config file in STORAGEDIR, and if they have been 
connected at least once they also have the same folder of mutable services: the 
Remove method will delete the folder and force a re-provision of the service: 
this will act as a reset of the service to its default.

Please find below the modifications (also attached in case of issues in email 
indentation):

doc/service-api.txt | 13 ++++++++-----
 include/provision.h |  1 +
 src/config.c        |  9 +++++++++
 src/service.c       | 35 +++++++++++++++++++++++++++++++----
 4 files changed, 49 insertions(+), 9 deletions(-)


diff --git a/doc/service-api.txt b/doc/service-api.txt
index e2e9e84..cb9021c 100644
--- a/doc/service-api.txt
+++ b/doc/service-api.txt
@@ -94,11 +94,14 @@ Methodsdict GetProperties()  [deprecated]
 service is in the State=failure, this method can
 also be used to reset the service.

-Calling this method on Ethernet devices, hidden WiFi
-services or provisioned services will cause an error
-message. It is not possible to remove these kind of
-services.
-
+Calling this method on Ethernet devices and hidden WiFi
+services will cause an error message. It is not possible
+to remove these kind ofservices.
+
+For the other services the removal will cause the
+deletion of their folder inSTORAGEDIR. Immutable
+services  will be reprovisioned reading their .config file.
+
 Possible Errors: [service].Error.InvalidArguments

 void MoveBefore(object service)
diff --git a/include/provision.h b/include/provision.h
index 3eb80a8..040f152 100644
--- a/include/provision.h
+++ b/include/provision.h
@@ -42,6 +42,7 @@ struct connman_config_entry {
 bool hidden;
 };

+void reload_config(const char * ident);
 int connman_config_provision_mutable_service(GKeyFile *keyfile);
 struct connman_config_entry **connman_config_get_entries(const char *type);
 void connman_config_free_entries(struct connman_config_entry **entries);
diff --git a/src/config.c b/src/config.c
index 344b8ce..da95817 100644
--- a/src/config.c
+++ b/src/config.c
@@ -942,6 +942,15 @@ static void config_notify_handler(struct inotify_event 
*event,
 g_hash_table_remove(config_table, ident);
 }

+void reload_config(const char * ident)
+{
+struct inotify_event event;
+
+event.mask = IN_MODIFY;
+
+config_notify_handler(&event,ident);
+}
+
 int __connman_config_init(void)
 {
 DBG("");
diff --git a/src/service.c b/src/service.c
index 8e07337..e73f38e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -34,7 +34,7 @@
 #include <connman/storage.h>
 #include <connman/setting.h>
 #include <connman/agent.h>
-
+#include <connman/provision.h>
 #include "connman.h"

 #define CONNECT_TIMEOUT120
@@ -4081,11 +4081,15 @@ static DBusMessage *disconnect_service(DBusConnection 
*conn,

 bool __connman_service_remove(struct connman_service *service)
 {
+unsigned int *auto_connect_types;
+char *ident;
+int i;
+
 if (service->type == CONNMAN_SERVICE_TYPE_ETHERNET ||
 service->type == CONNMAN_SERVICE_TYPE_GADGET)
 return false;

-if (service->immutable || service->hidden ||
+if (service->hidden ||
 __connman_provider_is_immutable(service->provider))
 return false;

@@ -4116,9 +4120,32 @@ bool __connman_service_remove(struct connman_service 
*service)

 __connman_ipconfig_ipv6_reset_privacy(service->ipconfig_ipv6);

-service_save(service);
+__connman_storage_remove_service(service->identifier);

-return true;
+if (service->immutable == true && service->config_file)
+{/* force reprovision of immutable services */
+
+/* reset autoconnect to default, because it is not currently (connman 1.31)
+ * managed by .config files
+ */
+auto_connect_types = 
connman_setting_get_uint_list("DefaultAutoConnectTechnologies");
+service->autoconnect = false;
+for (i = 0; auto_connect_types &&
+auto_connect_types[i] != 0; i++) {
+if (service->type == auto_connect_types[i]) {
+service->autoconnect = true;
+break;
+}
+}
+
+DBG("reloading service %s", service->config_file);
+
+ident = g_strdup_printf("%s.config", service->config_file);
+reload_config(ident);
+g_free(ident);
+}
+
+return(true);
 }

 static DBusMessage *remove_service(DBusConnection *conn,

--
1.9.1


Regards,
Marco




________________________________

VISITA IL NOSTRO NUOVO SITO WEB! - VISIT OUR NEW WEB SITE! 
www.magnetimarelli.com

Confidential Notice: This message - including its attachments - may contain 
proprietary, confidential and/or legally protected information and is intended 
solely for the use of the designated addressee(s) above. If you are not the 
intended recipient be aware that any downloading, copying, disclosure, 
distribution or use of the contents of the above information is strictly 
prohibited.
If you have received this communication by mistake, please forward the message 
back to the sender at the email address above, delete the message from all 
mailboxes and any other electronic storage medium and destroy all copies.
Disclaimer Notice: Internet communications cannot be guaranteed to be safe or 
error-free. Therefore we do not assure that this message is complete or 
accurate and we do not accept liability for any errors or omissions in the 
contents of this message.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff.txt
URL: 
<http://lists.01.org/pipermail/connman/attachments/20160224/edb8361b/attachment-0001.txt>

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

Message: 2
Date: Wed, 24 Feb 2016 17:31:11 +0200
From: Patrik Flykt <[email protected]>
To: Nishant Chaprana <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] Removed false null check because context will not
        be null
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-02-24 at 18:48 +0530, Nishant Chaprana wrote:
> ---

Applied, thanks!

        Patrik



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

Message: 3
Date: Wed, 24 Feb 2016 17:30:55 +0200
From: Patrik Flykt <[email protected]>
To: Naveen Singh <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v4] gsupplicant: Mem leak in wpa_s because
        "RemoveNetwork" not called
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Tue, 2016-02-23 at 23:51 -0800, Naveen Singh wrote:
> From: nasingh <[email protected]>
> 
> Connman did not call netwok_remove in case AP deauthenticated client causing
> wpa_s to re-allocate the ssid pointer even if the next connection attempt
> is for the same SSID. This change ensures that at the time of connection
> (DBUS Method call AddNetwork) if the network is found not removed, it calls
> the dbus API to remove the network and once network is removed, proceed with
> the connection.
> 
> By the time there is a request for connect and the network path is not NULL it
> means that connman has not removed the previous network pointer. This can 
> happen
> in the case AP deauthenticated client and connman does not remove the 
> previously
> connected network pointer. This causes supplicant to reallocate the memory for
> struct wpa_ssid again even if it is the same SSID. This causes memory usage of
> wpa_supplicnat to go high. The idea here is that if the previously connected 
> network
> is not removed at the time of next connection attempt check if the network 
> path is not
> NULL. In case it is non-NULL first remove the network and then once removal 
> is successful,
> add the network.
> 
> Tested by running a deauth loop script at the AP end and ensure that wpa_s 
> does
> not allocate memory for struct wpa_ssid for all the subsequent
> connection attempts. During the test memory usage of wpa_s is monitored.
> ---

Applied, thanks!

        Patrik



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

Message: 4
Date: Wed, 24 Feb 2016 17:31:44 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] ofono: Fix inconsitent use of g_try_newo and free
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-02-24 at 19:39 +0530, Niraj Kumar Goit wrote:
> As context structure is allocated memory using g_try_new0 it should
> be freed using g_free, since these allocators may use different
> memory pools.

Applied, thanks!

        Patrik



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

Message: 5
Date: Wed, 24 Feb 2016 17:39:10 +0200
From: Patrik Flykt <[email protected]>
To: "MANIEZZO Marco (MM)" <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: [PATCH] delete STORAGEDIR folders when services are
        removed
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-02-24 at 15:14 +0000, MANIEZZO Marco (MM) wrote:
> Please find below the modifications (also attached in case of issues
> in email indentation):

No. Use 'git format-patch -o ../patch-series-XXXXX --cover-letter
HEAD~xxx..', edit the cover letter in ../patch-series-XXXXX/0000-YYYY
and do a 'git send-email --to=connman@... ../patch-series-XXXXX' so that
1) the cover letter contains the explanation about the patch series, 2)
the individual patches that are going to show up upstream containing the
summary of why this is done in each patch and 3) not to eat the
indentation...

Cheers,

        Patrik




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

Message: 6
Date: Wed, 24 Feb 2016 17:31:27 +0200
From: Patrik Flykt <[email protected]>
To: Nishant Chaprana <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] bridge: corrected the format specifier for
        unsigned int
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-02-24 at 18:59 +0530, Nishant Chaprana wrote:
> ---

Applied, thanks!

        Patrik



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

Message: 7
Date: Wed, 24 Feb 2016 11:32:00 -0800
From: Feng Wang <[email protected]>
To: [email protected]
Subject: [PATCH] gdhcp: use opened listening socket to send DHCP renew
        request
Message-ID: <[email protected]>

It fix DHCP ACK lost issue when doing DHCP renewal.
When doing DHCP renew, 2 sockets are opened. One is for
listening DHCP ACK, the other is for transmitting DHCP request
which is closed immediately after transmitting is done. But in
some cases, the socket is closed after the DHCP ACK is received.
The kernel will route the packet to the transmitting socket
because it has a better match result(dst ip/port etc). And the
packet was dropped when the socket was closed.
---
 gdhcp/client.c |  6 ++++--
 gdhcp/common.c | 57 +++++++++++++++++++++++++++++++++++----------------------
 gdhcp/common.h |  2 +-
 3 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index 3bf8cb2..ad587b1 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -502,7 +502,8 @@ static int send_request(GDHCPClient *dhcp_client)
        if (dhcp_client->state == RENEWING)
                return dhcp_send_kernel_packet(&packet,
                                dhcp_client->requested_ip, CLIENT_PORT,
-                               dhcp_client->server_ip, SERVER_PORT);
+                               dhcp_client->server_ip, SERVER_PORT,
+                               dhcp_client->listener_sockfd);
 
        return dhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT,
                                INADDR_BROADCAST, SERVER_PORT,
@@ -526,7 +527,8 @@ static int send_release(GDHCPClient *dhcp_client,
        dhcp_add_option_uint32(&packet, DHCP_SERVER_ID, server);
 
        return dhcp_send_kernel_packet(&packet, ciaddr, CLIENT_PORT,
-                                               server, SERVER_PORT);
+                                               server, SERVER_PORT,
+                                               dhcp_client->listener_sockfd);
 }
 
 static gboolean ipv4ll_probe_timeout(gpointer dhcp_data);
diff --git a/gdhcp/common.c b/gdhcp/common.c
index f3d4677..c841a0a 100644
--- a/gdhcp/common.c
+++ b/gdhcp/common.c
@@ -626,46 +626,59 @@ int dhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
 
 int dhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
                                uint32_t source_ip, int source_port,
-                               uint32_t dest_ip, int dest_port)
+                               uint32_t dest_ip, int dest_port, int openedfd)
 {
        struct sockaddr_in client;
-       int fd, n, opt = 1;
+       int n, fd, ret, opt = 1;
 
        enum {
                DHCP_SIZE = sizeof(struct dhcp_packet) -
                                        EXTEND_FOR_BUGGY_SERVERS,
        };
 
-       fd = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP);
-       if (fd < 0)
-               return -errno;
-
-       setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
-
-       memset(&client, 0, sizeof(client));
-       client.sin_family = AF_INET;
-       client.sin_port = htons(source_port);
-       client.sin_addr.s_addr = htonl(source_ip);
-       if (bind(fd, (struct sockaddr *) &client, sizeof(client)) < 0) {
-               close(fd);
-               return -errno;
+       if (openedfd < 0) {
+               /* no socket opened, open a new socket to tx the packet and 
close it */
+               fd = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP);
+               if (fd < 0)
+                       return -errno;
+
+               setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+
+               memset(&client, 0, sizeof(client));
+               client.sin_family = AF_INET;
+               client.sin_port = htons(source_port);
+               client.sin_addr.s_addr = htonl(source_ip);
+               if (bind(fd, (struct sockaddr *) &client, sizeof(client)) < 0) {
+                       ret = -errno;
+                       close(fd);
+                       return ret;
+               }
        }
 
        memset(&client, 0, sizeof(client));
        client.sin_family = AF_INET;
        client.sin_port = htons(dest_port);
        client.sin_addr.s_addr = htonl(dest_ip);
-       if (connect(fd, (struct sockaddr *) &client, sizeof(client)) < 0) {
-               close(fd);
-               return -errno;
-       }
 
-       n = write(fd, dhcp_pkt, DHCP_SIZE);
+       if (openedfd < 0) {
+               if (connect(fd, (struct sockaddr *) &client, sizeof(client)) < 
0) {
+                       ret = -errno;
+                       close(fd);
+                       return ret;
+               }
 
-       close(fd);
+               n = write(fd, dhcp_pkt, DHCP_SIZE);
+               ret = -errno;
+               close(fd);
+       } else {
+               /* Using existed socket to transmit the packet */
+               n = sendto(openedfd, dhcp_pkt, DHCP_SIZE, MSG_DONTWAIT,
+                               (struct sockaddr *) &client, sizeof(client));
+               ret = -errno;
+       }
 
        if (n < 0)
-               return -errno;
+               return ret;
 
        return n;
 }
diff --git a/gdhcp/common.h b/gdhcp/common.h
index 75abc18..b92d214 100644
--- a/gdhcp/common.h
+++ b/gdhcp/common.h
@@ -209,7 +209,7 @@ int dhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
 int dhcpv6_send_packet(int index, struct dhcpv6_packet *dhcp_pkt, int len);
 int dhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
                        uint32_t source_ip, int source_port,
-                       uint32_t dest_ip, int dest_port);
+                       uint32_t dest_ip, int dest_port, int fd);
 int dhcp_l3_socket(int port, const char *interface, int family);
 int dhcp_recv_l3_packet(struct dhcp_packet *packet, int fd);
 int dhcpv6_recv_l3_packet(struct dhcpv6_packet **packet, unsigned char *buf,
-- 
2.7.0.rc3.207.g0ac5344



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

Subject: Digest Footer

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


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

End of connman Digest, Vol 4, Issue 31
**************************************

Reply via email to