It can be useful to see a little bit more detail on what exactly isn't
working.
OK?
Index: http.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/http.c,v
retrieving revision 1.70
diff -u -p -r1.70 http.c
--- http.c 18 Oct 2022 14:03:39 -0000 1.70
+++ http.c 1 Nov 2022 14:36:44 -0000
@@ -210,6 +210,21 @@ http_info(const char *uri)
}
/*
+ * Return IP address in presentation format.
+ */
+static const char *
+ip_info(const struct http_connection *conn)
+{
+ static char buf[NI_MAXHOST];
+
+ if (getnameinfo(conn->res0->ai_addr, conn->res0->ai_addrlen,
+ buf, sizeof(buf), NULL, 0, NI_NUMERICHOST))
+ return ("unknown");
+
+ return buf;
+}
+
+/*
* Determine whether the character needs encoding, per RFC2396.
*/
static int
@@ -870,7 +885,8 @@ http_connect(struct http_connection *con
if (conn->fd == -1) {
if (cause != NULL)
- warn("%s: %s", http_info(conn->req->uri), cause);
+ warn("%s (%s): %s", http_info(conn->req->uri),
+ ip_info(conn), cause);
return http_failed(conn);
}
@@ -1930,12 +1946,14 @@ proc_http(char *bind_addr, int fd)
http_do(conn, http_handle);
else if (conn->io_time <= now) {
if (conn->state == STATE_CONNECT) {
- warnx("%s: connect timeout",
- http_info(conn->host));
+ warnx("%s (%s): connect timeout",
+ http_info(conn->host),
+ ip_info(conn));
http_do(conn, http_connect_failed);
} else {
- warnx("%s: timeout, connection closed",
- http_info(conn->host));
+ warnx("%s (%s): timeout, connection "
+ "closed", http_info(conn->host),
+ ip_info(conn));
http_do(conn, http_failed);
}
}