From: Daniel Wagner <[email protected]>

If the user provides the match all rule we should add the policy
bearer to the result.
---
 src/session.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/session.c b/src/session.c
index 07766fc..7919d1d 100644
--- a/src/session.c
+++ b/src/session.c
@@ -473,7 +473,7 @@ static int filter_bearer(GSList *policy_bearers,
                                struct connman_session_bearer *bearer,
                                GSList **list)
 {
-       struct connman_session_bearer *policy, *tmp;
+       struct connman_session_bearer *policy, *tmp = NULL;
        GSList *it;
 
        if (policy_bearers == NULL)
@@ -482,11 +482,17 @@ static int filter_bearer(GSList *policy_bearers,
        for (it = policy_bearers; it != NULL; it = it->next) {
                policy = it->data;
 
+               if (bearer->match_all == TRUE) {
+                       tmp = policy;
+                       goto clone;
+               }
+
                if (policy->match_all == FALSE &&
                                bearer->service_type != policy->service_type)
                        continue;
 
                goto clone;
+               tmp = bearer;
        }
 
        *list = NULL;
@@ -494,7 +500,12 @@ static int filter_bearer(GSList *policy_bearers,
        return 0;
 
 clone:
-       tmp = clone_bearer(bearer);
+       if (tmp == NULL)
+               return 0;
+
+       DBG("append '%s'", tmp->name);
+
+       tmp = clone_bearer(tmp);
        if (tmp == NULL) {
                connman_session_free_bearers(*list);
                *list = NULL;
-- 
1.8.0.rc0

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

Reply via email to