Hi All:

I recently patched open-isns. It had an issue getting it's
own IP address reliably.

It was using getsockname(), but the length it was passing
it was not initialized, as it is supposed to be.

On x86 this seemed to be working anyway, though no
telling what memory might be corrupted. But on other
architectures it seemed to fail as often as it succeeded.

The attach patch has already been added to the open-isns
repository at github.com:gonzoleeman/open-isns.git.

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.
>From 7b4fd0cb8384312e3718953ad1c71ad7f03cbd62 Mon Sep 17 00:00:00 2001
From: Lee Duncan <ldun...@suse.com>
Date: Thu, 3 Sep 2015 16:03:29 -0700
Subject: [PATCH] Ensure we can reliably get our local IP address.

Getting local IP address failed intermittently because
we were not setting the "length" variable before calling
getsockname() in isns_socket_get_local_addr(), which
was called any time we were not using "--local".
---
 socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/socket.c b/socket.c
index 4f16fe68b7b5..69dc028f6e92 100644
--- a/socket.c
+++ b/socket.c
@@ -2248,6 +2248,7 @@ isns_socket_get_local_addr(const isns_socket_t *sock,
 
 	if (sock->is_desc < 0)
 		return 0;
+	alen = sizeof(*addr);
 	if (getsockname(sock->is_desc,
 			(struct sockaddr *) addr, &alen) < 0) {
 		isns_error("getsockname: %m\n");
-- 
2.1.4

Reply via email to