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] peer: Add memory allocation controls
      (Tomasz Bursztyka)
   2. Re: [PATCH] peer: Add memory allocation controls (Daniel Wagner)
   3. [RFC 2/3] service: Update nameservers on manual IP address
      change (Patrik Flykt)
   4. [RFC 3/3] network: Update nameservers on DHCP IP address
      change (Patrik Flykt)
   5. [RFC 1/3] service: Add helper function to reload nameservers
      (Patrik Flykt)
   6. [RFC 0/3] Reload nameservers when necessary (Patrik Flykt)
   7. Re: Connman v1.33 with systemd v230 : experiencing delay in
      IP assignment (Patrik Flykt)
   8. Re: [PATCH] peer: Add memory allocation controls (Patrik Flykt)
   9. Re: Tethering bridge interface (Patrik Flykt)
  10. Re: [RFC 0/3] Reload nameservers when necessary (M?ns Rullg?rd)


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

Message: 1
Date: Wed, 7 Dec 2016 13:46:13 +0100
From: Tomasz Bursztyka <[email protected]>
To: [email protected]
Subject: Re: [PATCH] peer: Add memory allocation controls
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed

Hi Slava,

>>>>> I thought the rule was that if a tiny allocation fails, it means 
>>>>> we are
>>>>> in a
>>>>> deep trouble
>>>>> so it should abort.
>>>> I am not sure I got your point. I just put this because according to
>>>> GLib documentation g_malloc0() aborts the program on failure but
>>>> instead you are telling that this is a desired behaviour? You want to
>>>> abort ConnMan in such a case?
>>>
>>> Yes, thus why g_malloc0() has been used. It was made on purpose.
>> Understood. But of course you only mean in initialization functions
>> __connman_{service|peer ...}_init(), right? If so, I agree thus let's
>> forget that patch.
>>
>> Thanks for the clarification.
>>
>> Jose
>
>
> One should also keep in mind that (probably) most Linux systems these 
> days are configured to use overcommit, meaning that malloc never fails 
> (except when you run out of the virtual address space). Basically it 
> only reserves the virtual address range. Those pages are not initially 
> backed by anything, the actual allocation is happening on the 
> page-by-page basis when the program accesses the page for the first time.
>

Sure, that behavior was, I am pretty sure, taken into account when it 
was decided to just fail in case of allocation failure.
Moreover for such really tiny allocation we do here and there: if that 
fails, probably the whole system is on the verge of collapsing.

> Not to mention that out of memory conditions should be handled 
> everywhere in the program (and all the libraries it's using) or 
> nowhere. Occasional OOM checks make very little sense. 

As long as it aborts, it means the allocation was checked.

It's really about what we want the program to do: should it call an 
unconditional successful allocator like g_malloc0() or should it handle 
OOM by itself.
Afaik, first solution was the one which got selected.

Tomasz


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

Message: 2
Date: Wed, 7 Dec 2016 14:29:36 +0100
From: Daniel Wagner <[email protected]>
To: Tomasz Bursztyka <[email protected]>,
        [email protected]
Subject: Re: [PATCH] peer: Add memory allocation controls
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed

On 12/07/2016 01:46 PM, Tomasz Bursztyka wrote:
>> Not to mention that out of memory conditions should be handled
>> everywhere in the program (and all the libraries it's using) or
>> nowhere. Occasional OOM checks make very little sense.
>
> As long as it aborts, it means the allocation was checked.
>
> It's really about what we want the program to do: should it call an
> unconditional successful allocator like g_malloc0() or should it handle
> OOM by itself.
> Afaik, first solution was the one which got selected.

glib does aborts for many functions if allocation fails. IIRC the 
glist_* function will just blow up.

And since no one really tests those error code paths anyway, we decided 
not to handle them. That is for small allocation. If you want to 
allocated 10 MB or so. you might still want to use _try version.


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

Message: 3
Date: Wed,  7 Dec 2016 15:47:53 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [RFC 2/3] service: Update nameservers on manual IP address
        change
Message-ID: <[email protected]>

Once the IP address changes, update nameservers.
---
 src/service.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/service.c b/src/service.c
index dcc4aff..bc5998c 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3635,6 +3635,8 @@ static DBusMessage *set_property(DBusConnection *conn,
                                                                
service->ipconfig_ipv6);
                }
 
+               connman_service_nameservers_reload(service, type);
+
                service_save(service);
        } else
                return __connman_error_invalid_property(msg);
