From: Adheer Chandravanshi <adheer.chandravan...@qlogic.com> Need to replace struct sockaddr with struct sockaddr_storage in order to correctly handle IPv6 addresses.
Signed-off-by: Adheer Chandravanshi <adheer.chandravan...@qlogic.com> --- usr/iscsi_ipc.h | 2 +- usr/iscsiadm.c | 3 +-- usr/netlink.c | 13 +++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h index 5087b5c..e3001c9 100644 --- a/usr/iscsi_ipc.h +++ b/usr/iscsi_ipc.h @@ -137,7 +137,7 @@ struct iscsi_ipc { int (*recv_conn_state) (struct iscsi_conn *conn, uint32_t *state); int (*exec_ping) (uint64_t transport_handle, uint32_t host_no, - struct sockaddr *addr, uint32_t iface_num, + struct sockaddr_storage *addr, uint32_t iface_num, uint32_t iface_type, uint32_t size, uint32_t *status); int (*get_chap) (uint64_t transport_handle, uint32_t host_no, diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c index 0cdc1bb..9081ac8 100644 --- a/usr/iscsiadm.c +++ b/usr/iscsiadm.c @@ -3189,8 +3189,7 @@ static int exec_ping_op(struct iface_rec *iface, char *ip, int size, int count, * callout here. */ status = 0; - rc = ipc->exec_ping(t->handle, host_no, - (struct sockaddr *)&addr, iface->iface_num, + rc = ipc->exec_ping(t->handle, host_no, &addr, iface->iface_num, iface_type, size, &status); if (!rc && !status) printf("Ping %d completed\n", i); diff --git a/usr/netlink.c b/usr/netlink.c index 3984727..867bff9 100644 --- a/usr/netlink.c +++ b/usr/netlink.c @@ -1055,8 +1055,9 @@ exit: static int -ksend_ping(uint64_t transport_handle, uint32_t host_no, struct sockaddr *addr, - uint32_t iface_num, uint32_t iface_type, uint32_t pid, uint32_t size) +ksend_ping(uint64_t transport_handle, uint32_t host_no, + struct sockaddr_storage *addr, uint32_t iface_num, + uint32_t iface_type, uint32_t pid, uint32_t size) { int rc, addrlen; struct iscsi_uevent *ev; @@ -1074,13 +1075,13 @@ ksend_ping(uint64_t transport_handle, uint32_t host_no, struct sockaddr *addr, ev->u.iscsi_ping.payload_size = size; ev->u.iscsi_ping.pid = pid; - if (addr->sa_family == PF_INET) + if (addr->ss_family == PF_INET) addrlen = sizeof(struct sockaddr_in); - else if (addr->sa_family == PF_INET6) + else if (addr->ss_family == PF_INET6) addrlen = sizeof(struct sockaddr_in6); else { log_error("%s unknown addr family %d\n", - __FUNCTION__, addr->sa_family); + __FUNCTION__, addr->ss_family); return -EINVAL; } memcpy(setparam_buf + sizeof(*ev), addr, addrlen); @@ -1095,7 +1096,7 @@ ksend_ping(uint64_t transport_handle, uint32_t host_no, struct sockaddr *addr, } static int kexec_ping(uint64_t transport_handle, uint32_t host_no, - struct sockaddr *addr, uint32_t iface_num, + struct sockaddr_storage *addr, uint32_t iface_num, uint32_t iface_type, uint32_t size, uint32_t *status) { struct pollfd pfd; -- 1.7.1 -- 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.