diff mbox series

[13/15] wispr: Add 'wispr_log_proxy_failure' function.

Message ID 20241212052817.2021264-14-gerickson@nuovations.com (mailing list archive)
State New
Headers show
Series Improve PAC URL Mutation and PAC URL and WISPr Proxy Failure Logging | expand

Commit Message

Grant Erickson Dec. 12, 2024, 5:28 a.m. UTC
Logs the network service interface name, type, proxy
auto-configuration (PAC) URL, online check URL, and proxy failure
reason at the error level when a Wireless Internet Service Provider
roaming (WISPr) online reachability check proxy failure occurs.

Frequently, a spurious, misconfigured, or otherwise incorrect PAC URL
is the source of WISPr online reachability check failures. Because
POSIX error codes are themselves limited (for example, there is no
-EBADPROXY or -EPROXYLKUP codes) and their usage for WISPr failures is
similarly limited (for example, -EINVAL), insight into the actual
nature of an online reachability check failure is, by extension,
limited. Consequently, log messages generated from this function
provide crucial insight into triaging and resolving such failures.
---
 src/wispr.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/src/wispr.c b/src/wispr.c
index b1b0f337d3f8..60a3a011da58 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -1118,6 +1118,24 @@  static char *parse_proxy(const char *proxy)
 	return proxy_server;
 }
 
+static void wispr_log_proxy_failure(
+		struct connman_wispr_portal_context const *wp_context,
+		const char *reason)
+{
+	g_autofree char *interface = NULL;
+
+	interface = connman_service_get_interface(wp_context->service);
+
+	connman_error("%s with proxy auto-configuration (PAC) URL %s "
+			"for %s [ %s ] online check URL %s",
+			reason,
+			connman_service_get_proxy_url(wp_context->service),
+			interface,
+			__connman_service_type2string(
+				connman_service_get_type(wp_context->service)),
+			wp_context->status_url);
+}
+
 static void proxy_callback(const char *proxy, void *user_data)
 {
 	struct connman_wispr_portal_context *wp_context = user_data;