[PATCH 2/4] service: Take ordering into account when comparing connected services

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


Before selecting an online service, take the service order into account.
E.g. a VPN has order of 10 if that service cannot do split routing and
should therefore always be used as the default route.
---
 src/service.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/service.c b/src/service.c
index 7c8c2c3..7163f2b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4543,6 +4543,12 @@ static gint service_compare(gconstpointer a, gconstpointer b)
 		bool b_connected = is_connected(service_b);
 
 		if (a_connected && b_connected) {
+			if (service_a->order > service_b->order)
+				return -1;
+
+			if (service_a->order < service_b->order)
+				return 1;
+
 			/* We prefer online over ready state */
 			if (state_a == CONNMAN_SERVICE_STATE_ONLINE)
 				return -1;
-- 
1.7.10.4




More information about the connman mailing list