From: Jan Vesely <[email protected]>

Without this patch connections to iscsiuio fail, and strace prints:

connect(8, {sa_family=AF_FILE, path=@"ISCSID_UIP_ABSTRACT_NAMESPACE"}, 32) = -1 
ECONNREFUSED (Connection refused)

Note that updating mgmt_ipc_listen and ipc_connect to use sizeof(addr) instead
of the precomputed values also fixes the issue.
Looks like "(Null bytes in the name have no special significance.)" [man 7 
unix] is the culprit here.

Signed-off-by: Jan Vesely <[email protected]>
---
 iscsiuio/src/unix/iscsid_ipc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
index 5c097e6..e22de0d 100644
--- a/iscsiuio/src/unix/iscsid_ipc.c
+++ b/iscsiuio/src/unix/iscsid_ipc.c
@@ -958,7 +958,7 @@ static void *iscsid_loop(void *arg)
  */
 int iscsid_init()
 {
-       int rc;
+       int rc, addr_len;
        struct sockaddr_un addr;
 
        iscsid_opts.fd = socket(AF_LOCAL, SOCK_STREAM, 0);
@@ -967,12 +967,14 @@ int iscsid_init()
                return iscsid_opts.fd;
        }
 
+       addr_len = offsetof(struct sockaddr_un, sun_path) + 
strlen(ISCSID_UIP_NAMESPACE) + 1;
+
        memset(&addr, 0, sizeof(addr));
        addr.sun_family = AF_LOCAL;
        memcpy((char *)&addr.sun_path + 1, ISCSID_UIP_NAMESPACE,
               strlen(ISCSID_UIP_NAMESPACE));
 
-       rc = bind(iscsid_opts.fd, (struct sockaddr *)&addr, sizeof(addr));
+       rc = bind(iscsid_opts.fd, (struct sockaddr *)&addr, addr_len);
        if (rc < 0) {
                LOG_ERR(PFX "Can not bind IPC socket: %s", strerror(errno));
                goto error;
-- 
1.8.1.4

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to