From: Pasi Sjöholm <pasi.sjoh...@jollamobile.com>

As service is removed the IPv6.Privacy needs to be also reset to interface
default (ipdevice->ipv6_privacy).
---
 src/connman.h  |  1 +
 src/ipconfig.c | 19 +++++++++++++++++++
 src/service.c  |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/src/connman.h b/src/connman.h
index 4bee34d..a871e82 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -413,6 +413,7 @@ int __connman_ipconfig_load(struct connman_ipconfig 
*ipconfig,
 int __connman_ipconfig_save(struct connman_ipconfig *ipconfig,
                GKeyFile *keyfile, const char *identifier, const char *prefix);
 bool __connman_ipconfig_ipv6_privacy_enabled(struct connman_ipconfig 
*ipconfig);
+int __connman_ipconfig_ipv6_reset_privacy(struct connman_ipconfig *ipconfig);
 int __connman_ipconfig_ipv6_set_privacy(struct connman_ipconfig *ipconfig,
                                        const char *value);
 bool __connman_ipconfig_ipv6_is_enabled(struct connman_ipconfig *ipconfig);
diff --git a/src/ipconfig.c b/src/ipconfig.c
index fa4c0d6..d81a791 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -1774,6 +1774,25 @@ static int string2privacy(const char *privacy)
                return 0;
 }
 
+int __connman_ipconfig_ipv6_reset_privacy(struct connman_ipconfig *ipconfig)
+{
+       struct connman_ipdevice *ipdevice;
+       int err;
+
+       if (!ipconfig)
+               return -EINVAL;
+
+       ipdevice = g_hash_table_lookup(ipdevice_hash,
+                                               
GINT_TO_POINTER(ipconfig->index));
+       if (!ipdevice)
+               return -ENODEV;
+
+       err = __connman_ipconfig_ipv6_set_privacy(ipconfig, privacy2string(
+                                                       
ipdevice->ipv6_privacy));
+
+       return err;
+}
+
 int __connman_ipconfig_ipv6_set_privacy(struct connman_ipconfig *ipconfig,
                                        const char *value)
 {
diff --git a/src/service.c b/src/service.c
index d96713d..8dc6580 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4051,6 +4051,8 @@ bool __connman_service_remove(struct connman_service 
*service)
 
        __connman_service_set_favorite(service, false);
 
+       __connman_ipconfig_ipv6_reset_privacy(service->ipconfig_ipv6);
+
        service_save(service);
 
        return true;
-- 
1.9.1

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to