After assigning the new ipconfig to the service in question, enable
the new ipconfig only if the service is currently in use, i.e. the
service is connecting or connected. Otherwise the new ipconfig will
be applied to some other service.
---
 src/service.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/service.c b/src/service.c
index 1cc7c17..e284e92 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3162,6 +3162,7 @@ int __connman_service_reset_ipconfig(struct 
connman_service *service,
        if (is_connecting_state(service, state) ||
                                        is_connected_state(service, state))
                __connman_network_clear_ipconfig(service->network, ipconfig);
+
        __connman_ipconfig_unref(ipconfig);
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
@@ -3169,13 +3170,16 @@ int __connman_service_reset_ipconfig(struct 
connman_service *service,
        else if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
                service->ipconfig_ipv6 = new_ipconfig;
 
-       __connman_ipconfig_enable(new_ipconfig);
+       if (is_connecting_state(service, state) ||
+                                       is_connected_state(service, state))
+               __connman_ipconfig_enable(new_ipconfig);
 
        if (new_state && new_method != old_method) {
                if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                        *new_state = service->state_ipv4;
                else
                        *new_state = service->state_ipv6;
+
                
__connman_service_auto_connect(CONNMAN_SERVICE_CONNECT_REASON_AUTO);
        }
 
-- 
1.9.1

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

Reply via email to