-- 
2.10.2



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

Message: 4
Date: Wed,  7 Dec 2016 15:47:54 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [RFC 3/3] network: Update nameservers on DHCP IP address
        change
Message-ID: <[email protected]>

Update nameservers if DHCPv4 or DHCPv6 reports successful lease
aquisition.

---
 src/network.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/network.c b/src/network.c
index aa82b74..3d8eb13 100644
--- a/src/network.c
+++ b/src/network.c
@@ -172,6 +172,8 @@ static void dhcp_success(struct connman_network *network)
        if (err < 0)
                goto err;
 
+       connman_service_nameservers_reload(service, CONNMAN_IPCONFIG_TYPE_IPV4);
+
        return;
 
 err:
@@ -385,16 +387,21 @@ static void dhcpv6_renew_callback(struct connman_network 
*network,
 static void dhcpv6_callback(struct connman_network *network,
                        enum __connman_dhcpv6_status status, gpointer data)
 {
+       struct connman_service *service;
+
        DBG("status %d", status);
 
        /* Start the renew process if necessary */
        if (status == CONNMAN_DHCPV6_STATUS_SUCCEED) {
-
                if (dhcpv6_set_addresses(network) < 0) {
                        stop_dhcpv6(network);
                        return;
                }
 
+               service = connman_service_lookup_from_network(network);
+               connman_service_nameservers_reload(service,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
+
                if (__connman_dhcpv6_start_renew(network,
                                        dhcpv6_renew_callback) == -ETIMEDOUT)
                        dhcpv6_renew_callback(network,
@@ -1646,6 +1653,9 @@ int connman_network_set_ipaddress(struct connman_network 
*network,
        __connman_ipconfig_set_prefixlen(ipconfig, ipaddress->prefixlen);
        __connman_ipconfig_set_gateway(ipconfig, ipaddress->gateway);
 
+       connman_service_nameservers_reload(service,
+                               __connman_ipconfig_get_config_type(ipconfig));
+
        return 0;
 }
 
-- 
2.10.2



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

Message: 5
Date: Wed,  7 Dec 2016 15:47:52 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [RFC 1/3] service: Add helper function to reload nameservers
Message-ID: <[email protected]>

Nameservers need to be reloaded when the IP address changes. That means
removing the dns servers and adding them back in order to start using
the new address when the service is connected and set as the default.

Reported by mru.

---
 include/service.h |  4 ++++
 src/service.c     | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/service.h b/include/service.h
index 31dfce7..3d23bfa 100644
--- a/include/service.h
+++ b/include/service.h
@@ -24,6 +24,8 @@
 
 #include <stdbool.h>
 
+#include "ipconfig.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -116,6 +118,8 @@ enum connman_service_type connman_service_get_type(struct 
connman_service *servi
 char *connman_service_get_interface(struct connman_service *service);
 
 const char *connman_service_get_domainname(struct connman_service *service);
+int connman_service_nameservers_reload(struct connman_service *service,
+               enum connman_ipconfig_type type);
 char **connman_service_get_nameservers(struct connman_service *service);
 char **connman_service_get_timeservers_config(struct connman_service *service);
 char **connman_service_get_timeservers(struct connman_service *service);
diff --git a/src/service.c b/src/service.c
index 737a39f..dcc4aff 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1148,6 +1148,21 @@ static int nameserver_remove_all(struct connman_service 
*service,
        return 0;
 }
 
+int connman_service_nameservers_reload(struct connman_service *service,
+                               enum connman_ipconfig_type type)
+{
+       if (!service)
+               return -EINVAL;
+
+       if (is_connected_state(service, service->state) &&
+                       service == __connman_service_get_default()) {
+               nameserver_remove_all(service, type);
+               nameserver_add_all(service, type);
+       }
+
+       return 0;
+}
+
 /*
  * The is_auto variable is set to true when IPv6 autoconf nameservers are
  * inserted to resolver via netlink message (see rtnl.c:rtnl_newnduseropt()
-- 
2.10.2



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

Message: 6
Date: Wed,  7 Dec 2016 15:47:51 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [RFC 0/3] Reload nameservers when necessary
Message-ID: <[email protected]>

        Hi,

When the IPv4 or IPv6 address changes, DNS proxies are not update with
the new IP address. Attempt to fix that by reloading nameservers in all
cases of changed IP addresses.

Please review and test,

       Patrik


Patrik Flykt (3):
  service: Add helper function to reload nameservers
  service: Update nameservers on manual IP address change
  network: Update nameservers on DHCP IP address change

 include/service.h |  4 ++++
 src/network.c     | 12 +++++++++++-
 src/service.c     | 17 +++++++++++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)

-- 
2.10.2



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

Message: 7
Date: Wed, 07 Dec 2016 15:57:03 +0200
From: Patrik Flykt <[email protected]>
To: Shrikant Bobade <[email protected]>, [email protected]
Subject: Re: Connman v1.33 with systemd v230 : experiencing delay in
        IP assignment
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2016-11-25 at 15:38 +0530, Shrikant Bobade wrote:
> Hi,
> 
> I am using connman v1.33 along with systemd v230 for yocto based
> project.
> ?Experiencing delay in IP assignment ranging from 20 sec. to 1.5 min.
> 
> While used earlier versions previously didn't faced such delays. So
> by the time I am finding the exact change in version causing this
> delay issue. Just want to check anyone experiencing such delays in IP
> assignments.?
> 
> Any suggestions or pointers will be a great help.??

Ensure that you don't have systemd-networkd running, at least not on
the interfaces used by ConnMan?

Cheers,

        Patrik


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

Message: 8
Date: Wed, 07 Dec 2016 15:58:39 +0200
From: Patrik Flykt <[email protected]>
To: Daniel Wagner <[email protected]>, Tomasz Bursztyka
        <[email protected]>, [email protected]
Subject: Re: [PATCH] peer: Add memory allocation controls
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-12-07 at 14:29 +0100, Daniel Wagner wrote:
> glib does aborts for many functions if allocation fails. IIRC the?
> glist_* function will just blow up.
> 
> And since no one really tests those error code paths anyway, we
> decided?
> not to handle them. That is for small allocation. If you want to?
> allocated 10 MB or so. you might still want to use _try version.

That was indeed the reasoning here.

Cheers,

        Patrik


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

Message: 9
Date: Wed, 07 Dec 2016 16:03:43 +0200
From: Patrik Flykt <[email protected]>
To: Daniel Wagner <[email protected]>, "Blanquicet-Melendez Jose (MM)"
        <[email protected]>, "[email protected]"
        <[email protected]>
Subject: Re: Tethering bridge interface
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Tue, 2016-12-06 at 09:33 +0100, Daniel Wagner wrote:
> Hi,
> 
> On 12/05/2016 04:57 PM, Blanquicet-Melendez Jose (MM) wrote:
> > We continue studying how tethering is implemented and we were
> > wondering what is the purpose of creating the bridge interface
> > "tether". For instance, hostapd does not do this thus it seems to
> > not be strictly mandatory.
> 
> I don't know the answer here, but I suspect it has something to do
> that?we also support BT and that might need it.

When tethering, we want to connect all technologies together into one
network be they Bluetooth, ethernet, WiFi or anything else. Works
without an uplink interface too and has only one knob 'Tethering'
turned on for those network technologies we want to share the possible
uplink connection with.


Cheers,

        Patrik



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

Message: 10
Date: Wed, 07 Dec 2016 16:13:02 +0000
From: M?ns Rullg?rd <[email protected]>
To: Patrik Flykt <[email protected]>
Cc: [email protected]
Subject: Re: [RFC 0/3] Reload nameservers when necessary
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1

Patrik Flykt <[email protected]> writes:

> When the IPv4 or IPv6 address changes, DNS proxies are not update with
> the new IP address. Attempt to fix that by reloading nameservers in all
> cases of changed IP addresses.
>
> Please review and test,
>
>        Patrik
>
>
> Patrik Flykt (3):
>   service: Add helper function to reload nameservers
>   service: Update nameservers on manual IP address change
>   network: Update nameservers on DHCP IP address change
>
>  include/service.h |  4 ++++
>  src/network.c     | 12 +++++++++++-
>  src/service.c     | 17 +++++++++++++++++
>  3 files changed, 32 insertions(+), 1 deletion(-)

These patches fix my problem.

-- 
M?ns Rullg?rd


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

Subject: Digest Footer

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


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

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

Reply via email to