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

Grant Erickson <[email protected]>
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
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 --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;
-- 
2.45.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.