You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(23) |
Dec
(85) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(19) |
Feb
(13) |
Mar
(7) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(31) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Robert W. <wrw...@us...> - 2007-08-23 02:50:25
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5003/isnsserver/include Modified Files: iSNSdb.h Log Message: fixed tcp memory leak and Attr Query requests Index: iSNSdb.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdb.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSdb.h 19 Dec 2006 22:25:31 -0000 1.9 --- iSNSdb.h 23 Aug 2007 02:50:20 -0000 1.10 *************** *** 84,90 **** SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); - void - ISNSExceptionHdlr (void); - int ISNSdbRead (ISNS_DBKey *key, SOIP_DB_Entry *entry); --- 84,87 ---- |
From: Robert W. <wrw...@us...> - 2007-08-23 02:50:25
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5003/isnsserver/src Modified Files: iSNSLinux.c iSNSdb.c iSNSparse.c iSNSquery.c iSNSreg.c iSNStrcv.c Log Message: fixed tcp memory leak and Attr Query requests Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** iSNSquery.c 13 Aug 2007 22:56:45 -0000 1.24 --- iSNSquery.c 23 Aug 2007 02:50:20 -0000 1.25 *************** *** 117,121 **** { int status = ISNS_UNKNOWN_ERR; ! ISNS_Attr *attr; ISNS_Attr *src_attr; ISNS_Attr *attr_indx[SNS_MAX_ATTRS]; --- 117,121 ---- { int status = ISNS_UNKNOWN_ERR; ! ISNS_Key *key; ISNS_Attr *src_attr; ISNS_Attr *attr_indx[SNS_MAX_ATTRS]; *************** *** 123,133 **** ISNSParseMsg( &p_md->msg, attr_indx, key_indx, &src_attr ); ! attr = (ISNS_Attr *)(attr_indx[0]); ! if (attr == NULL) { __DEBUG (isns_query_debug & 1, (No attr in query msg)); return ( ISNS_MSG_FMT_ERR ); } ! switch ( attr->tag ) { case ISNS_ENTITY_ID: --- 123,133 ---- ISNSParseMsg( &p_md->msg, attr_indx, key_indx, &src_attr ); ! key = (ISNS_Key *)(key_indx[0]); ! if (key == NULL) { __DEBUG (isns_query_debug & 1, (No attr in query msg)); return ( ISNS_MSG_FMT_ERR ); } ! switch ( key->tag ) { case ISNS_ENTITY_ID: *************** *** 257,261 **** { case ISNS_ENTITY_ID: ! entityKeyFlag = ii; break; case ISNS_ENTITY_IDX: --- 257,262 ---- { case ISNS_ENTITY_ID: ! if (key->len > 0) ! entityKeyFlag = ii; break; case ISNS_ENTITY_IDX: *************** *** 1021,1025 **** break; case ISNS_PORTAL_IP: ! portalIpKeyFlag = ii; break; case ISNS_PORTAL_PORT: --- 1022,1027 ---- break; case ISNS_PORTAL_IP: ! if (key->len > 0) ! portalIpKeyFlag = ii; break; case ISNS_PORTAL_PORT: *************** *** 1572,1576 **** { case ISNS_ISCSI_NODE_ID: ! nodeKeyIndex = ii; break; case ISNS_ISCSI_TYPE: --- 1574,1579 ---- { case ISNS_ISCSI_NODE_ID: ! if (key->len > 0) ! nodeKeyIndex = ii; break; case ISNS_ISCSI_TYPE: *************** *** 2885,2892 **** { __DEBUG (isns_query_debug &1, portal group record not found ); ! return rval; } ! ! p_portal_group = &entry4.data.portal_group; for (jj = 0; (jj < SNS_MAX_ATTRS) && (attr_indx[jj]); jj++) --- 2888,2895 ---- { __DEBUG (isns_query_debug &1, portal group record not found ); ! // continue on, but knowning that p_portal_group is null } ! else ! p_portal_group = &entry4.data.portal_group; for (jj = 0; (jj < SNS_MAX_ATTRS) && (attr_indx[jj]); jj++) *************** *** 2932,2943 **** break; case ISNS_PORTAL_GROUP_PORT: ! __DEBUG (isns_query_debug &1,ISNS_PORTAL_GROUP_PORT:%i,p_portal->ip_port); ! ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_GROUP_PORT_SIZE, NULL, p_portal_group->ip_port); break; case ISNS_PORTAL_GROUP_IP: ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_IP); ! ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_IP_SIZE, p_portal_group->ip_addr.v, 0); break; case ISNS_PORTAL_GROUP_ISCSI_NAME: --- 2935,2966 ---- break; case ISNS_PORTAL_GROUP_PORT: ! if (p_portal_group) ! { ! __DEBUG (isns_query_debug &1,ISNS_PORTAL_GROUP_PORT:%i,p_portal_group->ip_port); ! ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_GROUP_PORT_SIZE, NULL, p_portal_group->ip_port); + } + else + { + //since portal group doesn't exist use portal instead - workaround for open-iscsiinitiator + __DEBUG (isns_query_debug &1,ISNS_PORTAL_GROUP_PORT:%i,p_portal->ip_port); + ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_GROUP_PORT_SIZE, + NULL, p_portal->ip_port); + } break; case ISNS_PORTAL_GROUP_IP: ! if (p_portal_group) ! { ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_IP); ! ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_IP_SIZE, p_portal_group->ip_addr.v, 0); + } + else + { + //since portal group doesn't exist use portal instead - workaround for open-iscsiinitiator + __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_IP); + ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_IP_SIZE, + p_portal->ip_addr.v, 0); + } break; case ISNS_PORTAL_GROUP_ISCSI_NAME: *************** *** 2947,2952 **** break; case ISNS_PORTAL_GROUP_TAG: ! ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, NULL, p_portal_group->portal_tag); break; default: --- 2970,2979 ---- break; case ISNS_PORTAL_GROUP_TAG: ! if (p_portal_group) ! { ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_TAG); ! ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, NULL, p_portal_group->portal_tag); + } break; default: Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** iSNSparse.c 13 Aug 2007 22:56:45 -0000 1.21 --- iSNSparse.c 23 Aug 2007 02:50:20 -0000 1.22 *************** *** 292,306 **** } ! __DEBUG (isns_parse_debug &1,%s flags:%x,FuncIDText(msg->hdr.type),msg->hdr.flags); /* Store Keys */ ! if (msg->hdr.type & 0x8000) // response messages with error code offset = 4; else offset = 0; ! __DEBUG (isns_parse_debug &1,"offset:%i",offset); ! ! ptr = attr = (ISNS_Attr *)(&msg->payload+offset); if (src_attr != NULL) --- 292,307 ---- } ! __DEBUG (isns_parse_debug &1,%s:0x%x flags:%x msg_len:%i, FuncIDText(msg->hdr.type), msg->hdr.type, msg->hdr.flags, msg->hdr.msg_len); /* Store Keys */ ! if (msg->hdr.type & 0x8000) // response messages with status code ! { ! __DEBUG (isns_parse_debug &1,"response status code:0x%x",msg->payload); offset = 4; + } else offset = 0; ! ptr = attr = (ISNS_Attr *)((char *)&msg->payload+offset); if (src_attr != NULL) *************** *** 317,330 **** } - if ( (msg->hdr.type == ISNS_ESI_RSP) - || (msg->hdr.type == ISNS_REG_DEV_ATTR_RES) - || (msg->hdr.type == ISNS_DEV_ATTR_QRY_RES) ) - - { - __DEBUG (isns_parse_debug &1, skip the error status field / timestamp); - offset += 4; - ptr = (struct ISNS_attr *)((char *) ptr + 4); - } - jj = 0; while ((char *)ptr < (char *) &msg->payload + msg->hdr.msg_len) --- 318,321 ---- *************** *** 430,434 **** } ! __DEBUG (isns_parse_debug &1,"Processing msg type=0x%x, tag=0x%x",msg->msg.hdr.type,pattr->tag); /* length */ --- 421,425 ---- } ! //__DEBUG (isns_parse_debug &1,"Processing msg type=0x%x, tag=%i",msg->msg.hdr.type,pattr->tag); /* length */ Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** iSNSreg.c 13 Aug 2007 22:56:45 -0000 1.28 --- iSNSreg.c 23 Aug 2007 02:50:21 -0000 1.29 *************** *** 180,183 **** --- 180,184 ---- __DEBUG (isns_reg_debug &1,regPortalFlag:%i,regPortalFlag); __DEBUG (isns_reg_debug &1,regEntityFlag%i,regEnitityFlag); + __DEBUG (isns_reg_debug &1,regPortalGroupFlag%i,regPortalGroupFlag); status = ISNS_NO_ERR; Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** iSNSdb.c 13 Aug 2007 22:56:44 -0000 1.29 --- iSNSdb.c 23 Aug 2007 02:50:20 -0000 1.30 *************** *** 92,102 **** dbStats iSNS_stats; ! /* ! * Local function prototypes ! */ ! ! void ! ISNSExceptionHdlr (void); ! /********************************************************************* --- 92,107 ---- dbStats iSNS_stats; ! void ISNSExceptionHdlr1(char * string); ! void ISNSExceptionHdlr2(char * string); ! void ISNSExceptionHdlr3(char * string); ! void ISNSExceptionHdlr4(char * string); ! void ISNSExceptionHdlr5(char * string); ! void ISNSExceptionHdlr6(char * string); ! void ISNSExceptionHdlr7(char * string); ! void ISNSExceptionHdlr8(char * string); ! void ISNSExceptionHdlr9(char * string); ! void ISNSExceptionHdlr10(char * string); ! void ISNSExceptionHdlr11(char * string); ! void ISNSExceptionHdlr12(char * string); /********************************************************************* *************** *** 698,724 **** dbfp[NODE_NAME_KEY] = gdbm_open("isns1.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[PORT_NAME_KEY] = gdbm_open("isns2.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[ENTITY_ID_KEY] = gdbm_open("isns3.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[PORTAL_ID_KEY] = gdbm_open("isns4.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[DDS_ID_KEY] = gdbm_open("isns5.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[DD_ID_KEY] = gdbm_open("isns6.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[ISCSI_ID_KEY] = gdbm_open("isns7.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[PORTAL_GROUP_ID_KEY] = gdbm_open("isns8.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[ENTITY_IDX_KEY] = gdbm_open("isns9.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[ISCSI_IDX_KEY] = gdbm_open("isns10.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[PORTAL_IDX_KEY] = gdbm_open("isns11.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); dbfp[LIST_KEY] = gdbm_open("isns12.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr); ddmem=(SOIP_Dd_Member *)calloc( MAX_MEMBER_PER_DD, sizeof(SOIP_Dd_Member) ); --- 703,729 ---- dbfp[NODE_NAME_KEY] = gdbm_open("isns1.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr1); dbfp[PORT_NAME_KEY] = gdbm_open("isns2.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr2); dbfp[ENTITY_ID_KEY] = gdbm_open("isns3.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr3); dbfp[PORTAL_ID_KEY] = gdbm_open("isns4.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr4); dbfp[DDS_ID_KEY] = gdbm_open("isns5.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr5); dbfp[DD_ID_KEY] = gdbm_open("isns6.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr6); dbfp[ISCSI_ID_KEY] = gdbm_open("isns7.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr7); dbfp[PORTAL_GROUP_ID_KEY] = gdbm_open("isns8.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr8); dbfp[ENTITY_IDX_KEY] = gdbm_open("isns9.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr9); dbfp[ISCSI_IDX_KEY] = gdbm_open("isns10.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr10); dbfp[PORTAL_IDX_KEY] = gdbm_open("isns11.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr11); dbfp[LIST_KEY] = gdbm_open("isns12.db",1024,GDBM_WRCREAT,0666, ! ISNSExceptionHdlr12); ddmem=(SOIP_Dd_Member *)calloc( MAX_MEMBER_PER_DD, sizeof(SOIP_Dd_Member) ); *************** *** 954,960 **** /******************************************************************** ********************************************************************/ ! void ISNSExceptionHdlr() { ! __LOG_INFO ("ISNSExceptionHdlr stub."); } --- 959,1009 ---- /******************************************************************** ********************************************************************/ ! void ISNSExceptionHdlr1(char * string) { ! __LOG_INFO ("Database 1 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr2(char * string) ! { ! __LOG_INFO ("Database 2 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr3(char * string) ! { ! __LOG_INFO ("Database 3 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr4(char * string) ! { ! __LOG_INFO ("Database 4 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr5(char * string) ! { ! __LOG_INFO ("Database 5 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr6(char * string) ! { ! __LOG_INFO ("Database 6 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr7(char * string) ! { ! __LOG_INFO ("Database 7 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr8(char * string) ! { ! __LOG_INFO ("Database 8 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr9(char * string) ! { ! __LOG_INFO ("Database 9 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr10(char * string) ! { ! __LOG_INFO ("Database 10 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr11(char * string) ! { ! __LOG_INFO ("Database 11 ISNSExceptionHdlr:%s",string); ! } ! void ISNSExceptionHdlr12(char * string) ! { ! __LOG_INFO ("Database 12 ISNSExceptionHdlr:%s",string); } Index: iSNStrcv.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNStrcv.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iSNStrcv.c 7 Aug 2007 14:41:48 -0000 1.6 --- iSNStrcv.c 23 Aug 2007 02:50:21 -0000 1.7 *************** *** 33,36 **** --- 33,37 ---- #include <signal.h> #include <sys/poll.h> + #include <errno.h> #include "iSNS.h" *************** *** 39,45 **** #include "iSNScomm.h" #include "iSNSipc.h" - #include "iSNSdebug.h" /******************************************/ --- 40,47 ---- #include "iSNScomm.h" #include "iSNSipc.h" #include "iSNSdebug.h" + #define SOCKET_TIMEOUT_VALUE 120*1000 + /******************************************/ *************** *** 73,86 **** SOCKET sock; SOCKET sockfd; ! #ifdef SNS_LINUX ! int not_needed = 1; ! #else ! char not_needed = 1; ! #endif ! int len; struct sockaddr_in my_addr, their_addr; __DEBUG(sns_tcp_debug & 1, (TCP_RecvMain: Starting)); - /* setup for the bind */ my_addr.sin_family = AF_INET; my_addr.sin_port = htons ((short) sns_comm_main_port); --- 75,88 ---- SOCKET sock; SOCKET sockfd; ! int not_needed = 1; ! socklen_t addrlen; ! int rc; ! int threadcount = 0; ! pthread_attr_t attr; ! struct sockaddr_in my_addr, their_addr; + __DEBUG(sns_tcp_debug & 1, (TCP_RecvMain: Starting)); my_addr.sin_family = AF_INET; my_addr.sin_port = htons ((short) sns_comm_main_port); *************** *** 89,94 **** sock = socket(AF_INET, SOCK_STREAM, 0); - /* Allow reuse of addresses */ #ifdef SNS_LINUX if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, ¬_needed, sizeof(not_needed)) < 0) { --- 91,96 ---- sock = socket(AF_INET, SOCK_STREAM, 0); #ifdef SNS_LINUX + /* Allow reuse of addresses */ if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, ¬_needed, sizeof(not_needed)) < 0) { *************** *** 98,117 **** #endif ! /* Do a Bind */ ! if (bind (sock, (struct sockaddr *) &my_addr, sizeof (my_addr)) < 0) { ! close (sock); ! if (bind (sock, (struct sockaddr *) &my_addr, sizeof (my_addr)) < 0) ! { ! __LOG_ERROR ("Fatal Error while Binding."); ! return (0); ! } } ! len = sizeof (their_addr); ! if (listen (sock, 100) < 0) { ! __LOG_ERROR ("Fatal Error while doing a Listen"); return (0); } --- 100,119 ---- #endif ! rc = bind (sock, (struct sockaddr *) &my_addr, sizeof (my_addr)); ! if (rc < 0) { ! close (sock); ! { ! __LOG_ERROR ("Fatal Error while Binding:%i - %s.",rc,strerror(errno)); ! return (0); ! } } ! addrlen = sizeof (their_addr); ! rc = listen(sock,100); ! if (rc < 0) { ! __LOG_ERROR ("Fatal Error while doing a Listen:%i - %s",rc,strerror(errno)); return (0); } *************** *** 119,133 **** while (1) { ! /* Do an Accept */ ! if ((sockfd = ! accept (sock, (struct sockaddr *) &their_addr, ! (socklen_t *)&len)) < 0) { ! __LOG_ERROR ("Fatal Error while doing an Accept"); ! return (0); } ! ! __DEBUG(sns_tcp_debug & 1, (Received TCP connection)); ! { #ifdef SNS_LINUX --- 121,131 ---- while (1) { ! sockfd = accept (sock, (struct sockaddr *) &their_addr,&addrlen); ! if (sockfd < 0) { ! __LOG_ERROR ("Fatal Error while doing an Accept sockfd:%i - %s",sockfd,strerror(errno)); ! break; } ! else { #ifdef SNS_LINUX *************** *** 139,144 **** cb_p=malloc(sizeof(TCP_CB)); cb_p->sock=sockfd; #ifdef SNS_LINUX ! pthread_create (&ignore, NULL, (void*) TCP_RecvThread, (LPVOID)cb_p); #else CreateThread(0, 0, TCP_RecvThread, (LPVOID)cb_p, 0, &ignore); --- 137,152 ---- cb_p=malloc(sizeof(TCP_CB)); cb_p->sock=sockfd; + + __DEBUG(sns_tcp_debug & 1,"accepted a TCP connection request thread count:%i",threadcount); + #ifdef SNS_LINUX ! pthread_attr_init(&attr); ! pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); ! rc = pthread_create (&ignore, &attr, (void*) TCP_RecvThread, (LPVOID)cb_p); ! if (rc != 0) ! { ! __LOG_ERROR("Error creating thread:%i - %s",rc,strerror(rc)); ! } ! threadcount++; #else CreateThread(0, 0, TCP_RecvThread, (LPVOID)cb_p, 0, &ignore); *************** *** 147,155 **** } ! __LOG_INFO ("TCP_RecvMain: Finished."); } - #define SOCKET_TIMEOUT_VALUE 120*1000 - /******************************************/ #ifdef SNS_LINUX --- 155,162 ---- } ! __LOG_INFO("TCP_RecvMain: Finished."); ! return(ERROR); } /******************************************/ #ifdef SNS_LINUX *************** *** 174,183 **** ISNS_Msg_Descp md; ! __DEBUG(sns_tcp_debug & 1, (TCP_RecvThread: Starting)); ! sockfd=cb_p->sock; ! ! __DEBUG(sns_tcp_debug & 1, (connection starting sockfd:%i), sockfd); free(cb_p); startIndex=0; endIndex=0; --- 181,189 ---- ISNS_Msg_Descp md; ! __DEBUG(sns_tcp_debug & 1, (TCP_RecvThread: Starting a thread on socket:%i),cb_p->sock); + sockfd=cb_p->sock; free(cb_p); + startIndex=0; endIndex=0; *************** *** 195,203 **** break; } i = recv(sockfd, &buffer[endIndex], sizeof(buffer)-endIndex, 0); ! if (i<=0) { ! __DEBUG(sns_tcp_debug & 1, (recv error or connection closed)); close(sockfd); break; --- 201,222 ---- break; } + else if (rc < 0) + { + __LOG_ERROR("Error on connection:%i - errno:%i %s",sockfd,errno,strerror(errno)); + close(sockfd); + break; + } i = recv(sockfd, &buffer[endIndex], sizeof(buffer)-endIndex, 0); ! ! if (i == 0) { ! __DEBUG(sns_tcp_debug & 1, (recv no data - client closed connection)); ! close(sockfd); ! break; ! } ! else if (i < 0) ! { ! __LOG_ERROR("recv error we will close connection:%i - %s",i,strerror(errno)); close(sockfd); break; *************** *** 234,242 **** while (!sns_ready) { - #ifdef SNS_LINUX sleep(1); - #else - Sleep(1); - #endif } SendIPCMessage(SNS_EP, (void *)&md, --- 253,257 ---- *************** *** 246,250 **** startIndex+=msg_size; } - if (pending==0) { --- 261,264 ---- *************** *** 254,257 **** } ! return (ERROR); } --- 268,275 ---- } ! __DEBUG(sns_tcp_debug & 1, (TCP_RecvThread: Socket:%i Exiting thread),sockfd); ! /* thread terminates here */ ! pthread_exit(&rc); ! __LOG_ERROR("pthread_exit failed"); ! return (SUCCESS); } Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** iSNSLinux.c 13 Aug 2007 22:56:44 -0000 1.13 --- iSNSLinux.c 23 Aug 2007 02:50:20 -0000 1.14 *************** *** 399,402 **** --- 399,407 ---- sns_tcp_debug = -1; } + else if (!strcmp(type,"tcp")) + { + sns_comm_debug = -1; + sns_tcp_debug = -1; + } else if (!strcmp(type,"db")) { |
From: Robert W. <wrw...@us...> - 2007-08-23 02:50:24
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5003/isnsclient/src Modified Files: comm.c entity.c iscsi.c isns.c payloads.c Log Message: fixed tcp memory leak and Attr Query requests Index: payloads.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/payloads.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** payloads.c 13 Aug 2007 22:56:44 -0000 1.5 --- payloads.c 23 Aug 2007 02:50:20 -0000 1.6 *************** *** 67,70 **** --- 67,71 ---- else { + ISNSAppendAttr (&cmd, ISNS_DDS_ID, 0, NULL, 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_DDS_ID, 0, NULL, 0); *************** *** 102,105 **** --- 103,107 ---- else { + ISNSAppendAttr (&cmd, ISNS_DD_ID, 0, NULL, 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_DD_ID, 0, NULL, 0); *************** *** 414,421 **** char buffer[MAX_PAYLOAD_SIZE]={0}; if (strlen(id) ) { - ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); - ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); ISNSAppendAttr (&cmd, ISNS_ISCSI_IDX, ISNS_INDEX_SIZE, NULL, atoi(id)); --- 416,424 ---- char buffer[MAX_PAYLOAD_SIZE]={0}; + ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); + ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); + if (strlen(id) ) { ISNSAppendAttr (&cmd, ISNS_ISCSI_IDX, ISNS_INDEX_SIZE, NULL, atoi(id)); *************** *** 426,431 **** else { ! ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); --- 429,433 ---- else { ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, 0, NULL, 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); *************** *** 450,454 **** ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, 0, NULL, 0); --- 452,456 ---- ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); ! ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, 0, NULL, 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, 0, NULL, 0); *************** *** 470,473 **** --- 472,476 ---- ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); + ISNSAppendAttr (&cmd, ISNS_PORTAL_IP, 0, NULL, 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); Index: comm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/comm.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** comm.c 14 Aug 2007 03:43:55 -0000 1.9 --- comm.c 23 Aug 2007 02:50:20 -0000 1.10 *************** *** 147,156 **** /* the connection actually occurs. If it can't connect, then a timeout occurs */ fds.fd = fd; ! fds.events = POLLOUT; for (;;) { fds.revents = 0; ! rc = poll(&fds, 1, timeout * 1000); if (rc < 0) { if (!(errno == EINTR || errno == EAGAIN)) break; --- 147,157 ---- /* the connection actually occurs. If it can't connect, then a timeout occurs */ fds.fd = fd; ! fds.events = 0XFFFF; //POLLOUT; for (;;) { fds.revents = 0; ! rc = poll(&fds, 1, timeout * 5000); if (rc < 0) { + printf("errno is:%i %s\n",errno,strerror(errno)); if (!(errno == EINTR || errno == EAGAIN)) break; *************** *** 162,168 **** } else ! /* success we have a connection */ ! if (fds.revents & POLLOUT) ! break; } } --- 163,173 ---- } else ! if (fds.revents & POLLERR) ! { ! printf ("TCP error on connection\n"); ! exit(-1); ! } ! printf("We have a connection:0x%x\n",fds.revents); ! break; } } *************** *** 171,174 **** --- 176,181 ---- fcntl (fd, F_SETFL, flags ); + // printf("Spawn TCPReceiveMain\n"); + /* Spawn TCP Recv Thread*/ { *************** *** 276,280 **** { /* Loops until we receive a msg */ ! Sleep (1); } --- 283,287 ---- { /* Loops until we receive a msg */ ! usleep(100); } Index: entity.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/entity.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** entity.c 14 Aug 2007 03:43:55 -0000 1.9 --- entity.c 23 Aug 2007 02:50:20 -0000 1.10 *************** *** 193,196 **** --- 193,199 ---- cmdLine, 0); } + else + ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, 0, NULL, 0); + } } Index: isns.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/isns.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** isns.c 14 Aug 2007 03:43:55 -0000 1.11 --- isns.c 23 Aug 2007 02:50:20 -0000 1.12 *************** *** 283,286 **** --- 283,287 ---- default: + ISNSAppendAttr (&cmd, ISNS_DDS_ID, 0, NULL, 0); break; } *************** *** 408,411 **** --- 409,413 ---- default: + ISNSAppendAttr (&cmd, ISNS_DD_ID, 0, NULL, 0); break; } Index: iscsi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/iscsi.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iscsi.c 14 Aug 2007 03:43:55 -0000 1.10 --- iscsi.c 23 Aug 2007 02:50:20 -0000 1.11 *************** *** 305,308 **** --- 305,311 ---- } } + else + ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, 0, NULL, 0); + /* Delimiter */ |
From: Robert W. <wrw...@us...> - 2007-08-14 03:44:01
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10440/src Modified Files: comm.c entity.c fcnode.c ifcp.c iscsi.c isns.c portal.c Log Message: add support for DNS Index: portal.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/portal.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** portal.c 12 Jan 2007 21:13:01 -0000 1.9 --- portal.c 14 Aug 2007 03:43:55 -0000 1.10 *************** *** 165,169 **** GetPortals (void) { ! char buffer[2048]; char cmdLine[256]; int c_size; --- 165,169 ---- GetPortals (void) { ! char buffer[MAX_PAYLOAD_SIZE]; char cmdLine[256]; int c_size; Index: fcnode.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/fcnode.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fcnode.c 28 Nov 2006 22:00:47 -0000 1.3 --- fcnode.c 14 Aug 2007 03:43:55 -0000 1.4 *************** *** 79,83 **** { int len; ! char buffer[256]; ISNS_CMD cmd; --- 79,83 ---- { int len; ! char buffer[MAX_PAYLOAD_SIZE]; ISNS_CMD cmd; *************** *** 126,130 **** ParseFCNodeQuery (char *buffer) { ! char buffer2[256]; ISNS_Attr *p_attr; ISNS_HDR *pdu; --- 126,130 ---- ParseFCNodeQuery (char *buffer) { ! char buffer2[MAX_PAYLOAD_SIZE]; ISNS_Attr *p_attr; ISNS_HDR *pdu; *************** *** 216,220 **** GetFCNode (void) { ! char buffer[2048]; ISNS_CMD cmd; --- 216,220 ---- GetFCNode (void) { ! char buffer[MAX_PAYLOAD_SIZE]; ISNS_CMD cmd; Index: iscsi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/iscsi.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iscsi.c 30 Mar 2007 22:55:22 -0000 1.9 --- iscsi.c 14 Aug 2007 03:43:55 -0000 1.10 *************** *** 205,209 **** GetISCSI (void) { ! char buffer[2048]; char cmdLine[256]; int c_size; --- 205,209 ---- GetISCSI (void) { ! char buffer[MAX_PAYLOAD_SIZE]; char cmdLine[256]; int c_size; Index: isns.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/isns.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** isns.c 13 Aug 2007 22:56:44 -0000 1.10 --- isns.c 14 Aug 2007 03:43:55 -0000 1.11 *************** *** 310,314 **** pdu = (struct isns_hdr *)buffer; ptr = buffer + sizeof (ISNS_HDR) + 4; ! printf("pdu->len:%d\n",pdu->len); while (ptr < (buffer + sizeof (ISNS_HDR) + pdu->len) ) --- 310,315 ---- pdu = (struct isns_hdr *)buffer; ptr = buffer + sizeof (ISNS_HDR) + 4; ! if (pdu->len > MAX_PAYLOAD_SIZE) ! printf("ERROR pdu->len:%d\n",pdu->len); while (ptr < (buffer + sizeof (ISNS_HDR) + pdu->len) ) *************** *** 630,634 **** { static int sym_integer=0; ! char buffer[256]; char cmdLine[256]; int id; --- 631,635 ---- { static int sym_integer=0; ! char buffer[MAX_PAYLOAD_SIZE]; char cmdLine[256]; int id; *************** *** 1040,1044 **** Send_ESI_Response (ISNS_CMD * p_cmd, int size) { ! char rbuffer[1024]; ISNS_CMD *p_rcmd; --- 1041,1045 ---- Send_ESI_Response (ISNS_CMD * p_cmd, int size) { ! char rbuffer[MAX_PAYLOAD_SIZE]; ISNS_CMD *p_rcmd; Index: entity.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/entity.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** entity.c 19 Dec 2006 20:33:49 -0000 1.8 --- entity.c 14 Aug 2007 03:43:55 -0000 1.9 *************** *** 155,159 **** { int c_size; ! char buffer[2048]; char cmdLine[256]; ISNS_CMD cmd; --- 155,159 ---- { int c_size; ! char buffer[MAX_PAYLOAD_SIZE]; char cmdLine[256]; ISNS_CMD cmd; Index: ifcp.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/ifcp.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ifcp.c 18 Dec 2006 23:00:03 -0000 1.4 --- ifcp.c 14 Aug 2007 03:43:55 -0000 1.5 *************** *** 45,49 **** ParseIFCPQuery (char *buffer) { ! char buffer2[256]; ISNS_Attr *p_attr; ISNS_HDR *pdu; --- 45,49 ---- ParseIFCPQuery (char *buffer) { ! char buffer2[MAX_PAYLOAD_SIZE]; ISNS_Attr *p_attr; ISNS_HDR *pdu; *************** *** 477,481 **** GetIFCP (void) { ! char buffer[2048]; char cmdLine[256]; int c_size; --- 477,481 ---- GetIFCP (void) { ! char buffer[MAX_PAYLOAD_SIZE]; char cmdLine[256]; int c_size; Index: comm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/comm.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** comm.c 15 Mar 2007 22:28:30 -0000 1.8 --- comm.c 14 Aug 2007 03:43:55 -0000 1.9 *************** *** 49,52 **** --- 49,53 ---- #include <errno.h> #include <poll.h> + #include <netdb.h> MSG_CB msg_q[MSG_Q_SIZE]; /* TCP msg Q */ *************** *** 73,76 **** --- 74,78 ---- extern char p_ip[256]; char multicast_addr[20]; + struct addrinfo hints, *res; /***********************************************************************/ *************** *** 87,90 **** --- 89,93 ---- int timeout = 5; // # seconds struct pollfd fds; + char port[16]; #ifndef SNS_LINUX *************** *** 107,110 **** --- 110,124 ---- } + memset(&hints,0,sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + sprintf(port,"%i",isns_port); + rc = getaddrinfo(p_ip,port,&hints,&res); + if (rc != 0) + { + printf("Failed to resolve host:%i %s\n",rc,strerror(errno)); + return rc; + } + if (tcpFlag) { *************** *** 120,130 **** fcntl (fd, F_SETFL, flags | O_NONBLOCK); - /* Setup Variables, Addresses, Etc. */ - their_addr.sin_family = AF_INET; /* host byte order */ - their_addr.sin_port = htons ((short) isns_port); /* short, network byte order */ - their_addr.sin_addr.s_addr = inet_addr (p_ip); - printf ("Connecting to %s...\n", p_ip); ! rc = connect (fd, (struct sockaddr *) &their_addr, sizeof (their_addr)); if (rc < 0) { --- 134,139 ---- fcntl (fd, F_SETFL, flags | O_NONBLOCK); printf ("Connecting to %s...\n", p_ip); ! rc = connect (fd, res->ai_addr, res->ai_addrlen); if (rc < 0) { *************** *** 185,195 **** } ! /* setup for the bind */ ! my_addr.sin_family = AF_INET; ! my_addr.sin_port = htons ((short) 0); ! my_addr.sin_addr.s_addr = INADDR_ANY; ! ! /* Do a Bind */ ! rc = bind (fd, (struct sockaddr *) &my_addr, sizeof (my_addr)); if (rc < 0) { --- 194,198 ---- } ! rc = connect (fd, res->ai_addr, res->ai_addrlen); if (rc < 0) { *************** *** 198,211 **** } - /* Setup Variables, Addresses, Etc. */ - their_addr.sin_family = AF_INET; /* host byte order */ - their_addr.sin_port = htons ((short) isns_port); /* short, network byte order */ - their_addr.sin_addr.s_addr = inet_addr (p_ip); - /* setup socket to nonblocking so we can do a timeout on the connect call */ flags = fcntl(fd, F_GETFL,0); fcntl (fd, F_SETFL, flags | O_NONBLOCK); } ! return (0); } --- 201,209 ---- } /* setup socket to nonblocking so we can do a timeout on the connect call */ flags = fcntl(fd, F_GETFL,0); fcntl (fd, F_SETFL, flags | O_NONBLOCK); } ! //freeaddrinfo(res); return (0); } *************** *** 286,290 **** /* Using UDP */ len = sizeof (their_addr); ! e = recvfrom (fd, (char *)cmd, size, 0, (struct sockaddr *) &their_addr,&len); if (e < 0) --- 284,288 ---- /* Using UDP */ len = sizeof (their_addr); ! e = recvfrom (fd, (char *)cmd, size, 0, res->ai_addr, &res->ai_addrlen); if (e < 0) *************** *** 323,329 **** else { ! e = sendto (fd, (char *) cmd, len, 0, ! (struct sockaddr *) &their_addr, sizeof (their_addr)); ! if (e < 0) { --- 321,325 ---- else { ! e = sendto (fd, (char *) cmd, len, 0, res->ai_addr, res->ai_addrlen); if (e < 0) { *************** *** 349,353 **** } - return (e); } --- 345,348 ---- *************** *** 360,364 **** { int e; ! char buffer[1500]; int len = cmd->hdr.len + sizeof (ISNS_HDR); int errorCode; --- 355,359 ---- { int e; ! char buffer[MAX_PAYLOAD_SIZE]; int len = cmd->hdr.len + sizeof (ISNS_HDR); int errorCode; *************** *** 787,791 **** { int e; ! char buffer[2048]; ISNS_CMD *p_cmd; int msg_size; --- 782,786 ---- { int e; ! char buffer[MAX_PAYLOAD_SIZE]; ISNS_CMD *p_cmd; int msg_size; |
From: Robert W. <wrw...@us...> - 2007-08-13 23:07:37
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26510/isnsclient/include Modified Files: iSNSdefs.h isns.h Log Message: add attribute copy checking Index: isns.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/include/isns.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** isns.h 2 Jan 2007 20:15:24 -0000 1.4 --- isns.h 13 Aug 2007 22:56:44 -0000 1.5 *************** *** 87,91 **** #define DEFAULT_IP_ADDR "127.0.0.1" ! #define MAX_PAYLOAD_SIZE (1024) #define MAX_VALUE_LENGTH (8) --- 87,91 ---- #define DEFAULT_IP_ADDR "127.0.0.1" ! #define MAX_PAYLOAD_SIZE (8*1024) #define MAX_VALUE_LENGTH (8) Index: iSNSdefs.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/include/iSNSdefs.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSdefs.h 18 Dec 2006 23:00:03 -0000 1.3 --- iSNSdefs.h 13 Aug 2007 22:56:44 -0000 1.4 *************** *** 180,183 **** --- 180,184 ---- ISNS_DELIMITER=0, ISNS_START_VALID_TAG=1, + ISNS_ENTITY_ID=ISNS_START_VALID_TAG, /* 1 */ ISNS_ENTITY_TYPE, *************** *** 186,191 **** ISNS_PROT_VER, ISNS_ENTITY_PERIOD, /* REGISTRATION PERIOD */ ! ISNS_ENTITY_SCN_BITMAP, ! ISNS_ENTITY_IDX=14, ISNS_ENTITY_CERT, --- 187,193 ---- ISNS_PROT_VER, ISNS_ENTITY_PERIOD, /* REGISTRATION PERIOD */ ! ISNS_ENTITY_IDX, ! ISNS_ENTITY_NEXT_IDX, ! ISNS_ENTITY_ISAKMP=11, ISNS_ENTITY_CERT, *************** *** 195,198 **** --- 197,201 ---- ISNS_ESI_INTERVAL, ISNS_ESI_PORT, + ISNS_PORTAL_GROUP, /* tag was removed from RFC spec */ ISNS_PORTAL_IDX=22, ISNS_SCN_PORT=23, |
From: Robert W. <wrw...@us...> - 2007-08-13 23:07:35
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26510/isnsserver/include Modified Files: iSNSdebug.h iSNSdefs.h iSNStypes.h Log Message: add attribute copy checking Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** iSNStypes.h 31 May 2007 21:16:36 -0000 1.15 --- iSNStypes.h 13 Aug 2007 22:56:44 -0000 1.16 *************** *** 559,563 **** SOIP_DB_Portal portal_ip_port; uint32_t portal_idx; ! } PORTAL_LIST_ENTRY; typedef struct soip_portal_group { --- 559,563 ---- SOIP_DB_Portal portal_ip_port; uint32_t portal_idx; ! } PORTAL_LIST_ENTRY, SOIP_Portal_List_Key; typedef struct soip_portal_group { *************** *** 669,672 **** --- 669,673 ---- SOIP_Portal_Key portal; SOIP_DD_Member_Key ddmember; + SOIP_Portal_List_Key portalmember; } key; } SOIP_DB_List; Index: iSNSdefs.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdefs.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSdefs.h 31 May 2007 21:16:36 -0000 1.9 --- iSNSdefs.h 13 Aug 2007 22:56:44 -0000 1.10 *************** *** 180,183 **** --- 180,184 ---- ISNS_DELIMITER=0, ISNS_START_VALID_TAG=1, + ISNS_ENTITY_ID=ISNS_START_VALID_TAG, /* 1 */ ISNS_ENTITY_TYPE, *************** *** 186,191 **** ISNS_PROT_VER, ISNS_ENTITY_PERIOD, /* REGISTRATION PERIOD */ ! ISNS_ENTITY_SCN_BITMAP, ! ISNS_ENTITY_IDX=14, ISNS_ENTITY_CERT, --- 187,193 ---- ISNS_PROT_VER, ISNS_ENTITY_PERIOD, /* REGISTRATION PERIOD */ ! ISNS_ENTITY_IDX, ! ISNS_ENTITY_NEXT_IDX, ! ISNS_ENTITY_ISAKMP=11, ISNS_ENTITY_CERT, Index: iSNSdebug.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdebug.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSdebug.h 7 Aug 2007 14:41:47 -0000 1.3 --- iSNSdebug.h 13 Aug 2007 22:56:44 -0000 1.4 *************** *** 140,142 **** --- 140,146 ---- void isns_log(int level, char *format, ...); + #define __ISNS_COPY(a,b,c,d) if (b<d) __LOG_WARNING("dst:%i < src:%i",b,d); isns_copy(a,b,c,d) + + int isns_copy (void *dst, int dst_size, void *src, int src_size); + #endif |
From: Robert W. <wrw...@us...> - 2007-08-13 22:56:54
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26510/isnsserver/src Modified Files: iSNSLinux.c iSNSList.c iSNSUtil.c iSNSdb.c iSNSdereg.c iSNSparse.c iSNSquery.c iSNSreg.c iSNSresponse.c iSNStbl.c Log Message: add attribute copy checking Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** iSNSUtil.c 7 Aug 2007 14:41:47 -0000 1.17 --- iSNSUtil.c 13 Aug 2007 22:56:44 -0000 1.18 *************** *** 228,232 **** /* Assumes a IPv4 Address */ ! memcpy((char *)&i_addr.s_addr, (char *)ip_addr->v+12, IP_ADDR_SIZE_V4); inet_ntoa_b (i_addr, ip_saddr); --- 228,232 ---- /* Assumes a IPv4 Address */ ! __ISNS_COPY (&i_addr.s_addr, sizeof(i_addr.s_addr), ip_addr->v+12, IP_ADDR_SIZE_V4); inet_ntoa_b (i_addr, ip_saddr); *************** *** 863,867 **** case ISNS_PROT_VER : return("Protocol Version Range"); case ISNS_ENTITY_PERIOD : return("Entity Period"); - case ISNS_ENTITY_SCN_BITMAP : return("Entity SCN Bitmap"); case ISNS_ENTITY_CERT : return("Entity Certificate"); case ISNS_PORTAL_IP : return("Portal IP-Address"); --- 863,866 ---- *************** *** 1088,1092 **** ntohl(p_attr->val.index)?"Enabled":"Disabled"); break; - case ISNS_ENTITY_SCN_BITMAP : case ISNS_ENTITY_CERT : case ISNS_PORTAL_CERT : --- 1087,1090 ---- *************** *** 1195,1196 **** --- 1193,1225 ---- } + /********************************************************************* + * isns_copy -- copy attribute with length checking on dst and src + **********************************************************************/ + int + isns_copy(void *dst, int dst_size, void *src, int src_size) + { + int cp_size = src_size; + int rc = SUCCESS; + + if (dst == NULL) + { + __LOG_ERROR ("destination ptr is NULL"); + return ERROR; + } + if (src == NULL) + { + __LOG_ERROR ("source ptr is NULL"); + return ERROR; + } + + if ( dst_size < src_size ) + { + __LOG_ERROR ("destination size:%i is smaller than source:%i - setting dst_size=src_size",dst_size,src_size); + cp_size = dst_size; + rc = ERROR; + } + memset (dst,0,dst_size); + memcpy (dst,src,cp_size); + + return rc; + } Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** iSNSquery.c 7 Aug 2007 14:41:47 -0000 1.23 --- iSNSquery.c 13 Aug 2007 22:56:45 -0000 1.24 *************** *** 292,304 **** while (entityKeyFlag != -1) { - SOIP_Entity_Id db_entity_id; - /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); - memset(db_entity_id.id,0,sizeof(SOIP_Entity_Id)); - memcpy(db_entity_id.id,&key->val,key->len); - - /* Fetch entity from hash */ if (ISNS_NO_ERR != SNSdbFetchEntity (db_entity_id.id, &p_entity, &entry)) { --- 292,300 ---- while (entityKeyFlag != -1) { /* Entity ID found in key */ + SOIP_Entity_Id db_entity_id; key = (ISNS_Key *)(key_indx[entityKeyFlag]); + __ISNS_COPY (db_entity_id.id, sizeof(db_entity_id.id), &key->val, key->len); if (ISNS_NO_ERR != SNSdbFetchEntity (db_entity_id.id, &p_entity, &entry)) { *************** *** 366,371 **** attr = (ISNS_Attr *) key_indx[portalPortKeyFlag]; ! memcpy ((char *) db_portal.ip_addr.v, &attr->val, ! attr->len); attr = (ISNS_Attr *) key_indx[portalIpKeyFlag]; --- 362,366 ---- attr = (ISNS_Attr *) key_indx[portalPortKeyFlag]; ! __ISNS_COPY (db_portal.ip_addr.v, sizeof(db_portal.ip_addr.v), &attr->val, attr->len); attr = (ISNS_Attr *) key_indx[portalIpKeyFlag]; *************** *** 373,377 **** read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 368,372 ---- read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_portal, sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 457,461 **** key = (ISNS_Key *)(key_indx[iSCSINodeKeyFlag]); memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, (char *) &key->val, key->len); } --- 452,456 ---- key = (ISNS_Key *)(key_indx[iSCSINodeKeyFlag]); memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); } *************** *** 896,900 **** /* Fetch the node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, (char *) p_node_name, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; --- 891,895 ---- /* Fetch the node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), p_node_name, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; *************** *** 915,919 **** memset (&db_port_name, 0, sizeof (db_port_name)); key = (ISNS_Key *)(key_indx[ii]); ! memcpy (db_port_name.v, &key->val, key->len); ISNS_DBKey read_key; --- 910,914 ---- memset (&db_port_name, 0, sizeof (db_port_name)); key = (ISNS_Key *)(key_indx[ii]); ! __ISNS_COPY (db_port_name.v, sizeof(db_port_name.v), &key->val, key->len); ISNS_DBKey read_key; *************** *** 934,939 **** /* Fetch the Node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, ! (char *) p_port->node_name.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; --- 929,933 ---- /* Fetch the Node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), p_port->node_name.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; *************** *** 962,967 **** /* Fetch the node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, ! (char *) key.val.node_key.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; --- 956,960 ---- /* Fetch the node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), key.val.node_key.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; *************** *** 1061,1070 **** attr = (ISNS_Attr *) key_indx[portalIpKeyFlag]; ! memcpy ((char *) db_portal.ip_addr.v, &attr->val, ! attr->len); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1054,1062 ---- attr = (ISNS_Attr *) key_indx[portalIpKeyFlag]; ! __ISNS_COPY (db_portal.ip_addr.v, sizeof(db_portal.ip_addr.v), &attr->val, attr->len); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY(&read_key.val, sizeof(read_key.val), &db_portal, sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1101,1109 **** } ! memcpy ((char *) &db_portal, ptr, sizeof(db_portal)); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1093,1101 ---- } ! __ISNS_COPY (&db_portal, sizeof(db_portal), ptr, sizeof(db_portal)); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_portal, sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1133,1137 **** ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1125,1129 ---- ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1154,1158 **** ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! memcpy(&read_key.val,&key->val.port_name,PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) --- 1146,1150 ---- ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &key->val.port_name, PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) *************** *** 1174,1178 **** ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1166,1170 ---- ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1198,1202 **** key = (ISNS_Key *)(key_indx[iSCSINodeIdKeyFlag]); memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, (char *) &key->val, key->len); ISNS_DBKey read_key; --- 1190,1194 ---- key = (ISNS_Key *)(key_indx[iSCSINodeIdKeyFlag]); memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ISNS_DBKey read_key; *************** *** 1229,1233 **** ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1221,1225 ---- ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1252,1256 **** ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&key2.val,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1244,1248 ---- ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &key2.val, sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1348,1352 **** ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! memcpy(&read_key.val,&key->val.port_name,PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) --- 1340,1344 ---- ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &key->val.port_name, PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) *************** *** 1374,1378 **** key = (ISNS_Key *)(key_indx[nodeKeyFlag]); memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, (char *) &key->val, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; --- 1366,1370 ---- key = (ISNS_Key *)(key_indx[nodeKeyFlag]); memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; *************** *** 1380,1384 **** ISNS_DBKey read_key; read_key.tag = NODE_NAME_KEY; ! memcpy(&read_key.val,&db_node_name.v,ISNS_NODE_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) --- 1372,1376 ---- ISNS_DBKey read_key; read_key.tag = NODE_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_node_name.v, ISNS_NODE_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) *************** *** 1394,1398 **** ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! memcpy(&read_key.val,pname,PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry2); if ( rval != SUCCESS) --- 1386,1390 ---- ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), pname, PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry2); if ( rval != SUCCESS) *************** *** 1432,1436 **** ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1424,1428 ---- ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1458,1463 **** attr = (ISNS_Attr *) key_indx[portalPortKeyFlag]; ! memcpy ((char *) db_portal.ip_addr.v, &attr->val, ! attr->len); attr = (ISNS_Attr *) key_indx[portalIpKeyFlag]; --- 1450,1454 ---- attr = (ISNS_Attr *) key_indx[portalPortKeyFlag]; ! __ISNS_COPY (db_portal.ip_addr.v, sizeof(db_portal.ip_addr.v), &attr->val, attr->len); attr = (ISNS_Attr *) key_indx[portalIpKeyFlag]; *************** *** 1466,1470 **** ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1457,1461 ---- ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_portal, sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1490,1494 **** ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1481,1485 ---- ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1617,1621 **** /* Fetch the node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, (char *) &key->val, key->len); ISNS_DBKey read_key; --- 1608,1612 ---- /* Fetch the node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ISNS_DBKey read_key; *************** *** 1747,1755 **** key = (ISNS_Key *) key_indx[portalIpKeyIndex]; ! memcpy (db_portal.ip_addr.v, key->val.ip_addr.v, key->len); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) --- 1738,1746 ---- key = (ISNS_Key *) key_indx[portalIpKeyIndex]; ! __ISNS_COPY (db_portal.ip_addr.v, sizeof(db_portal.ip_addr.v), key->val.ip_addr.v, key->len); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_portal, sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) *************** *** 2025,2029 **** { qkey.len = strlen((char *)&key->val); ! memcpy(&qkey.val, &key->val, key->len); } } --- 2016,2020 ---- { qkey.len = strlen((char *)&key->val); ! __ISNS_COPY (&qkey.val, sizeof(qkey.val), &key->val, key->len); } } *************** *** 2050,2054 **** } qkey.len = strlen(ptr); ! memcpy(&qkey.val, ptr, qkey.len); } } --- 2041,2045 ---- } qkey.len = strlen(ptr); ! __ISNS_COPY (&qkey.val, sizeof (qkey.val), ptr, qkey.len); } } *************** *** 2169,2173 **** qkey.tag = PORT_NAME_KEY; qkey.len = key->len; ! memcpy(&qkey.val, &key->val, key->len); found=FALSE; --- 2160,2164 ---- qkey.tag = PORT_NAME_KEY; qkey.len = key->len; ! __ISNS_COPY (&qkey.val, sizeof(qkey.val), &key->val, key->len); found=FALSE; *************** *** 2236,2240 **** return (ISNS_NO_SUCH_ENTRY_ERR); } ! memcpy (&qkey.val, ptr, sizeof(db_portal)); qkey.len = sizeof(SOIP_Portal_Key); } --- 2227,2231 ---- return (ISNS_NO_SUCH_ENTRY_ERR); } ! __ISNS_COPY (&qkey.val, sizeof(qkey.val), ptr, sizeof(db_portal)); qkey.len = sizeof(SOIP_Portal_Key); } *************** *** 2247,2254 **** key = (ISNS_Key *)(key_indx[portalIpKeyIndex]); ! memcpy (db_portal.ip_addr.v, key->val.ip_addr.v, key->len); qkey.len += key->len; ! memcpy(&qkey.val, (char *)&db_portal, sizeof (SOIP_Portal_Key)); } --- 2238,2245 ---- key = (ISNS_Key *)(key_indx[portalIpKeyIndex]); ! __ISNS_COPY (db_portal.ip_addr.v, sizeof(db_portal.ip_addr.v), key->val.ip_addr.v, key->len); qkey.len += key->len; ! __ISNS_COPY (&qkey.val, sizeof(qkey.val), &db_portal, sizeof (SOIP_Portal_Key)); } *************** *** 2871,2875 **** ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry5); if (rval != SUCCESS ) --- 2862,2866 ---- ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry5); if (rval != SUCCESS ) *************** *** 2884,2893 **** memset(&key_portal_group, 0, sizeof(SOIP_Portal_Group_Key)); key_portal_group.ip_port = p_portal->ip_port; ! memcpy(key_portal_group.ip_addr.v,p_portal->ip_addr.v,ISNS_PORTAL_IP_SIZE); ! memcpy(key_portal_group.id.v,p_node->id.v,strlen(p_node->id.v)); ISNS_DBKey read_group_key; read_group_key.tag = PORTAL_GROUP_ID_KEY; ! memcpy(&read_group_key.val,&key_portal_group,sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbRead(&read_group_key,&entry4); if (rval != SUCCESS ) --- 2875,2884 ---- memset(&key_portal_group, 0, sizeof(SOIP_Portal_Group_Key)); key_portal_group.ip_port = p_portal->ip_port; ! __ISNS_COPY (key_portal_group.ip_addr.v, sizeof(key_portal_group.ip_addr.v), p_portal->ip_addr.v,ISNS_PORTAL_IP_SIZE); ! __ISNS_COPY (key_portal_group.id.v, sizeof(key_portal_group.id.v), p_node->id.v,strlen(p_node->id.v)); ISNS_DBKey read_group_key; read_group_key.tag = PORTAL_GROUP_ID_KEY; ! __ISNS_COPY (&read_group_key.val, sizeof(read_group_key.val), &key_portal_group, sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbRead(&read_group_key,&entry4); if (rval != SUCCESS ) Index: iSNSList.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSList.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** iSNSList.c 7 Aug 2007 14:41:47 -0000 1.13 --- iSNSList.c 13 Aug 2007 22:56:44 -0000 1.14 *************** *** 280,284 **** { p_portal = plist->p_entry; ! memcpy(&key.val.list.key.portal.ip_addr,&p_portal->ip_addr,sizeof(IP_Address)); key.val.list.key.portal.ip_port = p_portal->ip_port; } --- 280,284 ---- { p_portal = plist->p_entry; ! __ISNS_COPY (&key.val.list.key.portal.ip_addr, sizeof(key.val.list.key.portal.ip_addr), &p_portal->ip_addr, sizeof(IP_Address)); key.val.list.key.portal.ip_port = p_portal->ip_port; } *************** *** 401,405 **** p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! memcpy(entry.data.list.key.node_name.v,pdata,data_size); } else if (plist->list_id == ENTITY_FCP_LIST) --- 401,405 ---- p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! __ISNS_COPY (entry.data.list.key.node_name.v, sizeof(entry.data.list.key.node_name.v), pdata, data_size); } else if (plist->list_id == ENTITY_FCP_LIST) *************** *** 407,411 **** p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! memcpy(entry.data.list.key.node_name.v,pdata,data_size); } else if (plist->list_id == ENTITY_PORTAL_LIST) --- 407,411 ---- p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! __ISNS_COPY (entry.data.list.key.node_name.v, sizeof(entry.data.list.key.node_name.v), pdata, data_size); } else if (plist->list_id == ENTITY_PORTAL_LIST) *************** *** 413,417 **** p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! memcpy(&entry.data.list.key.portal,pdata,data_size); } else if (plist->list_id == ISCSI_DD_LIST) --- 413,417 ---- p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! __ISNS_COPY (&entry.data.list.key.portalmember, sizeof(entry.data.list.key.portalmember), pdata, data_size); } else if (plist->list_id == ISCSI_DD_LIST) *************** *** 419,423 **** p_iscsi = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_iscsi->id.v); ! memcpy(&entry.data.list.key.dd,pdata,data_size); } else if (plist->list_id == DDS_DD_LIST) --- 419,423 ---- p_iscsi = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_iscsi->id.v); ! __ISNS_COPY (&entry.data.list.key.dd, sizeof(entry.data.list.key.dd), pdata, data_size); } else if (plist->list_id == DDS_DD_LIST) *************** *** 425,429 **** p_dds = plist->p_entry; key.val.list.key.dds.id = p_dds->id; ! memcpy(&entry.data.list.key.dd,pdata,data_size); } else if (plist->list_id == DD_DDS_LIST) --- 425,429 ---- p_dds = plist->p_entry; key.val.list.key.dds.id = p_dds->id; ! __ISNS_COPY (&entry.data.list.key.dd, sizeof(entry.data.list.key.dd), pdata, data_size); } else if (plist->list_id == DD_DDS_LIST) *************** *** 431,435 **** p_dd = plist->p_entry; key.val.list.key.dd.id = p_dd->id; ! memcpy(&entry.data.list.key.dds,pdata,data_size); } else if (plist->list_id == DD_MEMBER_LIST) --- 431,435 ---- p_dd = plist->p_entry; key.val.list.key.dd.id = p_dd->id; ! __ISNS_COPY (&entry.data.list.key.dds, sizeof(entry.data.list.key.dds), pdata, data_size); } else if (plist->list_id == DD_MEMBER_LIST) *************** *** 437,441 **** p_dd = plist->p_entry; key.val.list.key.dd.id = p_dd->id; ! memcpy(&entry.data.list.key.dds,pdata,data_size); } else if (plist->list_id == FCP_PORTAL_LIST) --- 437,441 ---- p_dd = plist->p_entry; key.val.list.key.dd.id = p_dd->id; ! __ISNS_COPY (&entry.data.list.key.ddmember, sizeof(entry.data.list.key.ddmember), pdata, data_size); } else if (plist->list_id == FCP_PORTAL_LIST) *************** *** 443,447 **** p_ifcp = plist->p_entry; strcpy (key.val.list.key.node_name.v,p_ifcp->node_name.v); ! memcpy(&entry.data.list.key.portal,pdata,data_size); } else if (plist->list_id == FCP_DD_LIST) --- 443,447 ---- p_ifcp = plist->p_entry; strcpy (key.val.list.key.node_name.v,p_ifcp->node_name.v); ! __ISNS_COPY (&entry.data.list.key.portal, sizeof(entry.data.list.key.portal), pdata, data_size); } else if (plist->list_id == FCP_DD_LIST) *************** *** 449,470 **** p_ifcp = plist->p_entry; strcpy (key.val.list.key.node_name.v,p_ifcp->node_name.v); ! memcpy(&entry.data.list.key.dd,pdata,data_size); } else if (plist->list_id == PORTAL_ENTITY_LIST) { p_portal = plist->p_entry; ! memcpy(&key.val.list.key.portal.ip_addr,&p_portal->ip_addr,sizeof(IP_Address)); key.val.list.key.portal.ip_port = p_portal->ip_port; ! memcpy(&entry.data.list.key.portal,pdata,data_size); } else if (plist->list_id == SCN_LIST) { strcpy (key.val.list.key.node_name.v,"scn_list"); ! memcpy(&entry.data.list.key.node_name.v,pdata,data_size); } else if (plist->list_id == SCN_CALLBACK_LIST) { strcpy (key.val.list.key.node_name.v,"scn_callback_list"); ! memcpy(&entry.data.list.key.node_name.v,pdata,data_size); } --- 449,470 ---- p_ifcp = plist->p_entry; strcpy (key.val.list.key.node_name.v,p_ifcp->node_name.v); ! __ISNS_COPY (&entry.data.list.key.dd, sizeof(entry.data.list.key.dd), pdata, data_size); } else if (plist->list_id == PORTAL_ENTITY_LIST) { p_portal = plist->p_entry; ! __ISNS_COPY (&key.val.list.key.portal.ip_addr, sizeof(key.val.list.key.portal.ip_addr), &p_portal->ip_addr, sizeof(IP_Address)); key.val.list.key.portal.ip_port = p_portal->ip_port; ! __ISNS_COPY (&entry.data.list.key.portal, sizeof(entry.data.list.key.portal), pdata, data_size); } else if (plist->list_id == SCN_LIST) { strcpy (key.val.list.key.node_name.v,"scn_list"); ! __ISNS_COPY (&entry.data.list.key.node_name.v, sizeof(entry.data.list.key.node_name.v), pdata, data_size); } else if (plist->list_id == SCN_CALLBACK_LIST) { strcpy (key.val.list.key.node_name.v,"scn_callback_list"); ! __ISNS_COPY (&entry.data.list.key.node_name.v, sizeof(entry.data.list.key.node_name.v), pdata,data_size); } *************** *** 582,586 **** node->data_size = strlen(entry.data.list.key.node_name.v); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,entry.data.list.key.node_name.v,node->data_size); __DEBUG (isns_list_debug &1, Successfully read list entry); } --- 582,586 ---- node->data_size = strlen(entry.data.list.key.node_name.v); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size+1, entry.data.list.key.node_name.v, node->data_size); __DEBUG (isns_list_debug &1, Successfully read list entry); } *************** *** 594,598 **** node->data_size = strlen(entry.data.list.key.node_name.v); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,entry.data.list.key.node_name.v,node->data_size); } else if (plist->list_id == ENTITY_PORTAL_LIST) --- 594,598 ---- node->data_size = strlen(entry.data.list.key.node_name.v); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size+1, entry.data.list.key.node_name.v,node->data_size); } else if (plist->list_id == ENTITY_PORTAL_LIST) *************** *** 605,609 **** node->data_size = sizeof(entry.data.list.key.portal); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.portal,node->data_size); } else if (plist->list_id == ISCSI_DD_LIST) --- 605,609 ---- node->data_size = sizeof(entry.data.list.key.portal); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size +1, &entry.data.list.key.portal,node->data_size); } else if (plist->list_id == ISCSI_DD_LIST) *************** *** 616,620 **** node->data_size = sizeof(entry.data.list.key.dd); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.dd,node->data_size); } else if (plist->list_id == DDS_DD_LIST) --- 616,620 ---- node->data_size = sizeof(entry.data.list.key.dd); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size + 1, &entry.data.list.key.dd,node->data_size); } else if (plist->list_id == DDS_DD_LIST) *************** *** 627,631 **** node->data_size = sizeof(entry.data.list.key.dd); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.dd,node->data_size); } else if (plist->list_id == DD_DDS_LIST) --- 627,631 ---- node->data_size = sizeof(entry.data.list.key.dd); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size + 1, &entry.data.list.key.dd,node->data_size); } else if (plist->list_id == DD_DDS_LIST) *************** *** 638,642 **** node->data_size = sizeof(entry.data.list.key.dds); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.dds,node->data_size); } else if (plist->list_id == DD_MEMBER_LIST) --- 638,642 ---- node->data_size = sizeof(entry.data.list.key.dds); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size+1, &entry.data.list.key.dds,node->data_size); } else if (plist->list_id == DD_MEMBER_LIST) *************** *** 649,653 **** node->data_size = sizeof(entry.data.list.key.ddmember); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.dd,node->data_size); } else if (plist->list_id == FCP_PORTAL_LIST) --- 649,653 ---- node->data_size = sizeof(entry.data.list.key.ddmember); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size+1, &entry.data.list.key.ddmember,node->data_size); } else if (plist->list_id == FCP_PORTAL_LIST) *************** *** 660,664 **** node->data_size = sizeof(entry.data.list.key.portal); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.portal,node->data_size); } else if (plist->list_id == FCP_DD_LIST) --- 660,664 ---- node->data_size = sizeof(entry.data.list.key.portal); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size+1, &entry.data.list.key.portal,node->data_size); } else if (plist->list_id == FCP_DD_LIST) *************** *** 671,680 **** node->data_size = sizeof(entry.data.list.key.dd); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.dd,node->data_size); } else if (plist->list_id == PORTAL_ENTITY_LIST) { p_portal = plist->p_entry; ! memcpy(&key.val.list.key.portal.ip_addr,&p_portal->ip_addr,sizeof(IP_Address)); key.val.list.key.portal.ip_port = p_portal->ip_port; rval = ISNSdbRead(&key,&entry); --- 671,680 ---- node->data_size = sizeof(entry.data.list.key.dd); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size + 1, &entry.data.list.key.dd,node->data_size); } else if (plist->list_id == PORTAL_ENTITY_LIST) { p_portal = plist->p_entry; ! __ISNS_COPY (&key.val.list.key.portal.ip_addr, sizeof(key.val.list.key.portal.ip_addr), &p_portal->ip_addr,sizeof(IP_Address)); key.val.list.key.portal.ip_port = p_portal->ip_port; rval = ISNSdbRead(&key,&entry); *************** *** 683,687 **** node->data_size = sizeof(entry.data.list.key.portal); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.portal,node->data_size); } else if (plist->list_id == SCN_LIST) --- 683,687 ---- node->data_size = sizeof(entry.data.list.key.portal); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size+1, &entry.data.list.key.portal,node->data_size); } else if (plist->list_id == SCN_LIST) *************** *** 694,698 **** node->data_size = sizeof(SOIP_Scn_Entry); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.entity_id.id,node->data_size); } else if (plist->list_id == SCN_CALLBACK_LIST) --- 694,698 ---- node->data_size = sizeof(SOIP_Scn_Entry); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size+1, &entry.data.list.key.entity_id.id,node->data_size); } else if (plist->list_id == SCN_CALLBACK_LIST) *************** *** 705,709 **** node->data_size = sizeof(SOIP_Scn_Callback_Entry); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! memcpy(node->data,&entry.data.list.key.entity_id.id,node->data_size); } --- 705,709 ---- node->data_size = sizeof(SOIP_Scn_Callback_Entry); node->data = (char *)ISNSAllocBuffer(node->data_size+1); ! __ISNS_COPY (node->data, node->data_size+1, &entry.data.list.key.entity_id.id,node->data_size); } Index: iSNSresponse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSresponse.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iSNSresponse.c 15 Dec 2006 01:13:29 -0000 1.6 --- iSNSresponse.c 13 Aug 2007 22:56:45 -0000 1.7 *************** *** 38,41 **** --- 38,42 ---- #include "iSNStypes.h" #include "iSNSmsg.h" + #include "iSNSdebug.h" /********************************************************************* *************** *** 50,54 **** --- 51,58 ---- if (msg == NULL) + { + __LOG_ERROR ("Message is NULL"); return (ERROR); + } /* add room for error code */ *************** *** 68,72 **** if (p_value) { ! memcpy (&attr->val, p_value, attr->len); } else if (attr->len == 8) --- 72,76 ---- if (p_value) { ! __ISNS_COPY (&attr->val, sizeof(attr->val), p_value, attr->len); } else if (attr->len == 8) *************** *** 137,141 **** if (p_value) { ! memcpy (&attr->val, p_value, attr->len); } else if (attr->len == 8) --- 141,145 ---- if (p_value) { ! __ISNS_COPY (&attr->val, sizeof(attr->val), p_value, attr->len); } else if (attr->len == 8) *************** *** 216,220 **** if (p_value) { ! memcpy (&attr->val, p_value, attr->len); } else --- 220,224 ---- if (p_value) { ! __ISNS_COPY (&attr->val, sizeof(attr->val), p_value, attr->len); } else Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** iSNSparse.c 7 Aug 2007 14:41:47 -0000 1.20 --- iSNSparse.c 13 Aug 2007 22:56:45 -0000 1.21 *************** *** 100,103 **** --- 100,105 ---- parse_status = ISNSProfileKeysAttr (msg, attr_index, &num_attrs, key_index, &num_keys, (ISNS_Attr **)src_attr); + if(parse_status) + __LOG_ERROR ("ISNSParseMSG error for msg->hdr.type=0x%x\n",msg->hdr.type); break; default: *************** *** 106,113 **** parse_status = ERROR; break; } - if(parse_status) - __LOG_ERROR ("ISNSParseMSG error for msg->hdr.type=%d\n",msg->hdr.type); return parse_status; --- 108,114 ---- parse_status = ERROR; + __LOG_ERROR ("ISNSParseMSG error for msg->hdr.type=0x%x\n",msg->hdr.type); break; } return parse_status; *************** *** 132,137 **** case ISNS_DELIMITER: if (len != ISNS_DELIMITER_SIZE) rval = FALSE; ! __DEBUG (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; /* Variable Length */ --- 133,141 ---- case ISNS_DELIMITER: if (len != ISNS_DELIMITER_SIZE) + { rval = FALSE; ! __LOG_WARNING ("%sTag:%i (%s) len=%i",src,tag,isnsTagText(tag),len); ! } ! __DEBUG (isns_parse_debug &1,%sTag:%i (%s) len=%i,src,tag,isnsTagText(tag),len); break; /* Variable Length */ *************** *** 156,160 **** --- 160,168 ---- case ISNS_PORTAL_GROUP_IP: if (len != ISNS_IP_SIZE && len != 0) + { rval = FALSE; + __LOG_WARNING ("%sTag:%i (%s) %s",src,tag,isnsTagText(tag), + inet_ntoa(*(struct in_addr *)(ptr+12)) ); + } __DEBUG (isns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag), inet_ntoa(*(struct in_addr *)(ptr+12)) ); *************** *** 162,166 **** --- 170,177 ---- case ISNS_TIMESTAMP: if (len != ISNS_TIMESTAMP_SIZE && len != 0 ) + { rval = FALSE; + __LOG_WARNING ("%sTag:%i (%s)",src,tag,isnsTagText(tag)); + } __DEBUG (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; *************** *** 169,173 **** case ISNS_PROT_VER: case ISNS_ENTITY_PERIOD: - case ISNS_ENTITY_SCN_BITMAP: case ISNS_ENTITY_IDX: case ISNS_ENTITY_CERT: --- 180,183 ---- *************** *** 195,199 **** --- 205,215 ---- case ISNS_PORTAL_GROUP_PORT: if (len != 4 && len != 0) + { rval = FALSE; + if (len == 0) + __LOG_WARNING ("%sTag:%i (%s)",src,tag,isnsTagText(tag)); + else + __LOG_WARNING ("%sTag:%i (%s) %i",src,tag,isnsTagText(tag),*(uint32_t *)ptr); + } if (len == 0) __DEBUG (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); *************** *** 207,211 **** --- 223,233 ---- case ISNS_DD_IFCP_MEMBER: if (len != 8 && len != 0) + { rval = FALSE; + if (len == 0) + __LOG_WARNING ("%sTag:%i (%s)",src,tag,isnsTagText(tag)); + else + __LOG_WARNING ("%sTag:%i (%s) %s",src,tag,isnsTagText(tag),(char *)ptr); + } if (len == 0) __DEBUG (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); *************** *** 244,248 **** if (!rval) ! __DEBUG (isns_parse_debug &1,(VerifyTag rval)); return (rval); --- 266,270 ---- if (!rval) ! __LOG_WARNING ("VerifyTag rc:%i",rval); return (rval); *************** *** 273,278 **** /* Store Keys */ ! offset = 0; ! ptr = attr = (ISNS_Attr *)(&msg->payload); if (src_attr != NULL) --- 295,306 ---- /* Store Keys */ ! if (msg->hdr.type & 0x8000) // response messages with error code ! offset = 4; ! else ! offset = 0; ! ! __DEBUG (isns_parse_debug &1,"offset:%i",offset); ! ! ptr = attr = (ISNS_Attr *)(&msg->payload+offset); if (src_attr != NULL) *************** *** 433,437 **** case ISNS_PORT_TYPE: case ISNS_DDS_STATUS: - case ISNS_ENTITY_SCN_BITMAP: case ISNS_ISCSI_SCN_BITMAP: case ISNS_IFCP_SCN_BITMAP: --- 461,464 ---- *************** *** 581,585 **** case ISNS_PORT_TYPE: case ISNS_DDS_STATUS: - case ISNS_ENTITY_SCN_BITMAP: case ISNS_ISCSI_SCN_BITMAP: case ISNS_IFCP_SCN_BITMAP: --- 608,611 ---- Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** iSNSdereg.c 7 Aug 2007 14:41:47 -0000 1.25 --- iSNSdereg.c 13 Aug 2007 22:56:45 -0000 1.26 *************** *** 597,600 **** --- 597,602 ---- iSNS_stats.num_entity--; + __DEBUG (isns_dereg_debug &1,(Prepare response for: %s),p_entity_id); + ISNSAppendKey (p_rspmsg, ISNS_ENTITY_ID, PAD4 (strlen (p_entity_id)), p_entity_id, 0); *************** *** 633,637 **** memset (buffer, 0, PORT_NAME_SIZE); ! memcpy (buffer, ifcp_node_key, PORT_NAME_SIZE); ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; --- 635,640 ---- memset (buffer, 0, PORT_NAME_SIZE); ! __ISNS_COPY (buffer, sizeof(buffer), ifcp_node_key, PORT_NAME_SIZE); ! ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; *************** *** 681,685 **** /* FC Node's IFCP Node List */ memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy (db_node_name.v, p_ifcp_node->node_name.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; ISNS_DBKey read_key; --- 684,688 ---- /* FC Node's IFCP Node List */ memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), p_ifcp_node->node_name.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; ISNS_DBKey read_key; *************** *** 746,750 **** ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) --- 749,753 ---- ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) *************** *** 780,783 **** --- 783,788 ---- } + __DEBUG (isns_dereg_debug &1,(Prepare response for: %s),buffer); + ISNSAppendKey (p_rspmsg, ISNS_PORT_NAME, ISNS_IFCP_NODE_NAME_SIZE, buffer, 0); *************** *** 849,853 **** /* Call Remove Entry */ key = (ISNS_Key *)(key_indx[portalIpIndex]); ! memcpy(db_portal.ip_addr.v, &key->val, ISNS_PORTAL_IP_SIZE); key = (ISNS_Key *)(key_indx[portalPortIndex]); --- 854,858 ---- /* Call Remove Entry */ key = (ISNS_Key *)(key_indx[portalIpIndex]); ! __ISNS_COPY (db_portal.ip_addr.v, sizeof(db_portal.ip_addr.v), &key->val, ISNS_PORTAL_IP_SIZE); key = (ISNS_Key *)(key_indx[portalPortIndex]); *************** *** 993,997 **** { key = (ISNS_Key *)(key_indx[entityKeyIndex]); ! memcpy (buffer, &key->val, key->len); rval = ISNSdbRemoveAttrEntityEntry (buffer, src_attr, rspmsg); if (rval != ISNS_NO_ERR) --- 998,1002 ---- { key = (ISNS_Key *)(key_indx[entityKeyIndex]); ! __ISNS_COPY (buffer, sizeof(buffer), &key->val, key->len); rval = ISNSdbRemoveAttrEntityEntry (buffer, src_attr, rspmsg); if (rval != ISNS_NO_ERR) *************** *** 1129,1133 **** memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, (char *) p_key, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; --- 1134,1138 ---- memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), p_key, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; *************** *** 1155,1159 **** } ! memcpy ((char *) db_node_name.v, (char *) p_key, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; --- 1160,1164 ---- } ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), p_key, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; *************** *** 1162,1165 **** --- 1167,1172 ---- ISNSdbDelete (&delete_key); + __DEBUG (isns_dereg_debug &1,(Prepare response for: %s),p_key); + ISNSAppendKey (p_rspmsg, ISNS_NODE_NAME, ISNS_NODE_NAME_SIZE, p_key, 0); return (ISNS_NO_ERR); *************** *** 1188,1192 **** read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,portal_key,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1195,1199 ---- read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), portal_key, sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1229,1233 **** /* Remove Portals */ ! memcpy(&portalListEntry.portal_ip_port, portal_key, sizeof(portalListEntry.portal_ip_port)); portalListEntry.portal_idx = p_portal->portal_index; --- 1236,1240 ---- /* Remove Portals */ ! __ISNS_COPY (&portalListEntry.portal_ip_port, sizeof(portalListEntry.portal_ip_port), portal_key, sizeof(portalListEntry.portal_ip_port)); portalListEntry.portal_idx = p_portal->portal_index; *************** *** 1331,1336 **** break; case ISNS_DD_IFCP_MEMBER: ! memcpy (member_name, p_member->node_id, ! ISNS_PORT_NAME_SIZE); if (ISNS_NO_ERR != Remove_DD_from_IFCP_Node (p_dd->id, p_member->node_id)) --- 1338,1342 ---- break; case ISNS_DD_IFCP_MEMBER: ! __ISNS_COPY (member_name, sizeof(member_name), p_member->node_id, ISNS_PORT_NAME_SIZE); if (ISNS_NO_ERR != Remove_DD_from_IFCP_Node (p_dd->id, p_member->node_id)) *************** *** 1708,1712 **** /* Fetch the node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, (char *) &key->val, key->len); ISNS_DBKey read_key; --- 1714,1718 ---- /* Fetch the node */ memset (&db_node_name, 0, sizeof (db_node_name)); ! __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ISNS_DBKey read_key; *************** *** 1734,1738 **** ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! memcpy(&read_key.val,&key->val,PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) --- 1740,1744 ---- ISNS_DBKey read_key; read_key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &key->val, PORT_NAME_SIZE); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) Index: iSNStbl.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNStbl.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNStbl.c 2 Apr 2002 20:56:54 -0000 1.2 --- iSNStbl.c 13 Aug 2007 22:56:45 -0000 1.3 *************** *** 226,230 **** memset(scnTbl[i], 0, sizeof(SCN_ENTRY)); scnTbl[i]->type=type; ! memcpy(scnTbl[i]->name, p_name, ISNS_PORT_NAME_SIZE); nSCN++; break; --- 226,230 ---- memset(scnTbl[i], 0, sizeof(SCN_ENTRY)); scnTbl[i]->type=type; ! isns_copy (scnTbl[i]->name, sizeof(scnTbl[i]->name, p_name, ISNS_PORT_NAME_SIZE); nSCN++; break; Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** iSNSreg.c 7 Aug 2007 14:41:47 -0000 1.27 --- iSNSreg.c 13 Aug 2007 22:56:45 -0000 1.28 *************** *** 358,363 **** attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; ! memcpy ( (char *) db_portal.ip_addr.v, &attr->val, ! ISNS_PORTAL_IP_SIZE ); saveIndex = ii; --- 358,362 ---- attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; ! __ISNS_COPY (db_portal.ip_addr.v, sizeof(db_portal.ip_addr.v), &attr->val, ISNS_PORTAL_IP_SIZE); saveIndex = ii; *************** *** 372,377 **** __DEBUG (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); key = (ISNS_Key *) key_indx[ portalIpIndex ]; ! memcpy ( (char *) db_portal.ip_addr.v, &key->val, ! key->len ); saveIndex = 0; } --- 371,375 ---- __DEBUG (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); key = (ISNS_Key *) key_indx[ portalIpIndex ]; ! __ISNS_COPY (db_portal.ip_addr.v, sizeof(db_portal.ip_addr.v), &key->val, key->len); saveIndex = 0; } *************** *** 379,383 **** __DEBUG (isns_reg_debug &1,(read portal:%s),db_portal.ip_addr.v); read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); --- 377,381 ---- __DEBUG (isns_reg_debug &1,(read portal:%s),db_portal.ip_addr.v); read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); *************** *** 406,410 **** attr = (ISNS_Attr *) attr_indx[portalIpIndex]; ! memcpy (p_portal->ip_addr.v, attr->val.ip_addr.v, attr->len); attr = (ISNS_Attr *) attr_indx[portalPortIndex]; --- 404,408 ---- attr = (ISNS_Attr *) attr_indx[portalIpIndex]; ! __ISNS_COPY (p_portal->ip_addr.v, sizeof(p_portal->ip_addr.v), attr->val.ip_addr.v, attr->len); attr = (ISNS_Attr *) attr_indx[portalPortIndex]; *************** *** 421,425 **** entry3.data_type = PORTAL_IDX_KEY; p_idx = &entry3.data.portal_idx; ! memcpy(p_idx,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbWrite(&idx_key,entry3); --- 419,423 ---- entry3.data_type = PORTAL_IDX_KEY; p_idx = &entry3.data.portal_idx; ! __ISNS_COPY (p_idx, sizeof(entry3.data.portal_idx), &db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbWrite(&idx_key,entry3); *************** *** 471,475 **** if (!foundFlag) { ! memcpy(&newPortalEntry.portal_ip_port, &db_portal, sizeof(db_portal)); newPortalEntry.portal_idx = p_portal->portal_index; __DEBUG (isns_reg_debug &1, (AddNode - iportal)); --- 469,473 ---- if (!foundFlag) { ! __ISNS_COPY (&newPortalEntry.portal_ip_port, sizeof(newPortalEntry.portal_ip_port), &db_portal, sizeof(db_portal)); newPortalEntry.portal_idx = p_portal->portal_index; __DEBUG (isns_reg_debug &1, (AddNode - iportal)); *************** *** 525,529 **** { /* Portal is not already in entity */ ! memcpy(&newPortalEntry.portal_ip_port, &db_portal, sizeof(db_portal)); newPortalEntry.portal_idx = p_portal->portal_index; AddNode(&p_entity->iportal_list, (char *)&newPortalEntry, sizeof(newPortalEntry)); --- 523,527 ---- { /* Portal is not already in entity */ ! __ISNS_COPY (&newPortalEntry.portal_ip_port, sizeof(newPortalEntry.portal_ip_port), &db_portal, sizeof(db_portal)); newPortalEntry.portal_idx = p_portal->portal_index; AddNode(&p_entity->iportal_list, (char *)&newPortalEntry, sizeof(newPortalEntry)); *************** *** 551,555 **** { memset (p_portal->sym_name, 0, attr->len); ! memcpy (p_portal->sym_name, &attr->val, attr->len); ISNSAppendKey( p_scn_all_msg_buffer, ISNS_PORTAL_SYM_NAME, --- 549,553 ---- { memset (p_portal->sym_name, 0, attr->len); ! __ISNS_COPY (p_portal->sym_name, sizeof(p_portal->sym_name), &attr->val, attr->len); ISNSAppendKey( p_scn_all_msg_buffer, ISNS_PORTAL_SYM_NAME, *************** *** 638,642 **** ISNS_DBKey update_key; update_key.tag = PORTAL_ID_KEY; ! memcpy(&update_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbWrite(&update_key,entry2); --- 636,640 ---- ISNS_DBKey update_key; update_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&update_key.val, sizeof(update_key.val), &db_portal, sizeof(SOIP_Portal_Key)); rval = ISNSdbWrite(&update_key,entry2); *************** *** 816,825 **** attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; ! memcpy ( (char *) db_portal_group.ip_addr.v, &attr->val, ! ISNS_PORTAL_IP_SIZE ); __DEBUG (isns_reg_debug &1,(Portal Group ip_addr:%s),db_portal_group.ip_addr.v); attr = (ISNS_Attr *) attr_indx[ iscsiIndex ]; ! memcpy ( (char *) db_portal_group.id.v, &attr->val, attr->len); __DEBUG (isns_reg_debug &1,(Portal Group iscsi_name:%s),db_portal_group.id.v); --- 814,822 ---- attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; ! __ISNS_COPY (db_portal_group.ip_addr.v, sizeof(db_portal_group.ip_addr.v), &attr->val, ISNS_PORTAL_IP_SIZE); __DEBUG (isns_reg_debug &1,(Portal Group ip_addr:%s),db_portal_group.ip_addr.v); attr = (ISNS_Attr *) attr_indx[ iscsiIndex ]; ! __ISNS_COPY (db_portal_group.id.v, sizeof(db_portal_group.id.v), &attr->val, attr->len); __DEBUG (isns_reg_debug &1,(Portal Group iscsi_name:%s),db_portal_group.id.v); *************** *** 834,842 **** key = (ISNS_Key *) key_indx[ portalIpIndex ]; ! memcpy ( (char *) db_portal_group.ip_addr.v, &key->val, key->len); __DEBUG (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); attr = (ISNS_Attr *) key_indx[ iscsiIndex ]; ! memcpy ( (char *) db_portal_group.id.v, &attr->val, attr->len); __DEBUG (isns_reg_debug &1,(Portal Group iscsi_name:%s),db_portal_group.id.v); --- 831,839 ---- key = (ISNS_Key *) key_indx[ portalIpIndex ]; ! __ISNS_COPY (db_portal_group.ip_addr.v, sizeof(db_portal_group.ip_addr.v), &key->val, key->len); __DEBUG (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); attr = (ISNS_Attr *) key_indx[ iscsiIndex ]; ! __ISNS_COPY (db_portal_group.id.v, sizeof(db_portal_group.id.v), &attr->val, attr->len); __DEBUG (isns_reg_debug &1,(Portal Group iscsi_name:%s),db_portal_group.id.v); *************** *** 868,872 **** read_key.tag = PORTAL_GROUP_ID_KEY; ! memcpy(&read_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbRead(&read_key,&entry2); __DEBUG (isns_reg_debug & 1, Read PortalGroup for DB status:%i,rval); --- 865,869 ---- read_key.tag = PORTAL_GROUP_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_portal_group, sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbRead(&read_key,&entry2); __DEBUG (isns_reg_debug & 1, Read PortalGroup for DB status:%i,rval); *************** *** 890,894 **** attr = (ISNS_Attr *) attr_indx[portalIpIndex]; ! memcpy (p_portal_group->ip_addr.v, attr->val.ip_addr.v, attr->len); attr = (ISNS_Attr *) attr_indx[portalPortIndex]; --- 887,891 ---- attr = (ISNS_Attr *) attr_indx[portalIpIndex]; ! __ISNS_COPY (p_portal_group->ip_addr.v, sizeof(p_portal_group->ip_addr.v), attr->val.ip_addr.v, attr->len); attr = (ISNS_Attr *) attr_indx[portalPortIndex]; *************** *** 896,900 **** attr = (ISNS_Attr *) attr_indx[iscsiIndex]; ! memcpy (p_portal_group->id.v, attr->val.node_name.v, attr->len); newPortalGroupRegFlag = TRUE; --- 893,897 ---- attr = (ISNS_Attr *) attr_indx[iscsiIndex]; ! __ISNS_COPY (p_portal_group->id.v, sizeof(p_portal_group->id.v), attr->val.node_name.v, attr->len); newPortalGroupRegFlag = TRUE; *************** *** 906,910 **** ISNS_DBKey update_key; update_key.tag = PORTAL_GROUP_ID_KEY; ! memcpy(&update_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbWrite(&update_key,entry2); __DEBUG (isns_reg_debug & 1, Write PortalGroup for DB status:%i,rval); --- 903,907 ---- ISNS_DBKey update_key; update_key.tag = PORTAL_GROUP_ID_KEY; ! __ISNS_COPY (&update_key.val, sizeof(update_key.val), &db_portal_group, sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbWrite(&update_key,entry2); __DEBUG (isns_reg_debug & 1, Write PortalGroup for DB status:%i,rval); *************** *** 1602,1606 **** new_member.type = type; new_member.status = status; ! memcpy (new_member.node_id, p_node_name, strlen(p_node_name)); new_member.node_idx = index_number; --- 1599,1603 ---- new_member.type = type; new_member.status = status; ! __ISNS_COPY (new_member.node_id, sizeof(new_member.node_id), p_node_name, strlen(p_node_name)); new_member.node_idx = index_number; *************** *** 1728,1732 **** entry3.data_type = ENTITY_IDX_KEY; p_idx = &entry3.data.entity_idx; ! memcpy(p_idx,&db_entity_id.id,sizeof(SOIP_Entity_Id)); rval = ISNSdbWrite(&idx_key,entry3); --- 1725,1729 ---- entry3.data_type = ENTITY_IDX_KEY; p_idx = &entry3.data.entity_idx; ! __ISNS_COPY (p_idx, sizeof(entry3.data.entity_idx), &db_entity_id.id, sizeof(SOIP_Entity_Id)); rval = ISNSdbWrite(&idx_key,entry3); *************** *** 1776,1780 **** break; case ISNS_MGMT_IP: ! memcpy ((char *) p_entity->mgmt_ip_addr.v, &attr->val, ISNS_IP_SIZE); updateFlag = TRUE; break; --- 1773,1777 ---- break; case ISNS_MGMT_IP: ! __ISNS_COPY (p_entity->mgmt_ip_addr.v, sizeof(p_entity->mgmt_ip_addr.v), &attr->val, ISNS_IP_SIZE); updateFlag = TRUE; break; *************** *** 1902,1907 **** memset (&db_node_name, 0, sizeof (db_node_name)); ! memcpy ((char *) db_node_name.v, ! (char *) key->val.node_name.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id... [truncated message content] |
From: Robert W. <wrw...@us...> - 2007-08-13 22:56:54
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26510/isnsclient/src Modified Files: isns.c main.c main_ui.c parse.c payloads.c Log Message: add attribute copy checking Index: main_ui.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/main_ui.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main_ui.c 2 Feb 2007 23:21:38 -0000 1.1 --- main_ui.c 13 Aug 2007 22:56:44 -0000 1.2 *************** *** 73,77 **** -h Listen for L2 heartbeat from an iSNS.\n\ -a ip iSNS Address.\n\ ! -t TCP mode.\n\ -p port Port used for sending. Default is port 3205.\n\ -? Help.\n\ --- 73,77 ---- -h Listen for L2 heartbeat from an iSNS.\n\ -a ip iSNS Address.\n\ ! //-u TCP mode.\n\ -p port Port used for sending. Default is port 3205.\n\ -? Help.\n\ *************** *** 102,106 **** /* Default Values */ isns_port = ISNS_SERVER_PORT; ! tcpFlag = FALSE; enableESIFlag = TRUE; hb_flag = FALSE; --- 102,107 ---- /* Default Values */ isns_port = ISNS_SERVER_PORT; ! // tcpFlag = FALSE; ! tcpFlag = TRUE; enableESIFlag = TRUE; hb_flag = FALSE; Index: payloads.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/payloads.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** payloads.c 30 Mar 2007 22:55:22 -0000 1.4 --- payloads.c 13 Aug 2007 22:56:44 -0000 1.5 *************** *** 50,54 **** queryDDS (char *id) { ! char buffer[1024]={0}; ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof(cmd), 0); --- 50,54 ---- queryDDS (char *id) { ! char buffer[MAX_PAYLOAD_SIZE]={0}; ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof(cmd), 0); *************** *** 85,89 **** queryDD (char *id) { ! char buffer[1024]={0}; ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof(cmd), 0); --- 85,89 ---- queryDD (char *id) { ! char buffer[MAX_PAYLOAD_SIZE]={0}; ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof(cmd), 0); *************** *** 412,416 **** queryISCSI (char * id) { ! char buffer[2048]; if (strlen(id) ) --- 412,416 ---- queryISCSI (char * id) { ! char buffer[MAX_PAYLOAD_SIZE]={0}; if (strlen(id) ) *************** *** 446,450 **** queryEntity (void) { ! char buffer[2048]; ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); --- 446,450 ---- queryEntity (void) { ! char buffer[MAX_PAYLOAD_SIZE]={0}; ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); *************** *** 466,470 **** queryPortal (void) { ! char buffer[2048]; ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); --- 466,470 ---- queryPortal (void) { ! char buffer[MAX_PAYLOAD_SIZE]={0}; ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); Index: main.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/main.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** main.c 30 Mar 2007 22:55:22 -0000 1.5 --- main.c 13 Aug 2007 22:56:44 -0000 1.6 *************** *** 75,82 **** Options:\n\ -h Listen for L2 heartbeat from an iSNS.\n\ -a ip iSNS Address.\n\ - -t TCP mode.\n\ -p port Port used for sending. Default is port 3205.\n\ - -? Help.\n\ -q type Query\n\ type: dds\n\ --- 75,82 ---- Options:\n\ -h Listen for L2 heartbeat from an iSNS.\n\ + -? Help.\n\ + \n\ -a ip iSNS Address.\n\ -p port Port used for sending. Default is port 3205.\n\ -q type Query\n\ type: dds\n\ *************** *** 129,133 **** /* Default Values */ isns_port = ISNS_SERVER_PORT; ! tcpFlag = FALSE; enableESIFlag = TRUE; hb_flag = FALSE; --- 129,134 ---- /* Default Values */ isns_port = ISNS_SERVER_PORT; ! //tcpFlag = FALSE; ! tcpFlag = TRUE; enableESIFlag = TRUE; hb_flag = FALSE; Index: isns.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/isns.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** isns.c 16 Jan 2007 20:22:54 -0000 1.9 --- isns.c 13 Aug 2007 22:56:44 -0000 1.10 *************** *** 238,242 **** GetDDS (void) { ! char buffer[2048]; char cmdLine[256]; int id; --- 238,242 ---- GetDDS (void) { ! char buffer[MAX_PAYLOAD_SIZE]; char cmdLine[256]; int id; *************** *** 310,314 **** pdu = (struct isns_hdr *)buffer; ptr = buffer + sizeof (ISNS_HDR) + 4; ! while (ptr < buffer + sizeof (ISNS_HDR) + pdu->len) { p_attr = (struct ISNS_attr *)ptr; --- 310,316 ---- pdu = (struct isns_hdr *)buffer; ptr = buffer + sizeof (ISNS_HDR) + 4; ! printf("pdu->len:%d\n",pdu->len); ! ! while (ptr < (buffer + sizeof (ISNS_HDR) + pdu->len) ) { p_attr = (struct ISNS_attr *)ptr; *************** *** 360,364 **** GetDD (void) { ! char buffer[2048]; char cmdLine[256]; int id; --- 362,366 ---- GetDD (void) { ! char buffer[MAX_PAYLOAD_SIZE]; char cmdLine[256]; int id; *************** *** 938,958 **** ISNSAppendAttr (&cmd, ISNS_PORT_NAME, 8, cmdLine, 0); ! scn_bitmap_type = ISNS_ENTITY_SCN_BITMAP; ! } ! else if (key_type == 2) ! { ! c_size = ! GetInput (cmdLine, "Entity ID", "(none)", sizeof (cmdLine)); ! if (c_size == 0) ! { ! printf ("***ERROR: You must enter a node id.\n"); ! return; ! } ! ! ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (cmdLine)), ! cmdLine, 0); ! ! scn_bitmap_type = ISNS_ENTITY_SCN_BITMAP; } else if (key_type == 3) { --- 940,960 ---- ISNSAppendAttr (&cmd, ISNS_PORT_NAME, 8, cmdLine, 0); ! scn_bitmap_type = ISNS_ISCSI_SCN_BITMAP; } + // else if (key_type == 2) + // { + // c_size = + // GetInput (cmdLine, "Entity ID", "(none)", sizeof (cmdLine)); + // if (c_size == 0) + // { + // printf ("***ERROR: You must enter a node id.\n"); + // return; + // } + // + // ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (cmdLine)), + // cmdLine, 0); + // + // scn_bitmap_type = ISNS_ENTITY_SCN_BITMAP; + // } else if (key_type == 3) { *************** *** 1214,1236 **** else if (src_type == 3) { ! if (0 == ! GetInput (cmdLine, "KEY: Entity ID", "(none)", ! sizeof (cmdLine))) ! { ! return (-1); ! } ! ! ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (cmdLine)), cmdLine, ! 0); ! ! if (0 != ! GetInput (cmdLine, "Event Bitmap (int)", "0x1F", sizeof (cmdLine))) ! { ! scn_bitmap = atoi (cmdLine); ! } ! ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! ! ISNSAppendAttr (&cmd, ISNS_ENTITY_SCN_BITMAP, 4, NULL, scn_bitmap); } --- 1216,1238 ---- else if (src_type == 3) { ! // if (0 == ! // GetInput (cmdLine, "KEY: Entity ID", "(none)", ! // sizeof (cmdLine))) ! // { ! // return (-1); ! // } ! // ! // ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (cmdLine)), cmdLine, ! // 0); ! // ! // if (0 != ! // GetInput (cmdLine, "Event Bitmap (int)", "0x1F", sizeof (cmdLine))) ! // { ! // scn_bitmap = atoi (cmdLine); ! // } ! // ! // ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! // ! // ISNSAppendAttr (&cmd, ISNS_ENTITY_SCN_BITMAP, 4, NULL, scn_bitmap); } *************** *** 1408,1412 **** static char currentValue2[256]={0}; ! char buffer[1024]={0}; char cmdLine[256]={0}; --- 1410,1414 ---- static char currentValue2[256]={0}; ! char buffer[MAX_PAYLOAD_SIZE]={0}; char cmdLine[256]={0}; Index: parse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/parse.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** parse.c 16 Jan 2007 20:22:54 -0000 1.7 --- parse.c 13 Aug 2007 22:56:44 -0000 1.8 *************** *** 98,102 **** case ISNS_PROT_VER : return("Protocol Version Range"); case ISNS_ENTITY_PERIOD : return("Entity Period"); - case ISNS_ENTITY_SCN_BITMAP : return("Entity SCN Bitmap"); case ISNS_ENTITY_CERT : return("Entity Certificate"); case ISNS_PORTAL_IP : return("Portal IP-Address"); --- 98,101 ---- *************** *** 315,319 **** ntohl(p_attr->val.etype)?"Enabled":"Disabled"); break; - case ISNS_ENTITY_SCN_BITMAP : case ISNS_ENTITY_CERT : case ISNS_PORTAL_CERT : --- 314,317 ---- |
From: Robert W. <wrw...@us...> - 2007-08-07 14:41:53
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17288/src Modified Files: iSNSInit.c iSNSLinux.c iSNSList.c iSNSMain.c iSNSUtil.c iSNScomm.c iSNSdb.c iSNSdereg.c iSNSesi.c iSNSfsm.c iSNSipc.c iSNSnt.c iSNSparse.c iSNSquery.c iSNSrcv.c iSNSreg.c iSNSscn.c iSNStrcv.c Log Message: Add logging system Index: iSNSInit.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSInit.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iSNSInit.c 2 Jan 2007 20:15:24 -0000 1.6 --- iSNSInit.c 7 Aug 2007 14:41:47 -0000 1.7 *************** *** 68,72 **** sprintf (sns_errmsg, "%s:%d - Error creating SNS_EP IPC endpoint\n", __FILE__,__LINE__); ! SNS_FATAL(SNS_IPC_ERR, sns_errmsg, 0); taskDelete(taskIdSelf()); } --- 68,72 ---- sprintf (sns_errmsg, "%s:%d - Error creating SNS_EP IPC endpoint\n", __FILE__,__LINE__); ! __LOG_ERROR("Error creating SNS_EP IPC endpoint"); taskDelete(taskIdSelf()); } *************** *** 77,84 **** if (CreateIPCEndPoint(DEVICE_MGMT_EP) == ERROR) { ! sprintf(sns_errmsg, ! "%s:%d - Error creating DEVICE_MGMT_EP IPC endpoint\n", ! __FILE__,__LINE__); ! SNS_FATAL(SNS_IPC_ERR, sns_errmsg, 0); taskDelete(taskIdSelf()); } --- 77,81 ---- if (CreateIPCEndPoint(DEVICE_MGMT_EP) == ERROR) { ! __LOG_ERROR("Error creating DEVICE_MGMT_EP IPC endpoint"); taskDelete(taskIdSelf()); } *************** *** 88,94 **** if (ISNSdbOpen() == ERROR) { ! sprintf (sns_errmsg, "%s:%d - Error in Opening iSNS DB File\n", ! __FILE__,__LINE__); ! SNS_FATAL(SNS_DBOPEN_ERR, sns_errmsg, 0); taskDelete(taskIdSelf()); } --- 85,89 ---- if (ISNSdbOpen() == ERROR) { ! __LOG_ERROR("Error in opening iSNS DB file"); taskDelete(taskIdSelf()); } *************** *** 99,106 **** if (SNSCommInit(sns_role) == -1) { ! sprintf (sns_errmsg, ! "%s:%d - Error in Initializing socket Communications\n", ! __FILE__,__LINE__); ! SNS_FATAL(SNS_COMM_ERR, sns_errmsg, 0); /* * clean up and bail out --- 94,98 ---- if (SNSCommInit(sns_role) == -1) { ! __LOG_ERROR ("Error in Initialing socket communication"); /* * clean up and bail out *************** *** 116,122 **** if (SNSQInit(SNS_TRANSACTION_QUEUE) == ERROR) { ! sprintf(sns_errmsg, "%s:%d - Error initing queue IPC msgs\n", ! __FILE__,__LINE__); ! SNS_FATAL(SNS_QINIT_ERR, sns_errmsg, 0); ISNSdbClose(); taskDelete(taskIdSelf()); --- 108,112 ---- if (SNSQInit(SNS_TRANSACTION_QUEUE) == ERROR) { ! __LOG_ERROR("Error initing queue IPC msgs"); ISNSdbClose(); taskDelete(taskIdSelf()); *************** *** 135,142 **** #endif { ! sprintf (sns_errmsg, ! "%s:%d - Error spawning iSNS UDP receive task\n", ! __FILE__,__LINE__); ! SNS_FATAL(SNS_SPAWN_ERR, sns_errmsg, 0); ISNSdbClose(); taskDelete(taskIdSelf()); --- 125,129 ---- #endif { ! __LOG_ERROR("Error spawning iSNS UDP receive task"); ISNSdbClose(); taskDelete(taskIdSelf()); *************** *** 153,159 **** if ( SNSStartFSM() == ERROR ) { ! sprintf (sns_errmsg, "%s:%d : Unable to Start iSNS FSM\n", ! __FILE__,__LINE__); ! SNS_FATAL(SNS_FSM_ERR, sns_errmsg, 0); ISNSdbClose(); taskDelete(taskIdSelf()); --- 140,144 ---- if ( SNSStartFSM() == ERROR ) { ! __LOG_ERROR("Unable to Start iSNS FSM"); ISNSdbClose(); taskDelete(taskIdSelf()); Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** iSNSUtil.c 28 Jun 2007 19:46:08 -0000 1.16 --- iSNSUtil.c 7 Aug 2007 14:41:47 -0000 1.17 *************** *** 1,3 **** ! /*********************************************************************** Copyright (c) 2001, Nishan Systems, Inc. All rights reserved. --- 1,3 ---- ! /********************************************************************** Copyright (c) 2001, Nishan Systems, Inc. All rights reserved. *************** *** 66,81 **** case DEREG_DEVI_REQ: [...1213 lines suppressed...] + switch (level) + { + case LOG_ERR: + fprintf(stderr,"ERROR: "); + break; + case LOG_WARNING: + fprintf(stderr,"WARNING: "); + break; + case LOG_DEBUG: + fprintf(stderr,"Debug: "); + break; + case LOG_INFO: + fprintf(stderr,"Info: "); + break; + } + vfprintf(stderr, format, ptr); + } + va_end(ptr); + } + Index: iSNScomm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNScomm.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNScomm.c 4 Jan 2007 19:00:06 -0000 1.10 --- iSNScomm.c 7 Aug 2007 14:41:47 -0000 1.11 *************** *** 39,42 **** --- 39,43 ---- #include "iSNSparse.h" #include "iSNSdebug.h" + #include "errno.h" int sns_comm_debug = 0; *************** *** 50,54 **** int ifAddrGet(char *ifname, char *ip) { - //if (strcmp(ifname, sns_if_name) == 0) { if (strlen (snsp_ip) != 0) { strcpy(ip, snsp_ip); --- 51,54 ---- *************** *** 56,60 **** else { - //printf("unknown interface\n"); return (ERROR); } --- 56,59 ---- *************** *** 110,114 **** void pipe_handler(int n) { ! printf("SIGPIPE received:%i\n",n); } --- 109,113 ---- void pipe_handler(int n) { ! __LOG_INFO ("SIGPIPE received:%i",n); } *************** *** 328,345 **** &md->cb.sock.len) == -1 ) { ! // printf ("\n%s:%d sd %d",__FILE__,__LINE__,sd); ! // perror("\nSNSGetMsg(recvfrom):"); ! // status = ERROR; } else { - #if 0 - if (md->cb.sock.addr.sin_addr.s_addr == local_sock.sin_addr.s_addr) - continue; - #endif - if (sns3) ! printf("Receive from %x\n", (int)md->cb.sock.addr.sin_addr.s_addr); { /* iSNS msg */ --- 327,338 ---- &md->cb.sock.len) == -1 ) { ! __LOG_ERROR ("Error recform "); ! status = ERROR; } else { if (sns3) ! __LOG_INFO ("Receive from %x", (int)md->cb.sock.addr.sin_addr.s_addr); { /* iSNS msg */ *************** *** 368,372 **** int rval; ! DEBUG_0 (sns_comm_debug &1,ISNSSendMsg); p_md->msg.hdr.flags |= ISNS_FLAG_SND_SERVER; --- 361,365 ---- int rval; ! __DEBUG (sns_comm_debug &1,ISNSSendMsg); p_md->msg.hdr.flags |= ISNS_FLAG_SND_SERVER; *************** *** 388,392 **** /* UDP */ rval = SNSSendMsg_UDP(p_md); ! printf("***WARNING: Wrong Socket Type.\n"); return (rval); --- 381,385 ---- /* UDP */ rval = SNSSendMsg_UDP(p_md); ! __LOG_WARNING ("WARNING: Wrong Socket Type."); return (rval); *************** *** 422,426 **** if (s_len<=0) { ! printf("***ERROR: send() error=%d.\n", s_len); return (ERROR); } --- 415,419 ---- if (s_len<=0) { ! __LOG_INFO ("send() error=%d %s",s_len, strerror(errno) ); return (ERROR); } *************** *** 489,493 **** (struct sockaddr *)&p_md->cb.sock.addr, p_md->cb.sock.len); ! DEBUG_4 (display_debug, (iSNS Sending msg id %d, len %d, xid %d to %s), p_md->msg.hdr.type, p_md->msg.hdr.msg_len, --- 482,486 ---- (struct sockaddr *)&p_md->cb.sock.addr, p_md->cb.sock.len); ! __DEBUG (display_debug, (iSNS Sending msg id %d, len %d, xid %d to %s), p_md->msg.hdr.type, p_md->msg.hdr.msg_len, *************** *** 510,514 **** (struct sockaddr *)&p_md->cb.sock.addr, p_md->cb.sock.len); ! DEBUG_4 (display_debug, (iSNS Sending msg id %#x, len %d, xid %d to %s), ntohs(p_md->msg.hdr.type), ntohs(p_md->msg.hdr.msg_len), --- 503,507 ---- (struct sockaddr *)&p_md->cb.sock.addr, p_md->cb.sock.len); ! __DEBUG (display_debug, (iSNS Sending msg id %#x, len %d, xid %d to %s), ntohs(p_md->msg.hdr.type), ntohs(p_md->msg.hdr.msg_len), *************** *** 638,642 **** else { ! printf("***Warning: type is already in network byte order.\n"); } --- 631,635 ---- else { ! __LOG_WARNING("Warning: type is already in network byte order."); } *************** *** 651,655 **** sizeof(struct sockaddr_in)) == ERROR) { ! DEBUG_1 (sns_comm_debug, (Error in Sending message to %s), dot_not_addr); status = ERROR; --- 644,648 ---- sizeof(struct sockaddr_in)) == ERROR) { ! __DEBUG (sns_comm_debug, (Error in Sending message to %s), dot_not_addr); status = ERROR; *************** *** 657,661 **** else { ! DEBUG_1 (display_debug, (Sending message to %s), dot_not_addr); status = SUCCESS; } --- 650,654 ---- else { ! __DEBUG (display_debug, (Sending message to %s), dot_not_addr); status = SUCCESS; } *************** *** 729,733 **** display_debug = (p_msg->hdr.type != sns_comm_msg_filter); ! DEBUG_4 (display_debug, (iSNS Sending bcast/mcast msg id %d, len %d, xid %d to %s), p_msg->hdr.type, p_msg->hdr.msg_len, --- 722,726 ---- display_debug = (p_msg->hdr.type != sns_comm_msg_filter); ! __DEBUG (display_debug, (iSNS Sending bcast/mcast msg id %d, len %d, xid %d to %s), p_msg->hdr.type, p_msg->hdr.msg_len, Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSLinux.c 15 Dec 2006 01:13:29 -0000 1.11 --- iSNSLinux.c 7 Aug 2007 14:41:47 -0000 1.12 *************** *** 46,49 **** --- 46,50 ---- #include "iSNSbuffer.h" #include "iSNSipc.h" + #include "iSNSdebug.h" #ifndef SNS_LINUX *************** *** 69,72 **** --- 70,76 ---- extern pthread_mutex_t sns_esi_timer; + /* log */ + int daemon_state = TRUE; + /* debug */ extern int sns_bcast_debug; *************** *** 149,158 **** NOTES: IP-Addresses must be in IP dotted notation.\n\ Options:\n\ ! [-a addr] IP-Address for SNSP traffic.\n\ ! [-b addr] Broadcast Address for SNSP traffic.\n\ ! [-p port] primary port for SNSP traffic.\n\ ! [-d] Full debug options on.\n\ ! [-f] Foreground - no daemon.\n\ ! [-?] Help.\n"; --- 153,162 ---- NOTES: IP-Addresses must be in IP dotted notation.\n\ Options:\n\ ! [-a addr] IP-Address for SNSP traffic.\n\ ! [-b addr] Broadcast Address for SNSP traffic.\n\ ! [-p port] primary port for SNSP traffic.\n\ ! [-d switch] debug options: parse,db,list,reg,fsm,esi,scn,all \n\ ! [-f] Foreground - no daemon.\n\ ! [-?] Help.\n"; *************** *** 160,164 **** main (int argc, char **argv) { - int daemon = TRUE; pid_t pid; int c; --- 164,167 ---- *************** *** 198,216 **** break; case 'f': ! daemon = FALSE; break; case '?': default: ! fprintf (stderr, Usage); exit (0); } } ! if (daemon == TRUE) { pid = fork(); if (pid < 0) { ! printf("starting daemon failed\n"); exit(1); } --- 201,219 ---- break; case 'f': ! daemon_state = FALSE; break; case '?': default: ! fprintf(stderr,Usage); exit (0); } } ! if (daemon_state == TRUE) { pid = fork(); if (pid < 0) { ! __LOG_ERROR("starting daemon failed\n"); exit(1); } *************** *** 233,238 **** if (lockf(fd_pid, F_TLOCK, 0) < 0) { ! printf("unable to lock pid file already is use\n"); ! printf("isnss daemon not started\n"); exit (1); } --- 236,241 ---- if (lockf(fd_pid, F_TLOCK, 0) < 0) { ! __LOG_ERROR("unable to lock pid file already is use\n"); ! __LOG_INFO("isnss daemon not started\n"); exit (1); } *************** *** 241,254 **** sprintf(buf,"%d\n",getpid()); rc = write(fd_pid, buf, strlen(buf)); ! printf("isns daemon started as pid:%i\n",getpid()); - int fd; - char log_file[256]="/var/opt/isns/isns_log"; - printf("log output in %s\n",log_file); - fd = open(log_file, O_CREAT | O_WRONLY | O_TRUNC, 0644 ); - close(0); - dup2(fd,0); - dup2(fd,1); - dup2(fd,2); setsid(); } --- 244,249 ---- sprintf(buf,"%d\n",getpid()); rc = write(fd_pid, buf, strlen(buf)); ! __LOG_INFO ("isns daemon started as pid:%i",getpid()); setsid(); } *************** *** 273,277 **** int rc; ! printf ("SNSReqTimeoutHdlr Started.\n"); while (1) --- 268,272 ---- int rc; ! __DEBUG ( isns_main_debug & 16,"SNSReqTimeoutHdlr Started."); while (1) *************** *** 307,311 **** int rc; ! printf ("SNSFSMTimeoutHdlr thread started.\n"); while (1) --- 302,306 ---- int rc; ! __DEBUG (isns_main_debug & 1666666,"SNSFSMTimeoutHdlr thread started."); while (1) *************** *** 344,348 **** int rc; ! printf ("SNSESITimeoutHdlr thread started.\n"); while (1) --- 339,343 ---- int rc; ! __DEBUG (isns_main_debug & 16,"SNSESITimeoutHdlr thread started."); while (1) *************** *** 431,435 **** sns_scn_debug = -1; } ! else { sns_bcast_debug = -1; --- 426,430 ---- sns_scn_debug = -1; } ! else if (!strcmp(type,"all")) { sns_bcast_debug = -1; Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** iSNSquery.c 31 May 2007 21:16:36 -0000 1.22 --- iSNSquery.c 7 Aug 2007 14:41:47 -0000 1.23 *************** *** 126,130 **** if (attr == NULL) { ! DEBUG_0 (isns_query_debug & 1, (No attr in query msg)); return ( ISNS_MSG_FMT_ERR ); } --- 126,130 ---- if (attr == NULL) { ! __DEBUG (isns_query_debug & 1, (No attr in query msg)); return ( ISNS_MSG_FMT_ERR ); } *************** *** 247,251 **** iSCSINodeIdxKeyFlag = -1; ! DEBUG_0 (isns_query_debug &1,(GetAttrEntity)); ISNSTouchEntity( src_attr ); --- 247,251 ---- iSCSINodeIdxKeyFlag = -1; ! __DEBUG (isns_query_debug &1,(GetAttrEntity)); ISNSTouchEntity( src_attr ); *************** *** 325,329 **** /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); ! DEBUG_1 (isns_query_debug &1,(Find Entity Index:%i),key->val.index); ISNS_DBKey read_key; read_key.tag = ENTITY_IDX_KEY; --- 325,329 ---- /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); ! __DEBUG (isns_query_debug &1,(Find Entity Index:%i),key->val.index); ISNS_DBKey read_key; read_key.tag = ENTITY_IDX_KEY; *************** *** 335,339 **** ptr = (char *)&entry3.data.entity_idx.id; ! DEBUG_1 (isns_query_debug &1,(entity_idx.id:%s),ptr); if (!ptr) --- 335,339 ---- ptr = (char *)&entry3.data.entity_idx.id; ! __DEBUG (isns_query_debug &1,(entity_idx.id:%s),ptr); if (!ptr) *************** *** 361,365 **** if ((portalIpKeyFlag == -1) || (portalPortKeyFlag == -1)) { ! printf ("***Located only one required portal key.\n"); return (ISNS_MSG_FMT_ERR); } --- 361,365 ---- if ((portalIpKeyFlag == -1) || (portalPortKeyFlag == -1)) { ! __LOG_ERROR ("***Located only one required portal key."); return (ISNS_MSG_FMT_ERR); } *************** *** 619,631 **** else if (ddKeyIndex != -1) { ! DEBUG_0(isns_query_debug & 1, (Not implemented)); } else if (ifcpKeyIndex != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not implemented)); } else if (iscsiKeyIndex != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not implemented)); } else --- 619,631 ---- else if (ddKeyIndex != -1) { ! __DEBUG(isns_query_debug & 1, (Not implemented)); } else if (ifcpKeyIndex != -1) { ! __DEBUG (isns_query_debug & 1, (Not implemented)); } else if (iscsiKeyIndex != -1) { ! __DEBUG (isns_query_debug & 1, (Not implemented)); } else *************** *** 680,684 **** int rval; ! DEBUG_0 (isns_query_debug &1, SNSdbGetAttrDDEntry); dd_key.id = id; --- 680,684 ---- int rval; ! __DEBUG (isns_query_debug &1, SNSdbGetAttrDDEntry); dd_key.id = id; *************** *** 720,724 **** ISNS_LIST_NODE *pnode; ! DEBUG_0 (isns_query_debug &1, SNSdbGetAttrDD); rval = Check_Authorization (src_attr); --- 720,724 ---- ISNS_LIST_NODE *pnode; ! __DEBUG (isns_query_debug &1, SNSdbGetAttrDD); rval = Check_Authorization (src_attr); *************** *** 1053,1057 **** if (portalPortKeyFlag == -1 || portalIpKeyFlag == -1) { ! printf ("***Located only one required portal key.\n"); return (ISNS_MSG_FMT_ERR); } --- 1053,1057 ---- if (portalPortKeyFlag == -1 || portalIpKeyFlag == -1) { ! __LOG_ERROR ("***Located only one required portal key."); return (ISNS_MSG_FMT_ERR); } *************** *** 1212,1216 **** if (rval != SUCCESS) { ! DEBUG_0(isns_query_debug & 1, "***ERROR Invalid dd"); return (ISNS_NO_SUCH_ENTRY_ERR); } --- 1212,1216 ---- if (rval != SUCCESS) { ! __DEBUG(isns_query_debug & 1, "***ERROR Invalid dd"); return (ISNS_NO_SUCH_ENTRY_ERR); } *************** *** 1453,1457 **** if ((portalIpKeyFlag == -1) || (portalPortKeyFlag == -1)) { ! printf ("***Located only one required portal key.\n"); return (ISNS_INVALID_QUERY_ERR); } --- 1453,1457 ---- if ((portalIpKeyFlag == -1) || (portalPortKeyFlag == -1)) { ! __LOG_ERROR ("***Located only one required portal key."); return (ISNS_INVALID_QUERY_ERR); } *************** *** 1508,1512 **** else if (fc4TypesKeyFlag != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not Implemented)); return (ERROR); } --- 1508,1512 ---- else if (fc4TypesKeyFlag != -1) { ! __DEBUG (isns_query_debug & 1, (Not Implemented)); return (ERROR); } *************** *** 1561,1565 **** int rval; ! DEBUG_1 (isns_query_debug &1,(Attribute Query - ISCSI:%s),(char *)&src_attr->val); foundFlag = FALSE; --- 1561,1565 ---- int rval; ! __DEBUG (isns_query_debug &1,(Attribute Query - ISCSI:%s),(char *)&src_attr->val); foundFlag = FALSE; *************** *** 1608,1612 **** if (nodeKeyIndex != -1) { ! DEBUG_0 (isns_query_debug &1,nodeKeyIndex); nodeKeyIndex = ISNSFindTag (0, ISNS_ISCSI_NODE_ID, key_indx); --- 1608,1612 ---- if (nodeKeyIndex != -1) { ! __DEBUG (isns_query_debug &1,nodeKeyIndex); nodeKeyIndex = ISNSFindTag (0, ISNS_ISCSI_NODE_ID, key_indx); *************** *** 1630,1634 **** if (rval == SUCCESS) { ! DEBUG_0 (isns_query_debug &1,call ISNSdbProcessICSCIOpAttr); ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); foundFlag = TRUE; --- 1630,1634 ---- if (rval == SUCCESS) { ! __DEBUG (isns_query_debug &1,call ISNSdbProcessICSCIOpAttr); ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); foundFlag = TRUE; *************** *** 1699,1703 **** if (p_entity->eid_type != ENTITY_TYPE_ISCSI) { ! printf ("***ERROR: Expected an iSCSI Entity.\n"); return (ERROR); } --- 1699,1703 ---- if (p_entity->eid_type != ENTITY_TYPE_ISCSI) { ! __LOG_ERROR ("***ERROR: Expected an iSCSI Entity."); return (ERROR); } *************** *** 1732,1736 **** SOIP_Portal * p_portal; ! DEBUG_0 (isns_query_debug &1,(Search for Portal)); memset (&db_portal, 0, sizeof (db_portal)); --- 1732,1736 ---- SOIP_Portal * p_portal; ! __DEBUG (isns_query_debug &1,(Search for Portal)); memset (&db_portal, 0, sizeof (db_portal)); *************** *** 1738,1742 **** if (portalPortKeyIndex == -1 || portalIpKeyIndex == -1) { ! printf ("***ERROR: Didn't have all the Portal Keys.\n"); return (ERROR); } --- 1738,1742 ---- if (portalPortKeyIndex == -1 || portalIpKeyIndex == -1) { ! __LOG_ERROR ("***ERROR: Didn't have all the Portal Keys."); return (ERROR); } *************** *** 1798,1802 **** ISNS_DBKey qkey = { 0 }; ! DEBUG_0 (isns_query_debug &1,search node table); /* Search the node table */ --- 1798,1802 ---- ISNS_DBKey qkey = { 0 }; ! __DEBUG (isns_query_debug &1,search node table); /* Search the node table */ *************** *** 1838,1842 **** return (ISNS_NO_SUCH_ENTRY_ERR); ! DEBUG_0 (isns_query_debug &1,return from GetAttrISCSI); return ISNS_NO_ERR; --- 1838,1842 ---- return (ISNS_NO_SUCH_ENTRY_ERR); ! __DEBUG (isns_query_debug &1,return from GetAttrISCSI); return ISNS_NO_ERR; *************** *** 1869,1873 **** int rval; ! DEBUG_0 (isns_query_debug &1, (ISNSGetNextAttr)); ISNSParseMsg( &p_md->msg, attr_indx, key_indx,&src_attr ); --- 1869,1873 ---- int rval; ! __DEBUG (isns_query_debug &1, (ISNSGetNextAttr)); ISNSParseMsg( &p_md->msg, attr_indx, key_indx,&src_attr ); *************** *** 1888,1892 **** { key = (ISNS_Key *)(key_indx[ii]); ! DEBUG_2 (isns_query_debug &1,(keytag:%i (%s)),key->tag,isnsTagText(key->tag)); switch (key->tag) { --- 1888,1892 ---- { key = (ISNS_Key *)(key_indx[ii]); ! __DEBUG (isns_query_debug &1,(keytag:%i (%s)),key->tag,isnsTagText(key->tag)); switch (key->tag) { *************** *** 2012,2016 **** else if ( nodeKeyIndex != -1 || iscsiIdxKeyIndex!=-1 ) { ! DEBUG_0 (isns_query_debug &1,process nodeKeyIndex); memset(&qkey, 0, sizeof(qkey)); qkey.tag = ISCSI_ID_KEY; --- 2012,2016 ---- else if ( nodeKeyIndex != -1 || iscsiIdxKeyIndex!=-1 ) { ! __DEBUG (isns_query_debug &1,process nodeKeyIndex); memset(&qkey, 0, sizeof(qkey)); qkey.tag = ISCSI_ID_KEY; *************** *** 2018,2025 **** if ( nodeKeyIndex !=-1 ) { ! DEBUG_1 (isns_query_debug &1,(nodeKeyIndex:%i),nodeKeyIndex); key=(ISNS_Key *)(key_indx[nodeKeyIndex]); ! DEBUG_1 (isns_query_debug &1,key length:%i,key->len); ! DEBUG_1 (isns_query_debug &1,key:%s,(char *)&key->val); if (key->len) { --- 2018,2025 ---- if ( nodeKeyIndex !=-1 ) { ! __DEBUG (isns_query_debug &1,(nodeKeyIndex:%i),nodeKeyIndex); key=(ISNS_Key *)(key_indx[nodeKeyIndex]); ! __DEBUG (isns_query_debug &1,key length:%i,key->len); ! __DEBUG (isns_query_debug &1,key:%s,(char *)&key->val); if (key->len) { *************** *** 2057,2062 **** while (!found) { ! DEBUG_1 (isns_query_debug &1, (GetNextOfKey:%s),(char *)&qkey.val); ! DEBUG_1 (isns_query_debug &1, (GetNextOfKey length:%i),qkey.len); if (SNSdbGetNextOfKey (&qkey) != SUCCESS) { --- 2057,2062 ---- while (!found) { ! __DEBUG (isns_query_debug &1, (GetNextOfKey:%s),(char *)&qkey.val); ! __DEBUG (isns_query_debug &1, (GetNextOfKey length:%i),qkey.len); if (SNSdbGetNextOfKey (&qkey) != SUCCESS) { *************** *** 2066,2070 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(ERROR reading Key)); return rval; } --- 2066,2070 ---- if (rval != SUCCESS) { ! __DEBUG (isns_query_debug &1,(ERROR reading Key)); return rval; } *************** *** 2181,2185 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(Error reading getnext)); return 0; } --- 2181,2185 ---- if (rval != SUCCESS) { ! __DEBUG (isns_query_debug &1,(Error reading getnext)); return 0; } *************** *** 2264,2268 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(getnextkey error)); } --- 2264,2268 ---- if (rval != SUCCESS) { ! __DEBUG (isns_query_debug &1,(getnextkey error)); } *************** *** 2768,2776 **** q_attr = (ISNS_Attr *) attr_indx[ ii ]; ! DEBUG_1 (isns_query_debug &1, process attribute for iscsi and entity objects (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) { case ISNS_ISCSI_NODE_ID: ! DEBUG_1 (isns_query_debug &1,ISCSI NODE ID %s,p_node->id.v); ISNSAppendAttr ( p_msg, ISNS_ISCSI_NODE_ID, PAD4 (strlen (p_node->id.v)), p_node->id.v, 0 ); --- 2768,2776 ---- q_attr = (ISNS_Attr *) attr_indx[ ii ]; ! __DEBUG (isns_query_debug &1, process attribute for iscsi and entity objects (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) { case ISNS_ISCSI_NODE_ID: ! __DEBUG (isns_query_debug &1,ISCSI NODE ID %s,p_node->id.v); ISNSAppendAttr ( p_msg, ISNS_ISCSI_NODE_ID, PAD4 (strlen (p_node->id.v)), p_node->id.v, 0 ); *************** *** 2863,2872 **** if ( fetchPortalFlag ) { ! DEBUG_0 (isns_query_debug &1, (fetchPortalFlag)); /* Cycle through all portals */ pnode = NULL; while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) { ! DEBUG_0 (isns_query_debug &1, Get portal record ); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; --- 2863,2872 ---- if ( fetchPortalFlag ) { ! __DEBUG (isns_query_debug &1, (fetchPortalFlag)); /* Cycle through all portals */ pnode = NULL; while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) { ! __DEBUG (isns_query_debug &1, Get portal record ); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; *************** *** 2875,2879 **** if (rval != SUCCESS ) { ! DEBUG_0 (isns_query_debug &1, portal record not found ); return rval; } --- 2875,2879 ---- if (rval != SUCCESS ) { ! __DEBUG (isns_query_debug &1, portal record not found ); return rval; } *************** *** 2881,2885 **** p_portal = &entry5.data.portal; ! DEBUG_0 (isns_query_debug &1, Get portal group record ); memset(&key_portal_group, 0, sizeof(SOIP_Portal_Group_Key)); key_portal_group.ip_port = p_portal->ip_port; --- 2881,2885 ---- p_portal = &entry5.data.portal; ! __DEBUG (isns_query_debug &1, Get portal group record ); memset(&key_portal_group, 0, sizeof(SOIP_Portal_Group_Key)); key_portal_group.ip_port = p_portal->ip_port; *************** *** 2893,2897 **** if (rval != SUCCESS ) { ! DEBUG_0 (isns_query_debug &1, portal group record not found ); return rval; } --- 2893,2897 ---- if (rval != SUCCESS ) { ! __DEBUG (isns_query_debug &1, portal group record not found ); return rval; } *************** *** 2902,2906 **** { q_attr = (ISNS_Attr *) attr_indx[jj]; ! DEBUG_1 (isns_query_debug &1, process attribute for portal objects (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) --- 2902,2906 ---- { q_attr = (ISNS_Attr *) attr_indx[jj]; ! __DEBUG (isns_query_debug &1, process attribute for portal objects (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) *************** *** 2912,2916 **** break; case ISNS_PORTAL_IP: ! DEBUG_0 (isns_query_debug &1,Add ISNS_PORTAL_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_IP, ISNS_PORTAL_IP_SIZE, p_portal->ip_addr.v, 0); --- 2912,2916 ---- break; case ISNS_PORTAL_IP: ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_IP, ISNS_PORTAL_IP_SIZE, p_portal->ip_addr.v, 0); *************** *** 2941,2950 **** break; case ISNS_PORTAL_GROUP_PORT: ! DEBUG_1 (isns_query_debug &1,ISNS_PORTAL_GROUP_PORT:%i,p_portal->ip_port); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_GROUP_PORT_SIZE, NULL, p_portal_group->ip_port); break; case ISNS_PORTAL_GROUP_IP: ! DEBUG_0 (isns_query_debug &1,Add ISNS_PORTAL_GROUP_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_IP_SIZE, p_portal_group->ip_addr.v, 0); --- 2941,2950 ---- break; case ISNS_PORTAL_GROUP_PORT: ! __DEBUG (isns_query_debug &1,ISNS_PORTAL_GROUP_PORT:%i,p_portal->ip_port); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_GROUP_PORT_SIZE, NULL, p_portal_group->ip_port); break; case ISNS_PORTAL_GROUP_IP: ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_IP_SIZE, p_portal_group->ip_addr.v, 0); *************** *** 3313,3321 **** pnode = NULL; ! DEBUG_0 (isns_query_debug &1,(Get_Active_DD_list)); while ( (pnode=GetNextNode(dd_list, pnode)) ) { ! DEBUG_0 (isns_query_debug &1,(Get_Active_DD_List - node data)); /* First, look at the Node's Local DD_LIST. */ if (flag) --- 3313,3321 ---- pnode = NULL; ! __DEBUG (isns_query_debug &1,(Get_Active_DD_list)); while ( (pnode=GetNextNode(dd_list, pnode)) ) { ! __DEBUG (isns_query_debug &1,(Get_Active_DD_List - node data)); /* First, look at the Node's Local DD_LIST. */ if (flag) *************** *** 3429,3433 **** int rval; ! DEBUG_1(isns_query_debug & 1, (Get_Active_DD_List_From_ISCSI_Node nodename=%s),nodename); /* Fetch the node */ --- 3429,3433 ---- int rval; ! __DEBUG(isns_query_debug & 1, (Get_Active_DD_List_From_ISCSI_Node nodename=%s),nodename); /* Fetch the node */ *************** *** 3482,3486 **** else { ! printf ("***ERROR: Invalid SOURCE Tag.\n"); return (ISNS_MSG_FMT_ERR); } --- 3482,3486 ---- else { ! __LOG_ERROR ("***ERROR: Invalid SOURCE Tag."); return (ISNS_MSG_FMT_ERR); } *************** *** 3521,3525 **** else { ! DEBUG_0(isns_query_debug & 1, (ISNSTouchEntity(): Not implemented)); return (ERROR); } --- 3521,3525 ---- else { ! __DEBUG(isns_query_debug & 1, (ISNSTouchEntity(): Not implemented)); return (ERROR); } *************** *** 3575,3579 **** int rval; ! DEBUG_1 (isns_query_debug &1,(Check_Permission src_node_name=%s),src_attr->val.node_name.v); /* check if control node */ --- 3575,3579 ---- int rval; ! __DEBUG (isns_query_debug &1,(Check_Permission src_node_name=%s),src_attr->val.node_name.v); /* check if control node */ *************** *** 3597,3606 **** memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_query_debug &1, call Get_Active_DD_List); Get_Active_DD_List (&pnode->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } --- 3597,3606 ---- memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! __DEBUG (isns_query_debug &1, call Get_Active_DD_List); Get_Active_DD_List (&pnode->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! __DEBUG(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } *************** *** 3621,3625 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } --- 3621,3625 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! __DEBUG(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } *************** *** 3637,3641 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } --- 3637,3641 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! __DEBUG(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } *************** *** 3650,3659 **** memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_query_debug &1, Get_Active_DD_List); Get_Active_DD_List (&p_port->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } --- 3650,3659 ---- memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! __DEBUG (isns_query_debug &1, Get_Active_DD_List); Get_Active_DD_List (&p_port->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! __DEBUG(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } Index: iSNSList.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSList.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** iSNSList.c 16 Jan 2007 20:21:50 -0000 1.12 --- iSNSList.c 7 Aug 2007 14:41:47 -0000 1.13 *************** *** 148,153 **** plist->node_count = 0; ! DEBUG_1 (isns_list_debug &1,InitList list_id:%i,plist->list_id); ! DEBUG_1 (isns_list_debug &1,InitList node_count:%i,plist->node_count); return ( SUCCESS ); --- 148,153 ---- plist->node_count = 0; ! __DEBUG (isns_list_debug &1,InitList list_id:%i,plist->list_id); ! __DEBUG (isns_list_debug &1,InitList node_count:%i,plist->node_count); return ( SUCCESS ); *************** *** 162,166 **** ISNS_LIST_NODE pnode; ! DEBUG_1 (isns_list_debug &1,DeleteList list_id:%i,plist->list_id); while (!IsEmptyList(plist)) --- 162,166 ---- ISNS_LIST_NODE pnode; ! __DEBUG (isns_list_debug &1,DeleteList list_id:%i,plist->list_id); while (!IsEmptyList(plist)) *************** *** 196,200 **** ! DEBUG_0 (isns_list_debug &1,Remove Node); foundFlag = FALSE; --- 196,200 ---- ! __DEBUG (isns_list_debug &1,Remove Node); foundFlag = FALSE; *************** *** 204,208 **** while ( curr_node != NULL ) { ! DEBUG_2 (isns_list_debug &1, curr_node:%i pnode:%i,curr_node->index,pnode->index); if (curr_node->index == pnode->index ) { --- 204,208 ---- while ( curr_node != NULL ) { ! __DEBUG (isns_list_debug &1, curr_node:%i pnode:%i,curr_node->index,pnode->index); if (curr_node->index == pnode->index ) { *************** *** 215,227 **** if ( (curr_node == NULL) && (plist->node_count > 0) ) { ! DEBUG_1 (isns_list_debug &1,Remove Node FAILURE node_count:%i,plist->node_count); plist->node_count--; return ERROR; /* we should have found a node in this case */ } ! DEBUG_1 (isns_list_debug &1, Remove Node FoundFlag: %i,foundFlag); if ( foundFlag ) { ! DEBUG_0 (isns_list_debug &1, FoundFlag); /* read current node */ --- 215,227 ---- if ( (curr_node == NULL) && (plist->node_count > 0) ) { ! __DEBUG (isns_list_debug &1,Remove Node FAILURE node_count:%i,plist->node_count); plist->node_count--; return ERROR; /* we should have found a node in this case */ } ! __DEBUG (isns_list_debug &1, Remove Node FoundFlag: %i,foundFlag); if ( foundFlag ) { ! __DEBUG (isns_list_debug &1, FoundFlag); /* read current node */ *************** *** 332,336 **** /*update node_count*/ ! DEBUG_1 (isns_list_debug &1, RemoveNode - node_count:%i,plist->node_count); plist->node_count--; } --- 332,336 ---- /*update node_count*/ ! __DEBUG (isns_list_debug &1, RemoveNode - node_count:%i,plist->node_count); plist->node_count--; } *************** *** 345,349 **** GetNodeData(ISNS_LIST_NODE *pnode ) { ! DEBUG_0 (isns_list_debug &1, GetNodeData); return ( pnode->data ); } --- 345,349 ---- GetNodeData(ISNS_LIST_NODE *pnode ) { ! __DEBUG (isns_list_debug &1, GetNodeData); return ( pnode->data ); } *************** *** 357,361 **** ISNS_LIST_NODE *ptr; ! DEBUG_0 (isns_list_debug &1,FindNode); ptr = NULL; --- 357,361 ---- ISNS_LIST_NODE *ptr; ! __DEBUG (isns_list_debug &1,FindNode); ptr = NULL; *************** *** 390,394 **** SOIP_Fc_Node *p_ifcp; ! DEBUG_1 (isns_list_debug &1, AddNode - list_id:%i,plist->list_id); memset(&key,0,sizeof(ISNS_DBKey)); --- 390,394 ---- SOIP_Fc_Node *p_ifcp; ! __DEBUG (isns_list_debug &1, AddNode - list_id:%i,plist->list_id); memset(&key,0,sizeof(ISNS_DBKey)); *************** *** 469,473 **** } ! DEBUG_0 (isns_list_debug &1, update last_index); plist->last_index++; --- 469,473 ---- } ! __DEBUG (isns_list_debug &1, update last_index); plist->last_index++; *************** *** 493,497 **** plist->node_count++; ! DEBUG_1 (isns_list_debug &1, AddNode node_count:%i,plist->node_count); return ( SUCCESS ); --- 493,497 ---- plist->node_count++; ! __DEBUG (isns_list_debug &1, AddNode node_count:%i,plist->node_count); return ( SUCCESS ); *************** *** 504,508 **** IsEmptyList(ISNS_LIST *plist) { ! DEBUG_1 (isns_list_debug &1,IsEmptyList node_count:%i,plist->node_count); if (plist->node_count == 0) --- 504,508 ---- IsEmptyList(ISNS_LIST *plist) { ! __DEBUG (isns_list_debug &1,IsEmptyList node_count:%i,plist->node_count); if (plist->node_count == 0) *************** *** 531,535 **** ISNS_LIST *p_list; ! DEBUG_2 (isns_list_debug &1,GetNextNode list_id:%i node_count:%i, plist->list_id,plist->node_count); if (!plist || plist->node_count == 0) --- 531,535 ---- ISNS_LIST *p_list; ! __DEBUG (isns_list_debug &1,GetNextNode list_id:%i node_count:%i, plist->list_id,plist->node_count); if (!plist || plist->node_count == 0) *************** *** 545,554 **** if ( pnode == NULL) { ! DEBUG_0 (isns_list_debug &1, AllocBuffer for first node); node = (ISNS_LIST_NODE *)ISNSAllocBuffer(sizeof(ISNS_LIST_NODE)); key.val.list.list_index = plist->first_index; if (key.val.list.list_index == 0 ) { ! DEBUG_0 (isns_list_debug &1,Error condition node count>0 but first_index is 0); plist->node_count = 0; return NULL; --- 545,554 ---- if ( pnode == NULL) { ! __DEBUG (isns_list_debug &1, AllocBuffer for first node); node = (ISNS_LIST_NODE *)ISNSAllocBuffer(sizeof(ISNS_LIST_NODE)); key.val.list.list_index = plist->first_index; if (key.val.list.list_index == 0 ) { ! __DEBUG (isns_list_debug &1,Error condition node count>0 but first_index is 0); plist->node_count = 0; return NULL; *************** *** 558,562 **** { node = pnode; ! DEBUG_1 (isns_list_debug &1, next_index:%i,node->next_index); key.val.list.list_index = node->next_index; } --- 558,562 ---- { node = pnode; ! __DEBUG (isns_list_debug &1, next_index:%i,node->next_index); key.val.list.list_index = node->next_index; } *************** *** 564,577 **** if (key.val.list.list_index == 0) { ! DEBUG_0 (isns_list_debug &1, No More Entries in list); return NULL; } ! DEBUG_0 (isns_list_debug &1,Now Read entry); if (plist->list_id == ENTITY_ISCSI_LIST) { p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! DEBUG_0 (isns_list_debug &1, read list entry); rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) --- 564,577 ---- if (key.val.list.list_index == 0) { ! __DEBUG (isns_list_debug &1, No More Entries in list); return NULL; } ! __DEBUG (isns_list_debug &1,Now Read entry); if (plist->list_id == ENTITY_ISCSI_LIST) { p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! __DEBUG (isns_list_debug &1, read list entry); rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) *************** *** 583,587 **** node->data = (char *)ISNSAllocBuffer(node->data_size+1); memcpy(node->data,entry.data.list.key.node_name.v,node->data_size); ! DEBUG_0 (isns_list_debug &1, Successfully read list entry); } else if (plist->list_id == ENTITY_FCP_LIST) --- 583,587 ---- node->data = (char *)ISNSAllocBuffer(node->data_size+1); memcpy(node->data,entry.data.list.key.node_name.v,node->data_size); ! __DEBUG (isns_list_debug &1, Successfully read list entry); } else if (plist->list_id == ENTITY_FCP_LIST) *************** *** 714,718 **** node->p_entry = plist->p_entry; ! DEBUG_0 (isns_list_debug &1, return GetNextNode node); return node; } --- 714,718 ---- node->p_entry = plist->p_entry; ! __DEBUG (isns_list_debug &1, return GetNextNode node); return node; } Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSesi.c 4 Jan 2007 19:00:07 -0000 1.10 --- iSNSesi.c 7 Aug 2007 14:41:47 -0000 1.11 *************** *** 80,84 **** ISNS_DBKey read_key = { 0 }; ! DEBUG_0 (isns_esi_debug &1, ISNS_SendESI); p_md = p_rspMd; --- 80,84 ---- ISNS_DBKey read_key = { 0 }; ! __DEBUG (isns_esi_debug &1, ISNS_SendESI); p_md = p_rspMd; *************** *** 90,94 **** } ! DEBUG_0 (isns_esi_debug &1, process each portal record); read_key.tag = PORTAL_ID_KEY; --- 90,94 ---- } ! __DEBUG (isns_esi_debug &1, process each portal record); read_key.tag = PORTAL_ID_KEY; *************** *** 96,100 **** while ( SNSdbGetNextOfKey (&read_key) == SUCCESS ) { ! DEBUG_0 (isns_esi_debug &1, Next Portal Record found); rval = ISNSdbRead(&read_key,&entry2); --- 96,100 ---- while ( SNSdbGetNextOfKey (&read_key) == SUCCESS ) { ! __DEBUG (isns_esi_debug &1, Next Portal Record found); rval = ISNSdbRead(&read_key,&entry2); *************** *** 107,111 **** if ( p_portal->esi_interval == 0 ) { ! DEBUG_0 (isns_esi_debug &1, esi_interval not set); continue; } --- 107,111 ---- if ( p_portal->esi_interval == 0 ) { ! __DEBUG (isns_esi_debug &1, esi_interval not set); continue; } *************** *** 115,122 **** if (p_portal->esi_timer > 0 && (p_portal->esi_timer + p_portal->esi_interval) > mytime) { ! DEBUG_0 (isns_esi_debug &1, esi_timer plus interval not reached yet); ! DEBUG_1 (isns_esi_debug &1, esi_timer:%ld,p_portal->esi_timer); ! DEBUG_1 (isns_esi_debug &1, esi_interval:%i,p_portal->esi_interval); ! DEBUG_1 (isns_esi_debug &1, mytime:%ld,mytime); continue; } --- 115,122 ---- if (p_portal->esi_timer > 0 && (p_portal->esi_timer + p_portal->esi_interval) > mytime) { ! __DEBUG (isns_esi_debug &1, esi_timer plus interval not reached yet); ! __DEBUG (isns_esi_debug &1, esi_timer:%ld,p_portal->esi_timer); ! __DEBUG (isns_esi_debug &1, esi_interval:%i,p_portal->esi_interval); ! __DEBUG (isns_esi_debug &1, mytime:%ld,mytime); continue; } *************** *** 126,134 **** rval = ISNSdbWrite(&read_key,entry2); ! DEBUG_1 (isns_esi_debug &1, esi_timer Timer Expired esiSend:%i,p_portal->esiSent); if ( p_portal->esiSent < esi_sent_limit ) { ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), p_portal->entity_id.id); /* Send a msg to the client & update the counter */ --- 126,134 ---- rval = ISNSdbWrite(&read_key,entry2); ! __DEBUG (isns_esi_debug &1, esi_timer Timer Expired esiSend:%i,p_portal->esiSent); if ( p_portal->esiSent < esi_sent_limit ) { ! __DEBUG (isns_esi_debug & 2, (Sending ESI to Entity %s), p_portal->entity_id.id); /* Send a msg to the client & update the counter */ *************** *** 162,166 **** } ! DEBUG_1 (isns_esi_debug & 2, (Call ISNSSendMsg to Send ESI to Entity %s), p_portal->entity_id.id); rval = ISNSSendMsg ( p_md ); } --- 162,166 ---- } ! __DEBUG (isns_esi_debug & 2, (Call ISNSSendMsg to Send ESI to Entity %s), p_portal->entity_id.id); rval = ISNSSendMsg ( p_md ); } *************** *** 168,174 **** else { ! DEBUG_0 (isns_esi_debug &1,esi timed out - remove portal record); ! DEBUG_1 (isns_esi_debug &1,portal ip_addr:%s,inet_ntoa(*(struct in_addr *)(p_portal->ip_addr.v+12)) ); ! DEBUG_1 (isns_esi_debug &1,port:%i,p_portal->ip_port); /* remove portal */ --- 168,174 ---- else { ! __DEBUG (isns_esi_debug &1,esi timed out - remove portal record); ! __DEBUG (isns_esi_debug &1,portal ip_addr:%s,inet_ntoa(*(struct in_addr *)(p_portal->ip_addr.v+12)) ); ! __DEBUG (isns_esi_debug &1,port:%i,p_portal->ip_port); /* remove portal */ *************** *** 203,207 **** ISNS_DBKey update_key; ! DEBUG_0 (isns_esi_debug &1, ISNS_ProcessESI); ISNSParseMsg( &p_md->msg, attr_indx, key_indx, NULL ); --- 203,207 ---- ISNS_DBKey update_key; ! __DEBUG (isns_esi_debug &1, ISNS_ProcessESI); ISNSParseMsg( &p_md->msg, attr_indx, key_indx, NULL ); *************** *** 209,213 **** if (i == -1) { ! DEBUG_0 (isns_esi_debug & 1, (Entity ID tag not found in msg)); return ( ERROR ); } --- 209,213 ---- if (i == -1) { ! __DEBUG (isns_esi_debug & 1, (Entity ID tag not found in msg)); return ( ERROR ); } *************** *** 231,236 **** p_entity->timestamp.t_pad = 0; p_entity->timestamp.t_time = mytime; ! DEBUG_1 (isns_esi_debug &1,(Time in seconds since UTC 1/1/70: %ld),mytime); ! DEBUG_1 (isns_esi_debug &1,(UNIX time and date: %s),ctime(&mytime) ); /* Store Entry */ --- 231,236 ---- p_entity->timestamp.t_pad = 0; p_entity->timestamp.t_time = mytime; ! __DEBUG (isns_esi_debug &1,(Time in seconds since UTC 1/1/70: %ld),mytime); ! __DEBUG (isns_esi_debug &1,(UNIX time and date: %s),ctime(&mytime) ); /* Store Entry */ *************** *** 243,247 **** if ( i == -1 ) { ! DEBUG_0 (isns_esi_debug & 1, (Portal IP tag not found in msg)); return ( ERROR ); } --- 243,247 ---- if ( i == -1 ) { ! __DEBUG (isns_esi_debug & 1, (Portal IP tag not found in msg)); return ( ERROR ); } *************** *** 252,256 **** if (i == -1) { ! DEBUG_0 (isns_esi_debug & 1, (Portal PORT tag not found in msg)); return ( ERROR ); } --- 252,256 ---- if (i == -1) { ! __DEBUG (isns_esi_debug & 1, (Portal PORT tag not found in msg)); return ( ERROR ); } Index: iSNSipc.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSipc.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSipc.c 1 Dec 2006 15:35:17 -0000 1.4 --- iSNSipc.c 7 Aug 2007 14:41:47 -0000 1.5 *************** *** 40,43 **** --- 40,44 ---- #include "iSNSmsg.h" #include "iSNSipc.h" + #include "iSNSdebug.h" /* *************** *** 84,88 **** if (ipc_ep[ep_name].s < 0) { ! printf("Error: While calling socket.\n"); return (ERROR); } --- 85,89 ---- if (ipc_ep[ep_name].s < 0) { ! __LOG_ERROR ("Error: While calling socket."); return (ERROR); } *************** *** 91,95 **** sizeof (my_addr)) < 0) { ! printf ("Fatal Error while Binding.\n"); return (0); } --- 92,96 ---- sizeof (my_addr)) < 0) { ! __LOG_ERROR ("Fatal Error while Binding."); return (0); } *************** *** 130,134 **** if (cnt < 0) { ! printf("Error: sendto.\n"); exit(1); } --- 131,135 ---- if (cnt < 0) { ! __LOG_ERROR ("Error: sendto."); exit(1); } *************** *** 170,174 **** if (cnt < 0) { ! printf("Receive error.\n"); exit(1); } --- 171,175 ---- if (cnt < 0) { ! __LOG_ERROR ("Receive error."); exit(1); } Index: iSNSrcv.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSrcv.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSrcv.c 8 Dec 2006 20:05:50 -0000 1.3 --- iSNSrcv.c 7 Aug 2007 14:41:47 -0000 1.4 *************** *** 47,50 **** --- 47,53 ---- #include "iSNSdebug.h" + + extern int isns_main_debug; + int sns_recv_debug = 0; int sns_recv_msg_filter = 0; *************** *** 102,106 **** memset((char *)&frag_md, 0, sizeof(ISNS_Msg_Descp)); ! printf("Starting SNSReceiveMain thread.\n"); /* * Wait for a message to arrive on the socket. --- 105,109 ---- memset((char *)&frag_md, 0, sizeof(ISNS_Msg_Descp)); ! __DEBUG (isns_main_debug & 1, "Starting SNSReceiveMain thread."); /* * Wait for a message to arrive on the socket. *************** *** 128,132 **** /* got another while waiting: drop previous message */ sns_recv_num_dropped++; ! printf("dropped frame %d\n", sns_recv_num_dropped); awaiting_fragment = 0; frag_len = 0; --- 131,135 ---- /* got another while waiting: drop previous message */ sns_recv_num_dropped++; ! __LOG_ERROR("dropped frame %d", sns_recv_num_dropped); awaiting_fragment = 0; frag_len = 0; *************** *** 145,149 **** sns_recv_num_dropped++; ! printf("dropped frame %d\n", sns_recv_num_dropped); awaiting_fragment = 0; frag_len = 0; --- 148,152 ---- sns_recv_num_dropped++; ! __LOG_ERROR("dropped frame %d", sns_recv_num_dropped); awaiting_fragment = 0; frag_len = 0; *************** *** 181,187 **** * SNS_VERSION, p_msg->hdr.version, 0); */ ! printf("NOTE: Newer version (v %d) of iSNS detected in the", p_msg->hdr.version); ! printf("network. Current version is v %d.\n", (int)SNS_VERSION); first_warn = FALSE; --- 184,190 ---- * SNS_VERSION, p_msg->hdr.version, 0); */ ! __LOG_WARNING("NOTE: Newer version (v %d) of iSNS detected in the", p_msg->hdr.version); ! __LOG_WARNING("network. Current version is v %d.", (int)SNS_VERSION); first_warn = FALSE; *************** *** 193,197 **** IPC_MSG_PRI_HI) == ERROR) { ! printf ("%s %d: Error forwarding fsm message (xid %d)\n", __FILE__, __LINE__, p_msg->hdr.xid); } --- 196,200 ---- IPC_MSG_PRI_HI) == ERROR) { ! __LOG_ERROR ("%s %d: Error forwarding fsm message (xid %d)", __FILE__, __LINE__, p_msg->hdr.xid); } *************** *** 203,207 **** p_msg->hdr.msg_len, 0) == ERROR) { ! printf ("%s %d: Error forwarding res message (xid %d)\n", __FILE__, __LINE__, p_msg->hdr.xid); } --- 206,210 ---- p_msg->hdr.msg_len, 0) == ERROR) { ! __LOG_ERROR ("%s %d: Error forwarding res message (xid %d)", __FILE__, __LINE__, p_msg->hdr.xid); } *************** *** 210,214 **** sns_recv_num_cli_fwd++; sns_recv_num_dropped++; ! printf("dropped frame %d\n", sns_recv_num_dropped); } } --- 213,217 ---- sns_recv_num_cli_fwd++; sns_recv_num_dropped++; ! __LOG_ERROR("dropped frame %d", sns_recv_num_dropped); } } *************** *** 219,223 **** p_msg->hdr.msg_len, 0) == ERROR) { ! printf ("%s %d: Error forwarding op message (xid %d)\n", __FILE__, __LINE__, p_msg->hdr.xid); } --- 222,226 ---- p_msg->hdr.msg_len, 0) == ERROR) { ! __LOG_ERROR ("%s %d: Error forwarding op message (xid %d)", __FILE__, __LINE__, p_msg->hdr.xid); } *************** *** 225,234 **** { sns_recv_num_dropped++; ! printf("dropped frame %d\n", sns_recv_num_dropped); } } else { ! printf ("%s %d: Socket Error\n", __FILE__, __LINE__); taskDelay(1*sysClkRateGet()); } --- 228,237 ---- { sns_recv_num_dropped++; ! __LOG_ERROR("dropped frame %d", sns_recv_num_dropped); } } else { ! __LOG_ERROR ("Socket Error"); taskDelay(1*sysClkRateGet()); } *************** *** 252,257 **** display_debug = (p_md->msg.hdr.type == sns_recv_msg_filter); ! DEBUG_4 (display_debug, (recv msg %d, len %d, xid %d from %s), ! p_md->msg.hdr.type, p_md->msg.hdr.msg_len, p_md->msg.hdr.xid, dot_not_addr); --- 255,259 ---- display_debug = (p_md->msg.hdr.type == sns_recv_msg_filter); ! __DEBUG (display_debug, "recv msg %d, len %d, xid %d from %s", p_md->msg.hdr.type, p_md->msg.hdr.msg_len, p_md->msg.hdr.xid, dot_not_addr); *************** *** 280,301 **** int ii, jj; ! printf("SNSReceiveMain num dropped %d\n", sns_recv_num_dropped); ! printf("SNSReceiveMain num pri res %d\n", sns_recv_num_pri_res); ! printf("SNSReceiveMain num cli fwd %d\n", sns_recv_num_cli_fwd); ! printf("Msgs received:\n"); if ((num_display < 0) || (num_display > ARRAY_DEPTH)) num_display = ARRAY_DEPTH; for (ii = 0; ii < num_display; ii++) { ! printf("time %08x, src %08x\n", sns_recv_msg_array[ii][0], sns_recv_msg_array[ii][1]); for (jj = 0; jj < ARRAY_WIDTH; jj++) { ! printf("%08x ", sns_recv_msg_array[ii][2 + jj]); if (jj == 7) ! printf("\n\t"); } - printf("\n"); } } --- 282,302 ---- int ii, jj; ! __LOG_INFO("SNSReceiveMain num dropped %d", sns_recv_num_dropped); ! __LOG_INFO("SNSReceiveMain num pri res %d", sns_r... [truncated message content] |
From: Robert W. <wrw...@us...> - 2007-08-07 14:41:53
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17288 Modified Files: Makefile Log Message: Add logging system Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 5 Feb 2007 19:29:17 -0000 1.9 --- Makefile 7 Aug 2007 14:41:47 -0000 1.10 *************** *** 44,48 **** OBJECTS += iSNSMain.o OBJECTS += iSNScomm.o - OBJECTS += iSNShash.o OBJECTS += iSNSparse.o #OBJECTS += iSNStbl.o --- 44,47 ---- *************** *** 89,95 **** $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ - iSNShash.o : $(SRCDIR)iSNShash.c - $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ - iSNSparse.o : $(SRCDIR)iSNSparse.c $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ --- 88,91 ---- |
From: Robert W. <wrw...@us...> - 2007-08-07 14:41:51
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17288/include Modified Files: iSNSdebug.h Log Message: Add logging system Index: iSNSdebug.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdebug.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSdebug.h 2 Apr 2002 20:56:54 -0000 1.2 --- iSNSdebug.h 7 Aug 2007 14:41:47 -0000 1.3 *************** *** 41,44 **** --- 41,46 ---- #define _SNSdebug_h_ + #include <syslog.h> + #define LO_DETAIL 1 #define HI_DETAIL 2 *************** *** 78,81 **** --- 80,85 ---- extern char sns_errmsg[]; + extern int daemon_state; + /* * Function declaration. *************** *** 90,94 **** void ISNSDisplayMsg (ISNS_Msg *msg); void ISNSDisplay_Hdr_Info (ISNS_Msg *msg); - /* void ISNSDisplay_DbData (SOIP_DB_Entry *entry, ISNS_Devi_Key *key_type, int level); */ void ISNSDisplay_DbData(ISNS_Key *p_key, SOIP_DB_Entry *p_entry, int detail); void ISNSDisplay_Port_Name (SOIP_Port_Name *p_port, char *p_name); --- 94,97 ---- *************** *** 105,109 **** void ISNSDisplay_Zone_Tag (SOIP_Zone *p_zone); void ISNSDisplay_Zone_Priority (uint32_t *zone_priority); - /* void ISNSDisplay_RSCN_List (SOIP_RSCN_List *p_rscn); */ void ISNSDisplay_Zone (uint32_t *zone_tag); void ISNSDisplay_HardAddr (SOIP_Hard_Addr *hard_addr); --- 108,111 ---- *************** *** 121,162 **** void ParsePDU (char *buffer); - #ifdef SNS_LOG_ENABLED - typedef unsigned int u32; - extern void sys_error_log(u32 errCode, char *msg, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6); - #define SNS_FATAL(ec, msg, p1) sys_error_log(ERR_MODULE_SNS|ec, msg, p1,0,0,0,0,0) - #define SNS_WARN(ec, msg, p1, p2, p3) sys_error_log(ERR_MODULE_SNS|ec, msg, p1, p2, p3, 0, 0, 0) - #else - #define SNS_FATAL(ec, msg, p1) printf("SNS_FATAL: %s", msg); - #define SNS_WARN(ec, msg, p1, p2, p3) printf("SNS_WARN: (%d %d %d) %s", p1, p2, p3, msg); - #endif - #ifdef SNS_DEBUG ! /* debugs for 1 to 4 parameters */ ! #define DEBUG_0(level, format) ((level) ? printf ("%s %d " #format "\n", __FILE__, __LINE__): 0) ! #define DEBUG_1(level, format, arg1) ((level) ? printf ("%s %d " #format "\n", __FILE__, __LINE__, (arg1)): 0) ! #define DEBUG_2(level, format, arg1, arg2) ((level) ? printf ("%s %d " #format "\n", __FILE__, __LINE__, (arg1), (arg2)): 0) ! #define DEBUG_3(level, format, arg1, arg2, arg3) ((level) ? printf ("%s %d " #format "\n", __FILE__, __LINE__, (arg1), (arg2), (arg3)): 0) ! #define DEBUG_4(level, format, arg1, arg2, arg3, arg4) ((level) ? printf ("%s %d " #format "\n", __FILE__, __LINE__, (arg1), (arg2), (arg3), (arg4)): 0) #else ! #define DEBUG_0(level, format) ! #define DEBUG_1(level, format, arg1) ! #define DEBUG_2(level, format, arg1, arg2) ! #define DEBUG_3(level, format, arg1, arg2, arg3) ! #define DEBUG_4(level, format, arg1, arg2, arg3, arg4) #endif ! #ifdef SNS_DEBUG ! /* debug display by function calls */ ! ! #define DEBUG_DISPLAY(level, func) ((level) ? (*func) ():0) ! #define DEBUG_DISPLAY_1(level, func, arg1) ((level) ? (*func) ((arg1)):0) ! #define DEBUG_DISPLAY_2(level, func, arg1, arg2) ((level) ? (*func) ((arg1), (arg2)):0) ! #endif #endif --- 123,142 ---- void ParsePDU (char *buffer); #ifdef SNS_DEBUG ! #define __DEBUG(level, format, ...) ((level) ? isns_log(LOG_DEBUG,"%s:%d\t" #format "\n", __FILE__,__LINE__, ##__VA_ARGS__ ) : 0) #else ! #define __DEBUG(level, format, ...) #endif ! #define __LOG_INFO(format, ...) isns_log(LOG_INFO,"%s:%d\t" format "\n", __FILE__,__LINE__,##__VA_ARGS__) ! #define __LOG_ERROR(format, ...) isns_log(LOG_ERR,"%s:%d\t" format "\n", __FILE__,__LINE__,##__VA_ARGS__) ! #define __LOG_WARNING(format, ...) isns_log(LOG_WARNING,"%s:%d\t" format "\n", __FILE__,__LINE__,##__VA_ARGS__) ! void isns_log(int level, char *format, ...); #endif |
From: Robert W. <wrw...@us...> - 2007-06-28 19:46:37
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17422/isnsserver/src Modified Files: iSNSUtil.c Log Message: Fixed Array above bounds error Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** iSNSUtil.c 31 May 2007 21:16:36 -0000 1.15 --- iSNSUtil.c 28 Jun 2007 19:46:08 -0000 1.16 *************** *** 224,228 **** ISNSDisplay_IPAddress ( IP_Address *ip_addr ) { ! char ip_saddr[INET_ADDR_LEN]; struct in_addr i_addr; --- 224,228 ---- ISNSDisplay_IPAddress ( IP_Address *ip_addr ) { ! char ip_saddr[INET_ADDR_LEN+1]; struct in_addr i_addr; |
From: Robert W. <wrw...@us...> - 2007-05-31 21:16:41
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32564/src Modified Files: iSNSUtil.c iSNSdb.c iSNSparse.c iSNSquery.c iSNSreg.c Log Message: Add Better Support for Portal Groups Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** iSNSparse.c 4 Jan 2007 19:00:07 -0000 1.18 --- iSNSparse.c 31 May 2007 21:16:36 -0000 1.19 *************** *** 190,193 **** --- 190,194 ---- case ISNS_IFCP_SCN_BITMAP: case ISNS_DD_FEATURE_BITMAP: + case ISNS_PORTAL_GROUP: case ISNS_PORTAL_GROUP_TAG: case ISNS_PORTAL_SECURITY_BITMAP: *************** *** 445,448 **** --- 446,450 ---- case ISNS_PORTAL_GROUP_PORT: case ISNS_PORTAL_GROUP_TAG: + case ISNS_PORTAL_GROUP: if (pattr->len != 0) { Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** iSNSreg.c 30 Mar 2007 22:56:14 -0000 1.25 --- iSNSreg.c 31 May 2007 21:16:36 -0000 1.26 *************** *** 685,689 **** ISNS_Key *key = NULL; ISNS_Attr *attr = NULL; ! SOIP_Portal_Group *p_portal_group; SOIP_Portal_Group_Key db_portal_group; int ii; --- 685,689 ---- ISNS_Key *key = NULL; ISNS_Attr *attr = NULL; ! SOIP_Portal_Group *p_portal_group = NULL; SOIP_Portal_Group_Key db_portal_group; int ii; *************** *** 694,709 **** int saveIndex; int stopFlag = FALSE; ! int newPortalRegFlag; ! int updateFlag; ! //char *p_iscsi_name; ! ISNS_DBKey read_key; DEBUG_0 (isns_reg_debug & 1, (Registering Portal Group)); ! newPortalRegFlag = FALSE; portalPortIndex = -1; portalIpIndex = -1; iscsiIndex = -1; for (ii = 0; ii < SNS_MAX_ATTRS && key_indx[ ii ] && (portalIpIndex == -1 || portalPortIndex == -1 || iscsiIndex == -1); ii++) --- 694,710 ---- int saveIndex; int stopFlag = FALSE; ! int portal_tag = 1; ! int newPortalGroupRegFlag; ! ISNS_DBKey read_key; DEBUG_0 (isns_reg_debug & 1, (Registering Portal Group)); ! newPortalGroupRegFlag = FALSE; portalPortIndex = -1; portalIpIndex = -1; iscsiIndex = -1; + memset(&db_portal_group,0,sizeof(SOIP_Portal_Group_Key)); + for (ii = 0; ii < SNS_MAX_ATTRS && key_indx[ ii ] && (portalIpIndex == -1 || portalPortIndex == -1 || iscsiIndex == -1); ii++) *************** *** 747,756 **** { /* No keys */ ! newPortalRegFlag = TRUE; } else if (portalIpIndex == -1 || portalPortIndex == -1) { /* One or the other key */ ! DEBUG_0 (isns_reg_debug & 1, (Portal Reg: Missing keys)); return ( ISNS_INVALID_REG_ERR ); } --- 748,757 ---- { /* No keys */ ! newPortalGroupRegFlag = TRUE; } else if (portalIpIndex == -1 || portalPortIndex == -1) { /* One or the other key */ ! DEBUG_0 (isns_reg_debug & 1, (Portal Reg: Missing keys in Key Attributes)); return ( ISNS_INVALID_REG_ERR ); } *************** *** 760,764 **** while ( saveIndex < SNS_MAX_ATTRS ) { ! if ( newPortalRegFlag ) { /* Search for the tag portal IP and portal PORT. */ --- 761,765 ---- while ( saveIndex < SNS_MAX_ATTRS ) { ! if ( newPortalGroupRegFlag ) { /* Search for the tag portal IP and portal PORT. */ *************** *** 767,772 **** portalPortIndex = -1; ! for ( ii = saveIndex; ii < SNS_MAX_ATTRS && attr_indx[ii] ! && (portalIpIndex == -1 || portalPortIndex == -1 || iscsiIndex == -1); ii++ ) { attr = (ISNS_Attr *) attr_indx[ ii ]; --- 768,773 ---- portalPortIndex = -1; ! stopFlag=FALSE; ! for (ii=saveIndex; (ii<SNS_MAX_ATTRS) && attr_indx[ii] && !stopFlag; ii++) { attr = (ISNS_Attr *) attr_indx[ ii ]; *************** *** 776,802 **** /* Check to see if we already had an IP */ if (portalIpIndex != -1) ! { ! DEBUG_0 (isns_reg_debug & 1, (PORTAL_IP tag found twice)); ! return ( ISNS_INVALID_REG_ERR ); ! } ! portalIpIndex = ii; break; case ISNS_PORTAL_PORT: /* Check to see if we already had a PORT */ if (portalPortIndex != -1) ! { ! DEBUG_0 (isns_reg_debug & 1, (PORTAL_PORT tag found twice)); ! return ( ISNS_INVALID_REG_ERR ); ! } ! portalPortIndex = ii; break; case ISNS_ISCSI_NODE_ID: - /* Check to see if we already had an iscsi name */ if (iscsiIndex != -1) ! { ! DEBUG_0 (isns_reg_debug & 1, (ISCSI Node tag found twice)); ! return ( ISNS_INVALID_REG_ERR ); ! } ! iscsiIndex = ii; break; default: --- 777,801 ---- /* Check to see if we already had an IP */ if (portalIpIndex != -1) ! stopFlag=TRUE; ! else ! portalIpIndex = ii; break; case ISNS_PORTAL_PORT: /* Check to see if we already had a PORT */ if (portalPortIndex != -1) ! stopFlag=TRUE; ! else ! portalPortIndex = ii; break; case ISNS_ISCSI_NODE_ID: if (iscsiIndex != -1) ! stopFlag=TRUE; ! else ! iscsiIndex = ii; ! break; ! case ISNS_PORTAL_GROUP: ! case ISNS_PORTAL_GROUP_TAG: ! portal_tag = attr->val.portal_group; ! DEBUG_1 (isns_reg_debug &1,(Portal Group tag:%i),portal_tag); break; default: *************** *** 808,812 **** if ( portalIpIndex == -1 || portalPortIndex == -1 || iscsiIndex == -1) { ! DEBUG_0 (isns_reg_debug & 1, (PORTAL REG, MISSING KEYS)); return ( ISNS_INVALID_REG_ERR ); } --- 807,811 ---- if ( portalIpIndex == -1 || portalPortIndex == -1 || iscsiIndex == -1) { ! DEBUG_0 (isns_reg_debug & 1, (Portal Group Registration, MISSING KEYS)); return ( ISNS_INVALID_REG_ERR ); } *************** *** 814,825 **** attr = (ISNS_Attr *) attr_indx[ portalPortIndex ]; db_portal_group.ip_port = attr->val.ip_port; ! DEBUG_1 (isns_reg_debug &1,(Portal ip_port:%i),attr->val.ip_port); attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; memcpy ( (char *) db_portal_group.ip_addr.v, &attr->val, ISNS_PORTAL_IP_SIZE ); attr = (ISNS_Attr *) attr_indx[ iscsiIndex ]; ! memcpy ( (char *) db_portal_group.id.v, &attr->val, MAX_ISCSI_NODE_ID_SIZE); saveIndex = ii; --- 813,826 ---- attr = (ISNS_Attr *) attr_indx[ portalPortIndex ]; db_portal_group.ip_port = attr->val.ip_port; ! DEBUG_1 (isns_reg_debug &1,(Portal Group ip_port:%i),attr->val.ip_port); attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; memcpy ( (char *) db_portal_group.ip_addr.v, &attr->val, ISNS_PORTAL_IP_SIZE ); + DEBUG_1 (isns_reg_debug &1,(Portal Group ip_addr:%s),db_portal_group.ip_addr.v); attr = (ISNS_Attr *) attr_indx[ iscsiIndex ]; ! memcpy ( (char *) db_portal_group.id.v, &attr->val, attr->len); ! DEBUG_1 (isns_reg_debug &1,(Portal Group iscsi_name:%s),db_portal_group.id.v); saveIndex = ii; *************** *** 830,851 **** key = (ISNS_Key *) key_indx[ portalPortIndex ]; db_portal_group.ip_port = key->val.ip_port; ! DEBUG_1 (isns_reg_debug &1,(Portal ip_port:%i),key->val.ip_port); key = (ISNS_Key *) key_indx[ portalIpIndex ]; ! memcpy ( (char *) db_portal_group.ip_addr.v, &key->val, ! key->len ); DEBUG_1 (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); attr = (ISNS_Attr *) key_indx[ iscsiIndex ]; ! memcpy ( (char *) db_portal_group.id.v, &attr->val,MAX_ISCSI_NODE_ID_SIZE); saveIndex = 0; } ! DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal_group.ip_addr.v); read_key.tag = PORTAL_GROUP_ID_KEY; memcpy(&read_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbRead(&read_key,&entry2); p_portal_group = &entry2.data.portal_group; --- 831,874 ---- key = (ISNS_Key *) key_indx[ portalPortIndex ]; db_portal_group.ip_port = key->val.ip_port; ! DEBUG_1 (isns_reg_debug &1,(Portal Group ip_port:%i),key->val.ip_port); key = (ISNS_Key *) key_indx[ portalIpIndex ]; ! memcpy ( (char *) db_portal_group.ip_addr.v, &key->val, key->len); DEBUG_1 (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); attr = (ISNS_Attr *) key_indx[ iscsiIndex ]; ! memcpy ( (char *) db_portal_group.id.v, &attr->val, attr->len); ! DEBUG_1 (isns_reg_debug &1,(Portal Group iscsi_name:%s),db_portal_group.id.v); saveIndex = 0; + + /* Find portal_tag value */ + stopFlag = FALSE; + for ( ii = 0; (ii < SNS_MAX_ATTRS) && attr_indx[ii] && !stopFlag; ii++ ) + { + attr = (ISNS_Attr *) attr_indx[ ii ]; + switch ( attr->tag ) + { + case ISNS_PORTAL_GROUP: + case ISNS_PORTAL_GROUP_TAG: + portal_tag = attr->val.portal_group; + DEBUG_1 (isns_reg_debug &1,Portal Group tag:%i,p_portal_group->portal_tag); + stopFlag = TRUE; + break; + default: + break; + } + + if (stopFlag) + break; + } } ! DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal_group.id.v); read_key.tag = PORTAL_GROUP_ID_KEY; memcpy(&read_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbRead(&read_key,&entry2); + DEBUG_1 (isns_reg_debug & 1, Read PortalGroup for DB status:%i,rval); p_portal_group = &entry2.data.portal_group; *************** *** 861,873 **** if ( rval != SUCCESS ) { ! DEBUG_0 (isns_reg_debug &1,create new portal entry); ! ! if ( FALSE == newPortalRegFlag ) ! { ! DEBUG_0 (isns_reg_debug & 1, (Unable to retrieve portal entry)); ! return ( ISNS_INVALID_REG_ERR ); ! } - /* create a new node element */ memset (&entry2, 0, sizeof (SOIP_DB_Entry)); entry2.data_type = PORTAL_GROUP_ID_KEY; --- 884,889 ---- if ( rval != SUCCESS ) { ! DEBUG_0 (isns_reg_debug &1,create new portal group entry); memset (&entry2, 0, sizeof (SOIP_DB_Entry)); entry2.data_type = PORTAL_GROUP_ID_KEY; *************** *** 882,929 **** memcpy (p_portal_group->id.v, attr->val.node_name.v, attr->len); ! newPortalRegFlag = TRUE; } - else - - stopFlag = FALSE; - updateFlag = FALSE; - memset(p_scn_all_msg_buffer, 0, sizeof(ISNS_Msg)); - for ( ii = saveIndex; (ii < SNS_MAX_ATTRS) && (attr_indx[ ii ]); ii++ ) - { - attr = (ISNS_Attr *) attr_indx[ ii ]; - switch ( attr->tag ) - { - case ISNS_PORTAL_IP: - case ISNS_PORTAL_PORT: - saveIndex = ii; - stopFlag = TRUE; - break; - case ISNS_ISCSI_NODE_ID: - { - ISNSAppendKey( p_scn_all_msg_buffer, ISNS_ISCSI_NODE_ID, - PAD4(strlen(p_portal_group->id.v)), p_portal_group->id.v,0); - - updateFlag = TRUE; - } - break; - default: - break; - } ! if (stopFlag) ! break; ! } ! /* Store the portal */ ! DEBUG_1 (isns_reg_debug &1,Store Portal Group:%s,db_portal_group.ip_addr.v); ISNS_DBKey update_key; update_key.tag = PORTAL_GROUP_ID_KEY; memcpy(&update_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbWrite(&update_key,entry2); ! if ( newPortalRegFlag ) iSNS_stats.num_portal_groups++; - /* insert the key(s) */ if (p_rspmsg != NULL) { --- 898,919 ---- memcpy (p_portal_group->id.v, attr->val.node_name.v, attr->len); ! newPortalGroupRegFlag = TRUE; } ! p_portal_group->portal_tag = portal_tag; ! DEBUG_1 (isns_reg_debug &1,Store Portal Group:%s,db_portal_group.id.v); ISNS_DBKey update_key; update_key.tag = PORTAL_GROUP_ID_KEY; memcpy(&update_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); rval = ISNSdbWrite(&update_key,entry2); + DEBUG_1 (isns_reg_debug & 1, Write PortalGroup for DB status:%i,rval); ! rval = ISNSdbRead(&read_key,&entry2); ! DEBUG_1 (isns_reg_debug & 1, Read PortalGroup for DB status:%i,rval); ! ! if ( newPortalGroupRegFlag ) iSNS_stats.num_portal_groups++; if (p_rspmsg != NULL) { *************** *** 941,945 **** attr = (ISNS_Attr *)(attr_indx[saveIndex]); ! if (!newPortalRegFlag) break; --- 931,935 ---- attr = (ISNS_Attr *)(attr_indx[saveIndex]); ! if (!newPortalGroupRegFlag) break; *************** *** 947,951 **** break; ! newPortalRegFlag = TRUE; if ((attr->tag == ISNS_PORTAL_IP) || (attr->tag == ISNS_PORTAL_PORT)) continue; --- 937,941 ---- break; ! newPortalGroupRegFlag = FALSE; if ((attr->tag == ISNS_PORTAL_IP) || (attr->tag == ISNS_PORTAL_PORT)) continue; Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** iSNSdb.c 29 Dec 2006 20:40:17 -0000 1.26 --- iSNSdb.c 31 May 2007 21:16:36 -0000 1.27 *************** *** 228,233 **** SOIP_Portal_Group_Key db_portal; memcpy(&db_portal,&key->val,sizeof(SOIP_Portal_Group_Key)); ! DEBUG_2 (isns_db_debug &1,read Portal Group ip_addr:%s port:%i, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); k.dptr = (char *)&key->val; --- 228,235 ---- SOIP_Portal_Group_Key db_portal; memcpy(&db_portal,&key->val,sizeof(SOIP_Portal_Group_Key)); ! DEBUG_3 (isns_db_debug &1,read Portal Group name:%s ip_addr:%s port:%i, ! db_portal.id.v, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)), ! db_portal.ip_port); k.dptr = (char *)&key->val; *************** *** 236,241 **** if (d.dptr == NULL) { ! DEBUG_2 (isns_db_debug &1,read Portal Group ip_addr:%s port:%i, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); return (ISNS_NO_SUCH_ENTRY_ERR); } --- 238,245 ---- if (d.dptr == NULL) { ! DEBUG_3 (isns_db_debug &1,read Portal Group name:%s ip_addr:%s port:%i, ! db_portal.id.v, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)), ! db_portal.ip_port); return (ISNS_NO_SUCH_ENTRY_ERR); } *************** *** 396,399 **** --- 400,404 ---- break; case PORTAL_GROUP_ID_KEY: + DEBUG_0 (isns_db_debug &1,PORTAL Group Write); k.dptr = (char *)&key->val; k.dsize = sizeof(SOIP_Portal_Group_Key); *************** *** 531,534 **** --- 536,540 ---- break; case PORTAL_GROUP_ID_KEY: + DEBUG_0 (isns_db_debug &1,PORTAL Group Delete); k.dptr = (char *)&key->val; k.dsize = sizeof(SOIP_Portal_Group_Key); Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** iSNSquery.c 30 Mar 2007 22:56:14 -0000 1.21 --- iSNSquery.c 31 May 2007 21:16:36 -0000 1.22 *************** *** 2718,2721 **** --- 2718,2723 ---- SOIP_Entity *p_entity; SOIP_Portal *p_portal; + SOIP_Portal_Group *p_portal_group = NULL; + SOIP_Portal_Group_Key key_portal_group; int rval; *************** *** 2862,2870 **** { DEBUG_0 (isns_query_debug &1, (fetchPortalFlag)); ! /* Cycle through all portal */ pnode = NULL; while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) { ! DEBUG_0 (isns_query_debug &1, get portal); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; --- 2864,2872 ---- { DEBUG_0 (isns_query_debug &1, (fetchPortalFlag)); ! /* Cycle through all portals */ pnode = NULL; while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) { ! DEBUG_0 (isns_query_debug &1, Get portal record ); ISNS_DBKey read_key; read_key.tag = PORTAL_ID_KEY; *************** *** 2872,2879 **** --- 2874,2902 ---- rval = ISNSdbRead(&read_key,&entry5); if (rval != SUCCESS ) + { + DEBUG_0 (isns_query_debug &1, portal record not found ); return rval; + } p_portal = &entry5.data.portal; + DEBUG_0 (isns_query_debug &1, Get portal group record ); + memset(&key_portal_group, 0, sizeof(SOIP_Portal_Group_Key)); + key_portal_group.ip_port = p_portal->ip_port; + memcpy(key_portal_group.ip_addr.v,p_portal->ip_addr.v,ISNS_PORTAL_IP_SIZE); + memcpy(key_portal_group.id.v,p_node->id.v,strlen(p_node->id.v)); + + ISNS_DBKey read_group_key; + read_group_key.tag = PORTAL_GROUP_ID_KEY; + memcpy(&read_group_key.val,&key_portal_group,sizeof(SOIP_Portal_Group_Key)); + rval = ISNSdbRead(&read_group_key,&entry4); + if (rval != SUCCESS ) + { + DEBUG_0 (isns_query_debug &1, portal group record not found ); + return rval; + } + + p_portal_group = &entry4.data.portal_group; + for (jj = 0; (jj < SNS_MAX_ATTRS) && (attr_indx[jj]); jj++) { *************** *** 2920,2929 **** DEBUG_1 (isns_query_debug &1,ISNS_PORTAL_GROUP_PORT:%i,p_portal->ip_port); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_GROUP_PORT_SIZE, ! NULL, p_portal->ip_port); break; case ISNS_PORTAL_GROUP_IP: DEBUG_0 (isns_query_debug &1,Add ISNS_PORTAL_GROUP_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_IP_SIZE, ! p_portal->ip_addr.v, 0); break; case ISNS_PORTAL_GROUP_ISCSI_NAME: --- 2943,2952 ---- DEBUG_1 (isns_query_debug &1,ISNS_PORTAL_GROUP_PORT:%i,p_portal->ip_port); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_GROUP_PORT_SIZE, ! NULL, p_portal_group->ip_port); break; case ISNS_PORTAL_GROUP_IP: DEBUG_0 (isns_query_debug &1,Add ISNS_PORTAL_GROUP_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_IP_SIZE, ! p_portal_group->ip_addr.v, 0); break; case ISNS_PORTAL_GROUP_ISCSI_NAME: *************** *** 2934,2938 **** case ISNS_PORTAL_GROUP_TAG: ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, ! NULL, 1); // hard code group 1 for now break; default: --- 2957,2961 ---- case ISNS_PORTAL_GROUP_TAG: ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, ! NULL, p_portal_group->portal_tag); break; default: *************** *** 3579,3584 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); ! return (ISNS_AUTH_FAILED_ERR); } } --- 3602,3607 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); ! return (ISNS_AUTH_FAILED_ERR); } } *************** *** 3598,3602 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_AUTH_FAILED_ERR); } --- 3621,3625 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); return (ISNS_AUTH_FAILED_ERR); } *************** *** 3614,3619 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR: Invalid DD"); ! return (ISNS_AUTH_FAILED_ERR); } } --- 3637,3642 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); ! return (ISNS_AUTH_FAILED_ERR); } } *************** *** 3632,3637 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); ! return (ISNS_AUTH_FAILED_ERR); } } --- 3655,3660 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1,"src attribute not found in a Discovery Domain"); ! return (ISNS_AUTH_FAILED_ERR); } } Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** iSNSUtil.c 4 Jan 2007 19:00:06 -0000 1.14 --- iSNSUtil.c 31 May 2007 21:16:36 -0000 1.15 *************** *** 758,764 **** if (level == LO_DETAIL) { ! printf( " %s %#08x, %#08x, %u\n", inet_ntoa(*(struct in_addr *)(p_portal->ip_addr.v+12)), ! p_portal->ip_port, p_portal->group, p_portal->portal_index); } else --- 758,764 ---- if (level == LO_DETAIL) { ! printf( " %s %#08x,%u\n", inet_ntoa(*(struct in_addr *)(p_portal->ip_addr.v+12)), ! p_portal->ip_port, p_portal->portal_index); } else *************** *** 772,776 **** pnode = NULL; printf("ENTITY : %s\n", p_portal->entity_id.id); - printf("GROUP : %#x\n", p_portal->group); printf("ESI INTERVAL : %u\n", p_portal->esi_interval); printf("ESI/SCN UDP PORT: %u\n", p_portal->esi_port); --- 772,775 ---- *************** *** 900,920 **** case ISNS_DDS_STATUS : return("Discovery Domain Set Status"); case ISNS_DD_ID : return("Discovery Domain ID"); ! case ISNS_DD_FEATURE_BITMAP : return("Discovery Domain Feature Bitmap"); case ISNS_DD_SYM_NAME : return("Discovery Domain Symbolic Name"); case ISNS_DD_ISCSI_MEMBER : return("Discovery Domain iSCSI Member"); case ISNS_DD_IFCP_MEMBER : return("Discovery Domain iFCP Member"); case ISNS_COMPANY_OUI : return("Company OUI"); ! case ISNS_ENTITY_IDX : return("Entity Index"); ! case ISNS_ISCSI_IDX : return("iSCSI Index"); ! case ISNS_PORTAL_IDX : return("Portal Index"); ! case ISNS_DD_ISCSI_MEMBER_IDX: return("Discovery Domain iSCSI Member Index"); ! case ISNS_DD_ACTIVE : return("Discovery Domain Active"); ! case ISNS_NODE_ACTIVE : return("Node Active"); ! case ISNS_SCN_PORT : return("SCN Port"); ! case ISNS_PORTAL_GROUP_TAG : return("Portal Group Tag"); ! 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 TCP/UDP Port"); ! case ISNS_PORTAL_SECURITY_BITMAP: return("Portal Security Bitmap"); default : return("Unknown TAG code"); } --- 899,920 ---- case ISNS_DDS_STATUS : return("Discovery Domain Set Status"); case ISNS_DD_ID : return("Discovery Domain ID"); ! case ISNS_DD_FEATURE_BITMAP : return("Discovery Domain Feature Bitmap"); case ISNS_DD_SYM_NAME : return("Discovery Domain Symbolic Name"); case ISNS_DD_ISCSI_MEMBER : return("Discovery Domain iSCSI Member"); case ISNS_DD_IFCP_MEMBER : return("Discovery Domain iFCP Member"); case ISNS_COMPANY_OUI : return("Company OUI"); ! case ISNS_ENTITY_IDX : return("Entity Index"); ! case ISNS_ISCSI_IDX : return("iSCSI Index"); ! case ISNS_PORTAL_IDX : return("Portal Index"); ! case ISNS_DD_ISCSI_MEMBER_IDX: return("Discovery Domain iSCSI Member Index"); ! case ISNS_DD_ACTIVE : return("Discovery Domain Active"); ! case ISNS_NODE_ACTIVE : return("Node Active"); ! case ISNS_SCN_PORT : return("SCN Port"); ! case ISNS_PORTAL_GROUP : return("Portal Group Tag (depreciated)"); ! case ISNS_PORTAL_GROUP_TAG : return("Portal Group Tag"); ! 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 TCP/UDP Port"); ! case ISNS_PORTAL_SECURITY_BITMAP: return("Portal Security Bitmap"); default : return("Unknown TAG code"); } |
From: Robert W. <wrw...@us...> - 2007-05-31 21:16:40
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32564/include Modified Files: iSNSdefs.h iSNStypes.h Log Message: Add Better Support for Portal Groups Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** iSNStypes.h 15 Mar 2007 22:28:30 -0000 1.14 --- iSNStypes.h 31 May 2007 21:16:36 -0000 1.15 *************** *** 544,548 **** void *ptr_cert; uint32_t cert_size; - uint32_t group; } SOIP_Portal; --- 544,547 ---- Index: iSNSdefs.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdefs.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** iSNSdefs.h 18 Dec 2006 23:00:04 -0000 1.8 --- iSNSdefs.h 31 May 2007 21:16:36 -0000 1.9 *************** *** 195,199 **** ISNS_ESI_INTERVAL, ISNS_ESI_PORT, ! /* ISNS_PORTAL_GROUP, -- tag removed from RFC spec */ ISNS_PORTAL_IDX=22, ISNS_SCN_PORT=23, --- 195,199 ---- ISNS_ESI_INTERVAL, ISNS_ESI_PORT, ! ISNS_PORTAL_GROUP, /* tag was removed from RFC spec */ ISNS_PORTAL_IDX=22, ISNS_SCN_PORT=23, |
From: Robert W. <wrw...@us...> - 2007-03-30 22:56:17
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30258/src Modified Files: iSNSquery.c iSNSreg.c Log Message: Fix Check_Permission logic Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** iSNSreg.c 15 Mar 2007 22:28:30 -0000 1.24 --- iSNSreg.c 30 Mar 2007 22:56:14 -0000 1.25 *************** *** 3555,3558 **** --- 3555,3560 ---- int ii; + DEBUG_1 (isns_reg_debug &1,(Append_DD_to_List id=%i),id); + for (ii = 0; ii < MAX_DD_PER_LIST; ii++) { Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** iSNSquery.c 6 Feb 2007 23:13:10 -0000 1.20 --- iSNSquery.c 30 Mar 2007 22:56:14 -0000 1.21 *************** *** 2618,2621 **** --- 2618,2622 ---- SOIP_Dd_Member *p_member; SOIP_DB_Entry lentry; + int index_Flag = -1; for (ii = 0; (ii < SNS_MAX_ATTRS) && (attr_indx[ii]); ii++) *************** *** 2669,2672 **** --- 2670,2680 ---- PAD4 (strlen (p_member->node_id)), p_member->node_id, 0); + + index_Flag = ISNSFindTag (0, ISNS_DD_ISCSI_MEMBER_IDX, attr_indx); + if (index_Flag != -1 ) + if (p_member->type == ISNS_DD_ISCSI_MEMBER) + ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, + ISNS_DD_ISCSI_MEMBER_IDX_SIZE, + NULL, p_member->node_idx); } break; *************** *** 2680,2690 **** ISNS_PORT_NAME_SIZE, p_member->node_id, 0); ! } ! break; ! case ISNS_DD_ISCSI_MEMBER_IDX: ! pnode=NULL; ! while ((pnode=GetNextNode(&p_dd->member_list, pnode))) ! { ! p_member=(SOIP_Dd_Member *)GetNodeData(pnode); if (p_member->type == ISNS_DD_ISCSI_MEMBER) ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, --- 2688,2693 ---- ISNS_PORT_NAME_SIZE, p_member->node_id, 0); ! index_Flag = ISNSFindTag (0, ISNS_DD_ISCSI_MEMBER_IDX, attr_indx); ! if (index_Flag != -1 ) if (p_member->type == ISNS_DD_ISCSI_MEMBER) ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, *************** *** 3403,3406 **** --- 3406,3411 ---- int rval; + DEBUG_1(isns_query_debug & 1, (Get_Active_DD_List_From_ISCSI_Node nodename=%s),nodename); + /* Fetch the node */ key.tag = ISCSI_ID_KEY; *************** *** 3524,3528 **** for (ii = 0; ii < MAX_DD_PER_LIST; ii++) { ! if (p_dlist_node[ii]==0) break; --- 3529,3533 ---- for (ii = 0; ii < MAX_DD_PER_LIST; ii++) { ! if (p_dlist_src[ii]==0) break; *************** *** 3547,3550 **** --- 3552,3557 ---- int rval; + DEBUG_1 (isns_query_debug &1,(Check_Permission src_node_name=%s),src_attr->val.node_name.v); + /* check if control node */ if ( 0 == strcmp (src_attr->val.node_name.v, isns_control_node) ) *************** *** 3567,3571 **** memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_query_debug &1, Get_Active_DD_List); Get_Active_DD_List (&pnode->dd_id_list, dlist_node, 0); --- 3574,3578 ---- memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_query_debug &1, call Get_Active_DD_List); Get_Active_DD_List (&pnode->dd_id_list, dlist_node, 0); |
From: Robert W. <wrw...@us...> - 2007-03-30 22:55:26
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29873/src Modified Files: iscsi.c main.c payloads.c Log Message: Add type to query command Index: payloads.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/payloads.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** payloads.c 7 Feb 2007 00:39:47 -0000 1.3 --- payloads.c 30 Mar 2007 22:55:22 -0000 1.4 *************** *** 98,101 **** --- 98,102 ---- ISNSAppendAttr (&cmd, ISNS_DD_SYM_NAME, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER, 0, NULL, 0); + ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER_IDX, 0, NULL, 0); } else *************** *** 105,108 **** --- 106,110 ---- ISNSAppendAttr (&cmd, ISNS_DD_SYM_NAME, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER, 0, NULL, 0); + ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER_IDX, 0, NULL, 0); } *************** *** 408,420 **** ********************************************/ void ! queryISCSI (void) { char buffer[2048]; ! ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, 0, NULL, 0); if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) --- 410,436 ---- ********************************************/ void ! queryISCSI (char * id) { char buffer[2048]; ! if (strlen(id) ) ! { ! ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_IDX, ISNS_INDEX_SIZE, NULL, atoi(id)); ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, 0, NULL, 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 0, NULL, 0); ! } ! else ! { ! ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); ! ! ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, 0, NULL, 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 0, NULL, 0); ! } if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) *************** *** 482,486 **** else if ( 0 == strcmp(command,"iscsi")) ! queryISCSI(); else if ( 0 == strcmp(command,"entity")) --- 498,502 ---- else if ( 0 == strcmp(command,"iscsi")) ! queryISCSI(id); else if ( 0 == strcmp(command,"entity")) Index: main.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** main.c 2 Feb 2007 23:21:38 -0000 1.4 --- main.c 30 Mar 2007 22:55:22 -0000 1.5 *************** *** 72,76 **** *****************/ char Usage[] = "\ ! Usage: isnsc [options] \n\ Options:\n\ -h Listen for L2 heartbeat from an iSNS.\n\ --- 72,76 ---- *****************/ char Usage[] = "\ ! Usage: isnsadm [options] \n\ Options:\n\ -h Listen for L2 heartbeat from an iSNS.\n\ Index: iscsi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/iscsi.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** iscsi.c 2 Jan 2007 20:15:24 -0000 1.8 --- iscsi.c 30 Mar 2007 22:55:22 -0000 1.9 *************** *** 404,411 **** printf ("Type: %#x (", p_attr->val.etype); if (p_attr->val.etype & 1) ! printf ("Target "); if (p_attr->val.etype & 2) printf ("Initiator"); ! printf (").\n"); break; case ISNS_ISCSI_ALIAS: --- 404,411 ---- printf ("Type: %#x (", p_attr->val.etype); if (p_attr->val.etype & 1) ! printf ("Target"); if (p_attr->val.etype & 2) printf ("Initiator"); ! printf (")\n"); break; case ISNS_ISCSI_ALIAS: |
From: Robert W. <wrw...@us...> - 2007-03-15 22:28:34
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16670/isnsserver/src Modified Files: iSNSreg.c Log Message: add timeout to socket connection Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** iSNSreg.c 4 Jan 2007 19:00:07 -0000 1.23 --- iSNSreg.c 15 Mar 2007 22:28:30 -0000 1.24 *************** *** 587,590 **** --- 587,593 ---- updateFlag = TRUE; break; + case ISNS_ISCSI_TYPE: + p_portal->node_type=p_portal->node_type | *(uint32_t *)&attr->val; + updateFlag = TRUE; default: break; *************** *** 1644,1647 **** --- 1647,1652 ---- int updateFlag; ISNS_DBKey read_key; + int node_type = 0; + int nodeTypeIndex = -1; newRegFlag = FALSE; *************** *** 1692,1695 **** --- 1697,1707 ---- } + nodeTypeIndex = ISNSFindTag ( 0, ISNS_ISCSI_TYPE, attr_indx ); + if (nodeTypeIndex != -1) + { + attr = (ISNS_Attr *) attr_indx[nodeTypeIndex]; + node_type = *(uint32_t *)&attr->val; + } + p_entity = &entry.data.entity; read_key.tag = ENTITY_ID_KEY; *************** *** 1697,1706 **** rval = ISNSdbRead(&read_key,&entry); if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { ! /* An entry was found and the update flag is not set, so deregister it */ ! DEBUG_0 (isns_reg_debug &1, RemoveEntity); ! ISNSdbRemoveAttrEntityEntry (db_entity_id.id, NULL, NULL); ! rval = ERROR; } --- 1709,1723 ---- rval = ISNSdbRead(&read_key,&entry); + /* If an entry was found and the update flag is not set deregister it */ + /* Also if the entry was found and the node_type is different then */ + /* don't de-register it */ if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { ! if ( p_entity->node_type == node_type) ! { ! DEBUG_0 (isns_reg_debug &1, RemoveEntity); ! ISNSdbRemoveAttrEntityEntry (db_entity_id.id, NULL, NULL); ! rval = ERROR; ! } } *************** *** 1798,1801 **** --- 1815,1823 ---- updateFlag = TRUE; break; + case ISNS_ISCSI_TYPE: + p_entity->node_type = p_entity->node_type | *(uint32_t *)&attr->val; + updateFlag = TRUE; + break; + default: break; |
From: Robert W. <wrw...@us...> - 2007-03-15 22:28:34
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16670/isnsclient/src Modified Files: comm.c Log Message: add timeout to socket connection Index: comm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/comm.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** comm.c 13 Mar 2007 19:34:43 -0000 1.7 --- comm.c 15 Mar 2007 22:28:30 -0000 1.8 *************** *** 46,49 **** --- 46,52 ---- #include "comm.h" #include "parse.h" + #include <fcntl.h> + #include <errno.h> + #include <poll.h> MSG_CB msg_q[MSG_Q_SIZE]; /* TCP msg Q */ *************** *** 80,83 **** --- 83,91 ---- { tcpFlag=t_flag; + int flags = 0; + int rc = 0; + int timeout = 5; // # seconds + struct pollfd fds; + #ifndef SNS_LINUX /* Start up the winsock proprietary Stuff */ *************** *** 104,111 **** if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { ! perror ("Fatal Error while calling socket"); exit(-1); } /* Setup Variables, Addresses, Etc. */ their_addr.sin_family = AF_INET; /* host byte order */ --- 112,123 ---- if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { ! perror ("TCP Fatal Error while calling socket"); exit(-1); } + /* setup socket to nonblocking so we can do a timeout on the connect call */ + flags = fcntl(fd, F_GETFL,0); + fcntl (fd, F_SETFL, flags | O_NONBLOCK); + /* Setup Variables, Addresses, Etc. */ their_addr.sin_family = AF_INET; /* host byte order */ *************** *** 113,125 **** their_addr.sin_addr.s_addr = inet_addr (p_ip); - /* Do a Connect */ printf ("Connecting to %s...\n", p_ip); ! if (connect (fd, (struct sockaddr *) &their_addr, sizeof (their_addr)) ! < 0) { ! printf ("Fatal Error: Connect.\n"); ! exit(-1); } /* Spawn TCP Recv Thread*/ { --- 125,165 ---- their_addr.sin_addr.s_addr = inet_addr (p_ip); printf ("Connecting to %s...\n", p_ip); ! rc = connect (fd, (struct sockaddr *) &their_addr, sizeof (their_addr)); ! if (rc < 0) { ! if (!(errno == EINTR || errno == EINPROGRESS || errno == EWOULDBLOCK)) ! { ! printf ("TCP Fatal Error connecting: %s\n",strerror(errno)); ! exit(-1); ! } ! ! /* because we have nonblocking connection, we have to poll to find out when */ ! /* the connection actually occurs. If it can't connect, then a timeout occurs */ ! fds.fd = fd; ! fds.events = POLLOUT; ! for (;;) { ! fds.revents = 0; ! rc = poll(&fds, 1, timeout * 1000); ! if (rc < 0) ! { ! if (!(errno == EINTR || errno == EAGAIN)) ! break; ! } ! else if (rc == 0) ! { ! printf ("TCP Fatal Error Timeout occured trying to Connect\n"); ! exit(-1); ! } ! else ! /* success we have a connection */ ! if (fds.revents & POLLOUT) ! break; ! } } + /* set socket back to blocking */ + fcntl (fd, F_SETFL, flags ); + /* Spawn TCP Recv Thread*/ { *************** *** 141,145 **** if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { ! perror ("Fatal Error while calling socket"); exit(-1); } --- 181,185 ---- if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { ! perror ("UDP Fatal Error while calling socket"); exit(-1); } *************** *** 151,158 **** /* Do a Bind */ ! if (bind (fd, (struct sockaddr *) &my_addr, sizeof (my_addr)) < 0) { ! printf ("Fatal Error while Binding.\n"); ! exit(-1); } --- 191,199 ---- /* Do a Bind */ ! rc = bind (fd, (struct sockaddr *) &my_addr, sizeof (my_addr)); ! if (rc < 0) { ! printf ("UDP Fatal Error: Bind: %s\n",strerror(errno)); ! exit(-1); } *************** *** 161,164 **** --- 202,209 ---- their_addr.sin_port = htons ((short) isns_port); /* short, network byte order */ their_addr.sin_addr.s_addr = inet_addr (p_ip); + + /* setup socket to nonblocking so we can do a timeout on the connect call */ + flags = fcntl(fd, F_GETFL,0); + fcntl (fd, F_SETFL, flags | O_NONBLOCK); } *************** *** 260,263 **** --- 305,313 ---- { int e; + fd_set read_set; + struct timeval timeout; + int nb; + + if (tcpFlag) { *************** *** 266,270 **** if (e < 0) { ! printf ("Error Sending.\n"); return (-1); } --- 316,320 ---- if (e < 0) { ! printf ("Error Sending TCP request.\n"); return (-1); } *************** *** 273,281 **** else { - /* Setup Variables, Addresses, Etc. */ - their_addr.sin_family = AF_INET; /* host byte order */ - their_addr.sin_port = htons ((short) isns_port); /* short, network byte order */ - their_addr.sin_addr.s_addr = inet_addr (p_ip); - e = sendto (fd, (char *) cmd, len, 0, (struct sockaddr *) &their_addr, sizeof (their_addr)); --- 323,326 ---- *************** *** 283,289 **** if (e < 0) { ! printf ("Error Sending.\n"); return (e); } } --- 328,351 ---- if (e < 0) { ! printf ("Error Sending UDP request.\n"); return (e); } + + /* setup a timer to check for results */ + FD_ZERO(&read_set); + FD_SET(fd, &read_set); + timeout.tv_sec = 5; // seconds + timeout.tv_usec = 0; // microseconds + + nb = select(fd+1, &read_set, NULL, NULL, &timeout); + if (nb < 0 ) + printf ("Error setting up socket\n"); + + if (nb == 0) + { + printf ("Unable to connect - timedout\n"); + exit (-1); + } + } |
From: Robert W. <wrw...@us...> - 2007-03-15 22:28:34
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16670/isnsserver/include Modified Files: iSNStypes.h Log Message: add timeout to socket connection Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** iSNStypes.h 12 Jan 2007 21:10:22 -0000 1.13 --- iSNStypes.h 15 Mar 2007 22:28:30 -0000 1.14 *************** *** 494,505 **** typedef struct soip_entity { ! ! SOIP_Entity_Id eid; ! uint32_t eid_len; ! uint32_t esi; ! SOIP_Entity_Type eid_type; ! SOIP_Port_List port_list; ! ! /* iSNS Stuff */ uint32_t entity_index; SOIP_Time timestamp; --- 494,503 ---- typedef struct soip_entity { ! SOIP_Entity_Id eid; ! uint32_t eid_len; ! uint32_t esi; ! SOIP_Entity_Type eid_type; //1=iscsi, 2=ifcp ! uint32_t node_type; //1=target, 2=initiator, 3=both ! SOIP_Port_List port_list; uint32_t entity_index; SOIP_Time timestamp; *************** *** 514,518 **** uint32_t cert_size; uint32_t period; - } SOIP_Entity; --- 512,515 ---- *************** *** 532,554 **** typedef struct soip_portal { ! ! uint32_t portal_id; ! IP_Address ip_addr; ! uint32_t ip_port; ! ! /* More iSNS Stuff */ ! char sym_name[ PORTAL_SYM_NAME_SIZE ]; ! SOIP_Entity_Id entity_id; ! uint32_t entity_index; ! uint32_t portal_index; ! uint32_t esi_sockfd; ! uint32_t esi_port; ! uint32_t esi_interval; ! uint32_t esiSent; ! time_t esi_timer; ! void *ptr_cert; ! uint32_t cert_size; ! uint32_t group; ! } SOIP_Portal; --- 529,548 ---- typedef struct soip_portal { ! uint32_t portal_id; ! IP_Address ip_addr; ! int32_t ip_port; ! char sym_name[ PORTAL_SYM_NAME_SIZE ]; ! uint32_t node_type; //1=target, 2=initiator ! SOIP_Entity_Id entity_id; ! uint32_t entity_index; ! uint32_t portal_index; ! uint32_t esi_sockfd; ! uint32_t esi_port; ! uint32_t esi_interval; ! uint32_t esiSent; ! time_t esi_timer; ! void *ptr_cert; ! uint32_t cert_size; ! uint32_t group; } SOIP_Portal; *************** *** 573,579 **** uint32_t ip_port; uint32_t portal_tag; ! ! /* More iSNS Stuff */ ! uint32_t portal_group_index; } SOIP_Portal_Group; --- 567,571 ---- uint32_t ip_port; uint32_t portal_tag; ! uint32_t portal_group_index; } SOIP_Portal_Group; |
From: Robert W. <wrw...@us...> - 2007-03-15 22:28:34
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16670/isnsclient Modified Files: Makefile Log Message: add timeout to socket connection Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 5 Feb 2007 17:37:14 -0000 1.6 --- Makefile 15 Mar 2007 22:28:30 -0000 1.7 *************** *** 116,120 **** clean : ! rm $(PROG1) $(PROG2) $(OBJECTS) isnsc isnsclient install: install_programs --- 116,120 ---- clean : ! rm $(PROG1) $(PROG2) $(OBJECTS) isnsc isnsadm install: install_programs |
From: Robert W. <wrw...@us...> - 2007-03-13 19:35:21
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20896/src Modified Files: comm.c Log Message: Add a return stmt when send failed Index: comm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/comm.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comm.c 2 Feb 2007 23:21:38 -0000 1.6 --- comm.c 13 Mar 2007 19:34:43 -0000 1.7 *************** *** 366,369 **** --- 366,370 ---- { printf ("Error Sending.\n"); + return e; } |
From: Robert W. <wrw...@us...> - 2007-02-07 20:47:41
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8083/isnsclient Modified Files: ReleaseNotes.txt Log Message: update Release Index: ReleaseNotes.txt =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/ReleaseNotes.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReleaseNotes.txt 7 Feb 2007 20:43:59 -0000 1.3 --- ReleaseNotes.txt 7 Feb 2007 20:47:38 -0000 1.4 *************** *** 1,3 **** ! Release 2.1 02/07/2007 ------------------------- created isnsadm - command line utility --- 1,3 ---- ! Release 2.0.3 02/07/2007 ------------------------- created isnsadm - command line utility |
From: Robert W. <wrw...@us...> - 2007-02-07 20:47:41
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8083/isnsserver Modified Files: ReleaseNotes.txt Log Message: update Release Index: ReleaseNotes.txt =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/ReleaseNotes.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReleaseNotes.txt 7 Feb 2007 20:43:59 -0000 1.3 --- ReleaseNotes.txt 7 Feb 2007 20:47:38 -0000 1.4 *************** *** 1,3 **** ! Release 2.1 02/07/2007 ------------------------------- Changed output display of Discovery Domain Sets --- 1,3 ---- ! Release 2.0.3 02/07/2007 ------------------------------- Changed output display of Discovery Domain Sets |
From: Robert W. <wrw...@us...> - 2007-02-07 20:44:06
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6247/isnsclient Modified Files: ReleaseNotes.txt Log Message: update Release Index: ReleaseNotes.txt =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/ReleaseNotes.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReleaseNotes.txt 4 Jan 2007 19:48:54 -0000 1.2 --- ReleaseNotes.txt 7 Feb 2007 20:43:59 -0000 1.3 *************** *** 1,2 **** --- 1,6 ---- + Release 2.1 02/07/2007 + ------------------------- + created isnsadm - command line utility + Release 2.0 01/04/2007 ------------------------- |
From: Robert W. <wrw...@us...> - 2007-02-07 20:44:05
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6247/isnsserver Modified Files: ReleaseNotes.txt Log Message: update Release Index: ReleaseNotes.txt =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/ReleaseNotes.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReleaseNotes.txt 4 Jan 2007 19:48:54 -0000 1.2 --- ReleaseNotes.txt 7 Feb 2007 20:43:59 -0000 1.3 *************** *** 1,2 **** --- 1,6 ---- + Release 2.1 02/07/2007 + ------------------------------- + Changed output display of Discovery Domain Sets + Release 2.0 01/04/2007 ------------------------------- |