From 98f0f2f7f1a2d36df39e827cbacfd1ee02020c7d Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Tue, 25 Mar 2025 21:20:49 +0000 Subject: [PATCH] fix(socket): restore logging of local ip and port commit a92b413 removed the logging of local ip and port. For debugging puposes these information can be important. Restore functionality by using the new thread safe replacement for inet_ntoa called inet_ntop. Signed-off-by: Peter Lieven --- lib/socket.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/socket.c b/lib/socket.c index f1a1e15..e26230e 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -1073,7 +1073,10 @@ iscsi_tcp_service(struct iscsi_context *iscsi, int revents) } if (getsockname(iscsi->fd, (struct sockaddr *) &local, &local_l) == 0) { - ISCSI_LOG(iscsi, 2, "connection established to %s", iscsi->connected_portal); + char ip[INET_ADDRSTRLEN]; + inet_ntop(AF_INET, &local.sin_addr, ip, sizeof(ip)); + ISCSI_LOG(iscsi, 2, "connection established (%s:%u -> %s)", ip, + (unsigned)ntohs(local.sin_port), iscsi->connected_portal); } iscsi->is_connected = 1;