Date: Sat, 5 Jul 2014 21:18:33 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268302 - in head: sys/cam/ctl usr.sbin/ctld Message-ID: <201407052118.s65LIX4i076808@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sat Jul 5 21:18:33 2014 New Revision: 268302 URL: http://svnweb.freebsd.org/changeset/base/268302 Log: Pass through iSCSI session ISID from LOGIN request to the CTL frontend. ISID is an important part of initiator transport ID for iSCSI. It is not used now, but should be to properly implement persistent reservation. Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_frontend_iscsi.h head/sys/cam/ctl/ctl_ioctl.h head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/kernel.c head/usr.sbin/ctld/login.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Sat Jul 5 20:16:02 2014 (r268301) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Sat Jul 5 21:18:33 2014 (r268302) @@ -1507,6 +1507,13 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi * cihp->initiator_addr, sizeof(cs->cs_initiator_addr)); strlcpy(cs->cs_initiator_alias, cihp->initiator_alias, sizeof(cs->cs_initiator_alias)); + memcpy(cs->cs_initiator_isid, + cihp->initiator_isid, sizeof(cs->cs_initiator_isid)); + snprintf(cs->cs_initiator_id, sizeof(cs->cs_initiator_id), + "%s,i,0x%02x%02x%02x%02x%02x%02x", cs->cs_initiator_name, + cihp->initiator_isid[0], cihp->initiator_isid[1], + cihp->initiator_isid[2], cihp->initiator_isid[3], + cihp->initiator_isid[4], cihp->initiator_isid[5]); #ifdef ICL_KERNEL_PROXY if (cihp->socket > 0) { Modified: head/sys/cam/ctl/ctl_frontend_iscsi.h ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.h Sat Jul 5 20:16:02 2014 (r268301) +++ head/sys/cam/ctl/ctl_frontend_iscsi.h Sat Jul 5 21:18:33 2014 (r268302) @@ -86,6 +86,8 @@ struct cfiscsi_session { char cs_initiator_name[CTL_ISCSI_NAME_LEN]; char cs_initiator_addr[CTL_ISCSI_ADDR_LEN]; char cs_initiator_alias[CTL_ISCSI_ALIAS_LEN]; + char cs_initiator_isid[6]; + char cs_initiator_id[CTL_ISCSI_NAME_LEN + 5 + 6 + 1]; unsigned int cs_id; int cs_ctl_initid; #ifdef ICL_KERNEL_PROXY Modified: head/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- head/sys/cam/ctl/ctl_ioctl.h Sat Jul 5 20:16:02 2014 (r268301) +++ head/sys/cam/ctl/ctl_ioctl.h Sat Jul 5 21:18:33 2014 (r268302) @@ -681,6 +681,7 @@ struct ctl_iscsi_handoff_params { char initiator_name[CTL_ISCSI_NAME_LEN]; char initiator_addr[CTL_ISCSI_ADDR_LEN]; char initiator_alias[CTL_ISCSI_ALIAS_LEN]; + uint8_t initiator_isid[6]; char target_name[CTL_ISCSI_NAME_LEN]; int socket; int portal_group_tag; Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Sat Jul 5 20:16:02 2014 (r268301) +++ head/usr.sbin/ctld/ctld.h Sat Jul 5 21:18:33 2014 (r268302) @@ -178,6 +178,7 @@ struct connection { char *conn_initiator_name; char *conn_initiator_addr; char *conn_initiator_alias; + uint8_t conn_initiator_isid[6]; uint32_t conn_cmdsn; uint32_t conn_statsn; size_t conn_max_data_segment_length; Modified: head/usr.sbin/ctld/kernel.c ============================================================================== --- head/usr.sbin/ctld/kernel.c Sat Jul 5 20:16:02 2014 (r268301) +++ head/usr.sbin/ctld/kernel.c Sat Jul 5 21:18:33 2014 (r268302) @@ -787,6 +787,8 @@ kernel_handoff(struct connection *conn) strlcpy(req.data.handoff.initiator_alias, conn->conn_initiator_alias, sizeof(req.data.handoff.initiator_alias)); } + memcpy(req.data.handoff.initiator_isid, conn->conn_initiator_isid, + sizeof(req.data.handoff.initiator_isid)); strlcpy(req.data.handoff.target_name, conn->conn_target->t_name, sizeof(req.data.handoff.target_name)); #ifdef ICL_KERNEL_PROXY Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Sat Jul 5 20:16:02 2014 (r268301) +++ head/usr.sbin/ctld/login.c Sat Jul 5 21:18:33 2014 (r268302) @@ -850,6 +850,9 @@ login(struct connection *conn) log_errx(1, "received Login PDU with non-zero TSIH"); } + memcpy(conn->conn_initiator_isid, bhslr->bhslr_isid, + sizeof(conn->conn_initiator_isid)); + /* * XXX: Implement the C flag some day. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407052118.s65LIX4i076808>