From: Patrik Flykt <[email protected]>
Create new read functions for IPv4 and IPv6 from the code in
__connman_service_create_ip*config functions.
---
src/connman.h | 3 ++-
src/service.c | 54 +++++++++++++++++++++++++++++++++---------------------
2 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/src/connman.h b/src/connman.h
index 6e68c99..17add6d 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -473,9 +473,10 @@ struct connman_service
*__connman_service_create_from_network(struct connman_net
struct connman_service *__connman_service_create_from_provider(struct
connman_provider *provider);
void __connman_service_update_from_network(struct connman_network *network);
void __connman_service_remove_from_network(struct connman_network *network);
-
+void __connman_service_read_ip4config(struct connman_service *service);
void __connman_service_create_ip4config(struct connman_service *service,
int index);
+void __connman_service_read_ip6config(struct connman_service *service);
void __connman_service_create_ip6config(struct connman_service *service,
int index);
struct connman_ipconfig *__connman_service_get_ip4config(
diff --git a/src/service.c b/src/service.c
index 7cd21b5..6482b50 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4623,57 +4623,69 @@ static void setup_ip6config(struct connman_service
*service, int index)
connman_ipconfig_set_ops(service->ipconfig_ipv6, &service_ops);
}
-void __connman_service_create_ip4config(struct connman_service *service,
- int index)
+void __connman_service_read_ip4config(struct connman_service *service)
{
const char *ident = service->profile;
GKeyFile *keyfile;
+ if (ident == NULL)
+ return;
+ if (service->ipconfig_ipv4 == NULL)
+ return;
+
+ keyfile = __connman_storage_open_profile(ident);
+ if (keyfile == NULL)
+ return;
+
+ __connman_ipconfig_load(service->ipconfig_ipv4, keyfile,
+ service->identifier, "IPv4.");
+
+ g_key_file_free(keyfile);
+}
+
+void __connman_service_create_ip4config(struct connman_service *service,
+ int index)
+{
DBG("ipv4 %p", service->ipconfig_ipv4);
if (service->ipconfig_ipv4 != NULL)
return;
setup_ip4config(service, index, CONNMAN_IPCONFIG_METHOD_DHCP);
+ __connman_service_read_ip4config(service);
+}
+
+void __connman_service_read_ip6config(struct connman_service *service)
+{
+ const char *ident = service->profile;
+ GKeyFile *keyfile;
if (ident == NULL)
return;
+ if (service->ipconfig_ipv6 == NULL)
+ return;
keyfile = __connman_storage_open_profile(ident);
+
if (keyfile == NULL)
return;
- if (service->ipconfig_ipv4)
- __connman_ipconfig_load(service->ipconfig_ipv4, keyfile,
- service->identifier, "IPv4.");
+ __connman_ipconfig_load(service->ipconfig_ipv6, keyfile,
+ service->identifier, "IPv6.");
+
g_key_file_free(keyfile);
}
void __connman_service_create_ip6config(struct connman_service *service,
int index)
{
- const char *ident = service->profile;
- GKeyFile *keyfile;
-
DBG("ipv6 %p", service->ipconfig_ipv6);
if (service->ipconfig_ipv6 != NULL)
return;
setup_ip6config(service, index);
-
- if (ident == NULL)
- return;
-
- keyfile = __connman_storage_open_profile(ident);
- if (keyfile == NULL)
- return;
-
- if (service->ipconfig_ipv6 != NULL)
- __connman_ipconfig_load(service->ipconfig_ipv6, keyfile,
- service->identifier, "IPv6.");
-
- g_key_file_free(keyfile);
+ __connman_service_read_ip6config(service);
}
/**
--
1.7.2.5
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman