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 <pl@dlhnet.de>
This commit is contained in:
Peter Lieven
2025-03-25 21:20:49 +00:00
parent 7f0a8597d6
commit 98f0f2f7f1

View File

@@ -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;