From: Daniel Wagner <daniel.wag...@bmw-carit.de>

Support matching on service name instead of only the service type,
---
 src/session.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/session.c b/src/session.c
index 5ebc7fb..38febbd 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1442,14 +1442,28 @@ static bool session_match_service(struct 
connman_session *session,
 {
        enum connman_service_type bearer_type;
        enum connman_service_type service_type;
+       const char *ident;
        GSList *list;
 
-       for (list = session->active_bearers; list; list = list->next) {
-               bearer_type = GPOINTER_TO_INT(list->data);
-               service_type = connman_service_get_type(service);
+       service_type = connman_service_get_type(service);
+       ident = __connman_service_get_ident(service);
 
-               if (bearer_type == service_type)
+       /*
+        * We need to go through the allowed_bearers because we need
+        * to maintain to the ordering.
+        */
+       for (list = session->info->config.allowed_bearers; list;
+                       list = list->next) {
+               const char *bearer = list->data;
+
+               if (bearer2service(bearer, &bearer_type) == 0) {
+                       if (bearer_type == service_type)
+                               return true;
+               }
+
+               if (g_strcmp0(bearer, ident) == 0)
                        return true;
+
        }
 
        return false;
-- 
1.8.5.3

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

Reply via email to