[PATCH 3/4] provider: Add a provider-specific immutable flag

Patrik Flykt patrik.flykt at linux.intel.com
Tue Sep 24 05:48:57 PDT 2013


Add an immutable flag to the provider struct in order to track whether
the provider can be modified. If immutable is set for the whole service,
no attributes can be changed including proxies, time servers etc. that
are not specified by the VPN daemon or config file.
---
 src/connman.h  |    1 +
 src/provider.c |   16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/connman.h b/src/connman.h
index 8334311..a0f06bd 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -616,6 +616,7 @@ int __connman_provider_append_user_route(struct connman_provider *provider,
 			int family, const char *network, const char *netmask);
 void __connman_provider_append_properties(struct connman_provider *provider, DBusMessageIter *iter);
 void __connman_provider_list(DBusMessageIter *iter, void *user_data);
+bool __connman_provider_is_immutable(struct connman_provider *provider);
 int __connman_provider_create_and_connect(DBusMessage *msg);
 const char * __connman_provider_get_ident(struct connman_provider *provider);
 int __connman_provider_indicate_state(struct connman_provider *provider,
diff --git a/src/provider.c b/src/provider.c
index f24c8ef..b1a2a3b 100644
--- a/src/provider.c
+++ b/src/provider.c
@@ -40,6 +40,7 @@ static GSList *driver_list = NULL;
 
 struct connman_provider {
 	int refcount;
+	bool immutable;
 	struct connman_service *vpn_service;
 	int index;
 	char *identifier;
@@ -347,17 +348,24 @@ int connman_provider_create_service(struct connman_provider *provider)
 	return 0;
 }
 
+bool __connman_provider_is_immutable(struct connman_provider *provider)
+
+{
+	if (provider)
+		return provider->immutable;
+
+	return false;
+}
+
 int connman_provider_set_immutable(struct connman_provider *provider,
 						bool immutable)
 {
 	if (!provider)
 		return -EINVAL;
 
-	if (!provider->vpn_service)
-		return -ESRCH;
+	provider->immutable = immutable;
 
-	return __connman_service_set_immutable(provider->vpn_service,
-						immutable);
+	return 0;
 }
 
 static struct connman_provider *provider_lookup(const char *identifier)
-- 
1.7.10.4




More information about the connman mailing list