[Pkg-iscsi-maintainers] [open-iscsi] 26/33: iscsiuio: Change socket bind to use the same struct size as iscsid
Ritesh Raj Sarraf
rrs at alioth.debian.org
Tue Nov 5 16:21:18 UTC 2013
This is an automated email from the git hooks/post-receive script.
rrs pushed a commit to branch upstream-mnc
in repository open-iscsi.
commit 3d7df63cc2978abf33733234ddbc50d075039ce3
Author: Jan Vesely <jvesely at redhat.com>
Date: Wed Jun 26 15:55:12 2013 +0200
iscsiuio: Change socket bind to use the same struct size as iscsid
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 <jvesely at redhat.com>
---
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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-iscsi/open-iscsi.git
More information about the Pkg-iscsi-maintainers
mailing list