[PATCH] print source ip to log when tcp connection is accepted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



iscsi: print source ip to log when tcp connection is accepted

Signed-off-by: Alexander Nezhinsky <alexandern@xxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux