[stgt] [PATCH] print source ip to log when tcp connection is accepted
Alexander Nezhinsky
alexandern at Voltaire.COM
Tue Feb 1 18:19:03 CET 2011
iscsi: print source ip to log when tcp connection is accepted
Signed-off-by: Alexander Nezhinsky <alexandern at voltaire.com>
---
usr/iscsi/iscsi_tcp.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
index 0fbb671..338b5c9 100644
--- a/usr/iscsi/iscsi_tcp.c
+++ b/usr/iscsi/iscsi_tcp.c
@@ -95,6 +95,7 @@ static void accept_connection(int afd, int events, void *data)
struct iscsi_connection *conn;
struct iscsi_tcp_connection *tcp_conn;
int fd, ret;
+ char host[NI_MAXHOST];
dprintf("%d\n", afd);
@@ -105,6 +106,12 @@ static void accept_connection(int afd, int events, void *data)
return;
}
+ ret = getnameinfo((struct sockaddr *) &from, sizeof(from),
+ host, sizeof(host), NULL, 0, NI_NUMERICHOST);
+ if (ret)
+ strcpy(host, "Unresolved");
+ eprintf("from %s\n", host);
+
if (!is_system_available())
goto out;
--
1.6.5.5
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list