summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/session.h1
-rw-r--r--src/session.c24
2 files changed, 18 insertions, 7 deletions
diff --git a/include/session.h b/include/session.h
index a4229522..4aca5d01 100644
--- a/include/session.h
+++ b/include/session.h
@@ -78,6 +78,7 @@ void connman_session_policy_unregister(struct connman_session_policy *config);
int connman_session_config_update(struct connman_session *session);
void connman_session_destroy(struct connman_session *session);
+int connman_session_set_default_config(struct connman_session_config *config);
struct connman_session_config *connman_session_create_default_config(void);
enum connman_session_roaming_policy connman_session_parse_roaming_policy(const char *policy);
diff --git a/src/session.c b/src/session.c
index 0b0321fc..c2327886 100644
--- a/src/session.c
+++ b/src/session.c
@@ -352,6 +352,22 @@ void connman_session_policy_unregister(struct connman_session_policy *policy)
remove_policy(policy);
}
+int connman_session_set_default_config(struct connman_session_config *config)
+{
+ config->priority = FALSE;
+ config->roaming_policy = CONNMAN_SESSION_ROAMING_POLICY_DEFAULT;
+ config->type = CONNMAN_SESSION_TYPE_ANY;
+ config->ecall = FALSE;
+
+ g_slist_free(config->allowed_bearers);
+ config->allowed_bearers = g_slist_prepend(NULL,
+ GINT_TO_POINTER(CONNMAN_SERVICE_TYPE_UNKNOWN));
+ if (config->allowed_bearers == NULL)
+ return -ENOMEM;
+
+ return 0;
+}
+
struct connman_session_config *connman_session_create_default_config(void)
{
struct connman_session_config *config;
@@ -360,13 +376,7 @@ struct connman_session_config *connman_session_create_default_config(void)
if (config == NULL)
return NULL;
- config->priority = FALSE;
- config->roaming_policy = CONNMAN_SESSION_ROAMING_POLICY_DEFAULT;
- config->type = CONNMAN_SESSION_TYPE_ANY;
- config->ecall = FALSE;
- config->allowed_bearers = g_slist_prepend(NULL,
- GINT_TO_POINTER(CONNMAN_SERVICE_TYPE_UNKNOWN));
- if (config->allowed_bearers == NULL) {
+ if (connman_session_set_default_config(config) < 0) {
g_free(config);
return NULL;
}