diff mbox series

[11/11] wispr: Leverage '__connman_service_get_route_metric'.

Message ID 20231216061223.2199037-12-gerickson@nuovations.com (mailing list archive)
State Not Applicable, archived
Headers show
Series service/wispr: Add Per-service-unique WISPr Host Route Metric/Priority | expand

Commit Message

Grant Erickson Dec. 16, 2023, 6:12 a.m. UTC
This leverages '__connman_service_get_route_metric' to select an
appropriate service-specific route metric/priority when adding or
deleting WISPr host routes.

This allows multiple such routes to coexist simultaneously, supporting
"continuous" mode online checks in which one or more services may be
conducting "online" WISPr-based Internet reachability checks as they
move in and out of reachability success/failure.
---
 src/wispr.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/src/wispr.c b/src/wispr.c
index 1af880118e14..efc0ca2fbaa9 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -708,6 +708,17 @@  static bool wispr_route_request(const char *address, int ai_family,
 		return false;
 	}
 
+	result = __connman_service_get_route_metric(wp_context->service,
+				&metric);
+	if (result < 0) {
+		DBG("failed to get metric for service %p (%s): %s (%d)",
+			wp_context->service,
+			connman_service_get_identifier(wp_context->service),
+			strerror(-result), result);
+
+		return false;
+	}
+
 	DBG("service %p (%s) metric %u",
 		wp_context->service,
 		connman_service_get_identifier(wp_context->service),