From: Robert W. <wrw...@us...> - 2007-01-02 20:12:15
|
Update of /cvsroot/linuxisns/iscsiClient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23569/src Modified Files: config.c initiator.c parse.c target.c Log Message: add src attr and portal group support Index: config.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/config.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config.c 11 Dec 2006 18:50:04 -0000 1.2 --- config.c 2 Jan 2007 20:12:07 -0000 1.3 *************** *** 198,202 **** { listelement * tempp; - printf ("Added %s to the initiator list.\n", listpointer->InitiatorName); tempp = (listelement*) listpointer->link; free (listpointer); --- 198,201 ---- Index: initiator.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/initiator.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** initiator.c 11 Dec 2006 18:50:04 -0000 1.7 --- initiator.c 2 Jan 2007 20:12:07 -0000 1.8 *************** *** 41,45 **** #define CLIENT_VERSION "1.1" ! #define MAX_VERSION 6 #define MIN_VERSION 0 --- 41,45 ---- #define CLIENT_VERSION "1.1" ! #define MAX_VERSION 1 #define MIN_VERSION 0 *************** *** 140,153 **** int type = 2; SOIP_Ver ver; printf ("Registering ISCSI Node.\n"); ISNSCreateHdr (ISNS_REG_DEV_ATTR_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! /* src attribute */ ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); /* delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); memset (&ver, 0, sizeof (ver)); ver.max = MAX_VERSION; --- 140,164 ---- int type = 2; SOIP_Ver ver; + int ip; + int port_type; printf ("Registering ISCSI Node.\n"); ISNSCreateHdr (ISNS_REG_DEV_ATTR_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! /* Add the Target ID to the PDU */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (input->iscsiID)), ! input->iscsiID, 0); /* delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); + /* Add the Entity */ + ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen(input->EntityID)), + input->EntityID, 0); + + /* Add the Entity Period */ + ISNSAppendAttr (&cmd, ISNS_ENTITY_PERIOD, 4, NULL, input->EntityPeriod); + + memset (&ver, 0, sizeof (ver)); ver.max = MAX_VERSION; *************** *** 161,170 **** ISNSAppendAttr ((struct cmd *)&cmd, ISNS_PROT_VER, 4, (char *)&ver, 0); } - /* Add the Entity Period */ - ISNSAppendAttr (&cmd, ISNS_ENTITY_PERIOD, 4, NULL, input->EntityPeriod); - /* Add the Entity */ - ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen(input->EntityID)), - input->EntityID, 0); printf ("ID [%s] > %s\n", input->iscsiID, input->iscsiID); --- 172,176 ---- *************** *** 184,187 **** --- 190,210 ---- ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 4, NULL, type); + /* Get IP */ + ip = inet_addr (input->PortalIP); + { + char tempb[256]; + memset (tempb, 0, sizeof (tempb)); + memcpy (tempb + 12, &ip, sizeof (ip)); + ISNSAppendAttr (&cmd, ISNS_PORTAL_IP, 16, tempb, 0); + } + + /* Port Type is always TCP*/ + port_type = 1; + + /* Get Port */ + ISNSAppendAttr (&cmd, ISNS_PORTAL_PORT, 4, NULL, + input->Port | (port_type == 1 ? 0 : 0x10000)); + + if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) { *************** *** 203,208 **** ISNSCreateHdr (ISNS_REG_DEV_ATTR_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! /* src attribute */ ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (current->EntityID)), --- 226,231 ---- ISNSCreateHdr (ISNS_REG_DEV_ATTR_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), ! current->iscsiID, 0); ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (current->EntityID)), *************** *** 269,272 **** --- 292,299 ---- ISNSAppendAttr (&cmd, ISNS_PORTAL_IP, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_PORTAL_PORT, 0, NULL, 0); + ISNSAppendAttr (&cmd, ISNS_PORTAL_GROUP_ISCSI_NAME, 0, NULL, 0); + ISNSAppendAttr (&cmd, ISNS_PORTAL_GROUP_IP, 0, NULL, 0); + ISNSAppendAttr (&cmd, ISNS_PORTAL_GROUP_PORT, 0, NULL, 0); + ISNSAppendAttr (&cmd, ISNS_PORTAL_GROUP_TAG, 0, NULL, 0); if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) Index: target.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/target.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** target.c 11 Dec 2006 18:50:04 -0000 1.6 --- target.c 2 Jan 2007 20:12:07 -0000 1.7 *************** *** 166,178 **** int type = 1; SOIP_Ver ver; printf ("Registering ISCSI Node.\n"); ISNSCreateHdr (ISNS_REG_DEV_ATTR_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); /* delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); memset (&ver, 0, sizeof (ver)); /* MAX_VERSION and MIN_VERSION are global constants set above */ --- 166,184 ---- int type = 1; SOIP_Ver ver; + int ip; + int port_type; printf ("Registering ISCSI Node.\n"); ISNSCreateHdr (ISNS_REG_DEV_ATTR_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! /* Add the Target ID to the PDU */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen(input->iscsiID)),input->iscsiID,0); /* delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); + /* Add the Entity ID */ + ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4(strlen(input->EntityID)),input->EntityID,0); + memset (&ver, 0, sizeof (ver)); /* MAX_VERSION and MIN_VERSION are global constants set above */ *************** *** 188,194 **** } - /* Add the Entity ID */ - ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4(strlen(input->EntityID)),input->EntityID,0); - /* Add the Entity Period */ ISNSAppendAttr (&cmd, ISNS_ENTITY_PERIOD, 4, NULL, input->EntityPeriod); --- 194,197 ---- *************** *** 208,211 **** --- 211,232 ---- ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 4, NULL, type); + /* Get IP */ + ip = inet_addr (input->PortalIP); + { + char tempb[256]; + memset (tempb, 0, sizeof (tempb)); + memcpy (tempb + 12, &ip, sizeof (ip)); + ISNSAppendAttr (&cmd, ISNS_PORTAL_IP, 16, tempb, 0); + } + + /* Port Type is TCP*/ + port_type = 1; + + /* Get Port */ + ISNSAppendAttr (&cmd, ISNS_PORTAL_PORT, 4, NULL, + input->Port | (port_type == 1 ? 0 : 0x10000)); + + ISNSAppendAttr (&cmd, ISNS_PORTAL_GROUP_ISCSI_NAME, PAD4 (strlen("TEST")),"TEST",0); + /* Send the command, parse the response. We will get the entity ID back from this */ if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) *************** *** 230,234 **** /* We are adding a portal to our target's entity */ ! ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (current->EntityID)), current->EntityID, 0); --- 251,255 ---- /* We are adding a portal to our target's entity */ ! ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (current->EntityID)), current->EntityID, 0); *************** *** 335,340 **** ISNSCreateHdr (ISNS_REG_DDS_REQ, &cmd, sizeof (cmd),0); ! /* Delimiter */ ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); /* The target's DDS ID is sent */ --- 356,361 ---- ISNSCreateHdr (ISNS_REG_DDS_REQ, &cmd, sizeof (cmd),0); ! /* The source type is iSCSI node and the name is the name of the target */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); /* The target's DDS ID is sent */ *************** *** 361,365 **** ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), 0); ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); /* Zero out the src field. */ --- 382,387 ---- ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), 0); ! /* The source type is iSCSI node and the name is the name of the target */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); /* Zero out the src field. */ *************** *** 394,398 **** ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), 0); ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); /* Zero out the src field. */ --- 416,421 ---- ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), 0); ! /* The source type is iSCSI node and the name is the name of the target */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); /* Zero out the src field. */ Index: parse.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/parse.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** parse.c 11 Dec 2006 00:42:28 -0000 1.2 --- parse.c 2 Jan 2007 20:12:07 -0000 1.3 *************** *** 75,79 **** case ISNS_REL_SW_ID_REQ : return("Release Switch ID Request"); case ISNS_GET_SW_ID_REQ : return("Get Switch ID Request"); - case ISNS_SAVE_DB_REQ : return("Save Database Request"); case ISNS_REG_DEV_ATTR_RES : return("Register Device Attribute Response"); case ISNS_DEV_ATTR_QRY_RES : return("Device Attribute Query Response"); --- 75,78 ---- *************** *** 92,96 **** case ISNS_REL_SW_ID_RES : return("Release Switch ID Response"); case ISNS_GET_SW_ID_RES : return("Get Switch ID Response"); - case ISNS_SAVE_DB_RES : return("Save Database Response"); default : return(""); } --- 91,94 ---- *************** *** 115,119 **** case ISNS_ESI_INTERVAL : return("ESI Interval"); case ISNS_ESI_PORT : return("ESI/SCN UDP Port"); - case ISNS_PORTAL_GROUP : return("Portal Group"); case ISNS_PORTAL_CERT : return("Portal Certificate"); case ISNS_ISCSI_NODE_ID : return("iSCSI Name"); --- 113,116 ---- *************** *** 135,139 **** case ISNS_IFCP_SCN_BITMAP : return("iFCP Node SCN bitmap"); case ISNS_IFCP_NODE_CERT : return("iFCP Node Certificate"); - case iSNS_FC3_TYPE_QUERY_KEY : return("FC-4 Type Code"); case ISNS_NODE_NAME : return("FC Device WWNN"); case ISNS_NODE_SYM_NAME : return("FC Device Sym Node Name"); --- 132,135 ---- *************** *** 153,156 **** --- 149,156 ---- case ISNS_PORTAL_IDX : return("Portal Index"); case ISNS_DD_ISCSI_MEMBER_IDX: return("Discovery Domain iSCSI Member Index"); + case ISNS_PORTAL_GROUP_ISCSI_NAME : return("Portal Group ISCSI Name"); + case ISNS_PORTAL_GROUP_IP : return ("Portal Group IP address"); + case ISNS_PORTAL_GROUP_PORT : return ("Portal Group Port"); + case ISNS_PORTAL_GROUP_TAG : return ("Portal Group Tag"); default : return("Unknown TAG code"); *************** *** 243,246 **** --- 243,247 ---- case ISNS_DDS_ID : case ISNS_DD_ID : + case ISNS_PORTAL_GROUP_PORT : printf ("Tag: %s = %d\n", isnsTagText(attrtag), ntohl(p_attr->val.etype)); break; *************** *** 249,253 **** case ISNS_DDS_SYM_NAME : case ISNS_DD_SYM_NAME : - case ISNS_PORTAL_GROUP : case ISNS_ISCSI_NODE_ID : case ISNS_ISCSI_ALIAS : --- 250,253 ---- *************** *** 258,261 **** --- 258,262 ---- case ISNS_DD_ISCSI_MEMBER : case ISNS_DD_IFCP_MEMBER : + case ISNS_PORTAL_GROUP_ISCSI_NAME : printf ("Tag: %s = \"%s\"\n", isnsTagText(attrtag), &p_attr->val); break; *************** *** 268,271 **** --- 269,273 ---- case ISNS_FC_PORT_IP : case ISNS_FC_NODE_IP : + case ISNS_PORTAL_GROUP_IP : { char ipaddr[45]; *************** *** 330,337 **** case ISNS_IFCP_SCN_BITMAP : case ISNS_IFCP_NODE_CERT : - case iSNS_FC3_TYPE_QUERY_KEY : case ISNS_NODE_NAME : case ISNS_FC_NODE_CERT : case ISNS_COMPANY_OUI : default: printf ("Tag: %s = ", isnsTagText(attrtag)); --- 332,339 ---- case ISNS_IFCP_SCN_BITMAP : case ISNS_IFCP_NODE_CERT : case ISNS_NODE_NAME : case ISNS_FC_NODE_CERT : case ISNS_COMPANY_OUI : + case ISNS_PORTAL_GROUP_TAG : default: printf ("Tag: %s = ", isnsTagText(attrtag)); |