From: Robert W. <wrw...@us...> - 2006-12-13 23:53:05
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17418/src Modified Files: iSNSMain.c iSNSUtil.c iSNSesi.c iSNSfsm.c iSNSparse.c iSNSreg.c Log Message: Enable ESI to work Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSUtil.c 8 Dec 2006 20:20:34 -0000 1.9 --- iSNSUtil.c 13 Dec 2006 23:53:01 -0000 1.10 *************** *** 806,856 **** char * FuncIDText (uint16_t funcid) { ! switch (funcid) ! { ! /* Request */ ! case ISNS_REG_DEV_ATTR_REQ : return("Register Device Attribute Request"); ! case ISNS_DEV_ATTR_QRY_REQ : return("Device Attribute Query Request"); ! case ISNS_DEV_GET_NXT_REQ : return("Device Get Next Request"); ! case ISNS_DEREG_DEV_REQ : return("Deregister Device Request"); ! case ISNS_SCN_REG_REQ : return("SCN Register Request"); ! case ISNS_SCN_DEREG_REQ : return("SCN Deregister Request"); ! case ISNS_SCN_EVENT : return("SCN Event"); ! case ISNS_SCN : return("State Change Notification"); ! case ISNS_REG_DD_REQ : return("Discovery Domain Register"); ! case ISNS_DEREG_DD_REQ : return("Discovery Domain Deregister"); ! case ISNS_REG_DDS_REQ : return("Discovery Domain Set Register"); ! case ISNS_DEREG_DDS_REQ : return("Discovery Domain Set Deregister"); ! case ISNS_ESI : return("Entity Status Inquiry"); ! case ISNS_HEART_BEAT : return("Name Service Heartbeat"); ! case ISNS_REQ_SW_ID_REQ : return("Request Switch ID Request"); ! case ISNS_REL_SW_ID_REQ : return("Release Switch ID Request"); ! case ISNS_GET_SW_ID_REQ : return("Get Switch ID Request"); ! case ISNS_SAVE_DB_REQ : return("Save Database Request"); ! case ISNS_DDS_GET_NXT_MEMBER_REQ: return("Get DDS Next Member Request"); ! case ISNS_DD_GET_NXT_ISCSI_MEMBER_REQ: return("Get DDS Next Member Request"); ! case ISNS_ENTITY_GET_NXT_PORTAL_REQ: return("Get Entity Next Portal Request"); ! /* Response */ ! case ISNS_REG_DEV_ATTR_RES : return("Register Device Attribute Response"); ! case ISNS_DEV_ATTR_QRY_RES : return("Device Attribute Query Response"); ! case ISNS_DEV_GET_NXT_RES : return("Device Get Next Response"); ! case ISNS_DEREG_DEV_RES : return("Deregister Device Response"); ! case ISNS_SCN_REG_RES : return("SCN Register Response"); ! case ISNS_SCN_DEREG_RES : return("SCN Degregister Response"); ! case ISNS_SCN_EVENT_RES : return("SCN Event Response"); ! case ISNS_SCN_RES : return("SCN Response"); ! case ISNS_REG_DD_RES : return("Discovery Domain Register Response"); ! case ISNS_DEREG_DD_RES : return("Discovery Domain Deregister Response"); ! case ISNS_REG_DDS_RES : return("Discovery Domain Set Register Response"); ! case ISNS_DEREG_DDS_RES : return("Discovery Domain Set Deregister Response"); ! case ISNS_ESI_RSP : return("Entity Status Inquiry Response"); ! case ISNS_REQ_SW_ID_RES : return("Request Switch ID Response"); ! case ISNS_REL_SW_ID_RES : return("Release Switch ID Response"); ! case ISNS_GET_SW_ID_RES : return("Get Switch ID Response"); ! case ISNS_SAVE_DB_RES : return("Save Database Response"); ! case ISNS_DDS_GET_NXT_MEMBER_RES: return("Get DDS Next Member Response"); ! case ISNS_DD_GET_NXT_ISCSI_MEMBER_RES: return("Get DDS Next Member Response"); ! case ISNS_ENTITY_GET_NXT_PORTAL_RES: return("Get Portal Next Entity Response"); ! default : return(""); ! } } --- 806,861 ---- char * FuncIDText (uint16_t funcid) { ! switch (funcid) ! { ! /* Request */ ! case ISNS_REG_DEV_ATTR_REQ : return("Register Device Attribute Request"); ! case ISNS_DEV_ATTR_QRY_REQ : return("Device Attribute Query Request"); ! case ISNS_DEV_GET_NXT_REQ : return("Device Get Next Request"); ! case ISNS_DEREG_DEV_REQ : return("Deregister Device Request"); ! case ISNS_SCN_REG_REQ : return("SCN Register Request"); ! case ISNS_SCN_DEREG_REQ : return("SCN Deregister Request"); ! case ISNS_SCN_EVENT : return("SCN Event"); ! case ISNS_SCN : return("State Change Notification"); ! case ISNS_REG_DD_REQ : return("Discovery Domain Register"); ! case ISNS_DEREG_DD_REQ : return("Discovery Domain Deregister"); ! case ISNS_REG_DDS_REQ : return("Discovery Domain Set Register"); ! case ISNS_DEREG_DDS_REQ : return("Discovery Domain Set Deregister"); ! case ISNS_ESI : return("Entity Status Inquiry"); ! case ISNS_HEART_BEAT : return("Name Service Heartbeat"); ! case ISNS_REQ_SW_ID_REQ : return("Request Switch ID Request"); ! case ISNS_REL_SW_ID_REQ : return("Release Switch ID Request"); ! case ISNS_GET_SW_ID_REQ : return("Get Switch ID Request"); ! case ISNS_DDS_GET_NXT_MEMBER_REQ: return("Get DDS Next Member Request"); ! case ISNS_DD_GET_NXT_ISCSI_MEMBER_REQ: return("Get DDS Next Member Request"); ! case ISNS_ENTITY_GET_NXT_PORTAL_REQ: return("Get Entity Next Portal Request"); ! ! /* Response */ ! case ISNS_REG_DEV_ATTR_RES : return("Register Device Attribute Response"); ! case ISNS_DEV_ATTR_QRY_RES : return("Device Attribute Query Response"); ! case ISNS_DEV_GET_NXT_RES : return("Device Get Next Response"); ! case ISNS_DEREG_DEV_RES : return("Deregister Device Response"); ! case ISNS_SCN_REG_RES : return("SCN Register Response"); ! case ISNS_SCN_DEREG_RES : return("SCN Degregister Response"); ! case ISNS_SCN_EVENT_RES : return("SCN Event Response"); ! case ISNS_SCN_RES : return("SCN Response"); ! case ISNS_REG_DD_RES : return("Discovery Domain Register Response"); ! case ISNS_DEREG_DD_RES : return("Discovery Domain Deregister Response"); ! case ISNS_REG_DDS_RES : return("Discovery Domain Set Register Response"); ! case ISNS_DEREG_DDS_RES : return("Discovery Domain Set Deregister Response"); ! case ISNS_ESI_RSP : return("Entity Status Inquiry Response"); ! case ISNS_REQ_SW_ID_RES : return("Request Switch ID Response"); ! case ISNS_REL_SW_ID_RES : return("Release Switch ID Response"); ! case ISNS_GET_SW_ID_RES : return("Get Switch ID Response"); ! case ISNS_DDS_GET_NXT_MEMBER_RES: return("Get DDS Next Member Response"); ! case ISNS_DD_GET_NXT_ISCSI_MEMBER_RES: return("Get DDS Next Member Response"); ! case ISNS_ENTITY_GET_NXT_PORTAL_RES: return("Get Portal Next Entity Response"); ! ! /* Internal */ ! case ESI_TIMEOUT_EVENT : return("ESI Timeout Event"); ! case FSM_TIMEOUT_EVENT : return("FSM Timeout Event"); ! case REQ_TIMEOUT_EVENT : return("REQ Timeout Event"); ! ! default : return("Unknown Message Type"); ! } } Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSesi.c 13 Dec 2006 19:45:57 -0000 1.4 --- iSNSesi.c 13 Dec 2006 23:53:01 -0000 1.5 *************** *** 55,60 **** int isns_esi_debug=0; ! uint32_t isns_esi_interval = 15; ! extern int sns_esi_interval; extern int sns_heartbeat_interval; --- 55,59 ---- int isns_esi_debug=0; ! int sns_esi_interval = SNS_ESI_INTERVAL; extern int sns_heartbeat_interval; *************** *** 99,102 **** --- 98,103 ---- ENTITY_LIST_ENTRY *lentry; + DEBUG_0 (isns_esi_debug &1, ISNS_SendESI); + p_md = p_rspMd; memset( p_md, 0, sizeof( ISNS_Msg_Descp ) ); *************** *** 113,120 **** --- 114,124 ---- } + DEBUG_0 (isns_esi_debug &1, process esi_list); + /* Go through the ESI Table */ p_esi_node = GetNextNode( &esi_list, NULL ); while ( p_esi_node ) { + DEBUG_0 (isns_esi_debug &1, GetNodeData); /* Get Node Data */ p_esi_entry = (SOIP_Esi_Entry *)GetNodeData(p_esi_node); *************** *** 163,168 **** } ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), ! lentry->eid.id); ISNSAppendKey ( &p_md->msg, ISNS_PORTAL_IP, ISNS_IP_SIZE, --- 167,171 ---- } ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); ISNSAppendKey ( &p_md->msg, ISNS_PORTAL_IP, ISNS_IP_SIZE, *************** *** 212,215 **** --- 215,219 ---- } + DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); rval = ISNSSendMsg ( p_md ); } *************** *** 304,307 **** --- 308,313 ---- int rval; + DEBUG_0 (isns_esi_debug &1, ISNS_ProcessESI); + ISNSParseMsg( &p_md->msg, attr_indx, key_indx, NULL ); i = ISNSFindTag (0, ISNS_ENTITY_ID, key_indx); Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSparse.c 13 Dec 2006 19:45:57 -0000 1.10 --- iSNSparse.c 13 Dec 2006 23:53:01 -0000 1.11 *************** *** 86,89 **** --- 86,90 ---- { case ISNS_REG_DEV_ATTR_REQ: + case ISNS_ESI: case ISNS_ESI_RSP: case ISNS_SCN_RES: *************** *** 282,286 **** --- 283,290 ---- */ if ((msg == NULL) || (msg->hdr.msg_len > sizeof (ISNS_Msg))) + { + printf("Invalid msg header length: %i\n",msg->hdr.msg_len); return (ERROR); + } DEBUG_2 (sns_parse_debug &1,%s flags:%x,FuncIDText(msg->hdr.type),msg->hdr.flags); *************** *** 303,309 **** } ! if (msg->hdr.type == ISNS_ESI_RSP || msg->hdr.type == ISNS_REG_DEV_ATTR_RES || ! msg->hdr.type == ISNS_DEV_ATTR_QRY_RES) { offset += 4; ptr = (struct ISNS_attr *)((char *) ptr + 4); --- 307,316 ---- } ! if ( (msg->hdr.type == ISNS_ESI_RSP) ! || (msg->hdr.type == ISNS_REG_DEV_ATTR_RES) ! || (msg->hdr.type == ISNS_DEV_ATTR_QRY_RES) ) ! { + DEBUG_0 (sns_parse_debug &1, skip the error status field / timestamp); offset += 4; ptr = (struct ISNS_attr *)((char *) ptr + 4); Index: iSNSfsm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSfsm.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSfsm.c 1 Dec 2006 15:35:17 -0000 1.4 --- iSNSfsm.c 13 Dec 2006 23:53:01 -0000 1.5 *************** *** 218,222 **** ! int sns_esi_interval = SNS_ESI_INTERVAL; int sns_heartbeat_interval = SNS_HEARTBEAT_INTERVAL; int sns_heartbeat_timeout = SNS_HEARTBEAT_WAITTIME; --- 218,222 ---- ! extern int sns_esi_interval; int sns_heartbeat_interval = SNS_HEARTBEAT_INTERVAL; int sns_heartbeat_timeout = SNS_HEARTBEAT_WAITTIME; *************** *** 228,232 **** */ int sns_fsm_tree_wait = TRUE; ! int sns_ready; SNS_State sns_state; --- 228,232 ---- */ int sns_fsm_tree_wait = TRUE; ! int sns_ready = FALSE; SNS_State sns_state; *************** *** 294,297 **** --- 294,299 ---- ISNSNotReady(); DEBUG_0 (sns_fsm_debug & 4, (iSNS starting...)); + //sns_ready = TRUE; + //isns_role = ISNS_PRIMARY_SERVER; /* *************** *** 303,328 **** /* ! * Install the heartbeat timeout handler. */ #ifdef SNS_LINUX ! { ! /* HANDLE junk */ ! pthread_t junk; ! /*printf ("Creating thread for FSMTimeoutThread\n");*/ ! if (0 != pthread_create (&junk, NULL, (void*)SNSFSMTimeoutThread, NULL)) ! perror ("Error creating thread for FSM Timeout"); ! /*printf ("Creating thread for ESITimeoutThread\n");*/ ! if (0 != pthread_create (&junk, NULL, (void*)SNSESITimeoutThread, NULL)) ! perror ("Error creating thread for ESI Timeout"); ! /*printf ("Creating thread for ResyncTimeoutThread\n");*/ ! sns_resync_pid = pthread_create (&junk, NULL, (void*)SNSResyncTimeoutThread, NULL); ! if (sns_resync_pid != 0) ! perror ("Error creating thread for iSNS Resync"); ! } ! #else sns_esi_timer=CreateWaitableTimer(NULL, FALSE, NULL); sns_fsm_timer=CreateWaitableTimer(NULL, FALSE, NULL); --- 305,325 ---- /* ! * Activate timeout handlers. */ #ifdef SNS_LINUX ! { ! pthread_t junk; ! if (0 != pthread_create (&junk, NULL, (void*)SNSFSMTimeoutThread, NULL)) ! perror ("Error creating thread for FSM Timeout"); ! if (0 != pthread_create (&junk, NULL, (void*)SNSESITimeoutThread, NULL)) ! perror ("Error creating thread for ESI Timeout"); ! if (0 != pthread_create (&junk, NULL, (void*)SNSResyncTimeoutThread, NULL)) ! perror ("Error creating thread for iSNS Resync"); ! } + #else sns_esi_timer=CreateWaitableTimer(NULL, FALSE, NULL); sns_fsm_timer=CreateWaitableTimer(NULL, FALSE, NULL); *************** *** 422,436 **** sns_fsm_timeout = 1; ! bzero ((char *) fsm_timeout_md, sizeof (fsm_timeout_md)); ! /* ! * Send a FSM timeout message to the iSNS core task ! */ ((ISNS_Msg_Descp *)fsm_timeout_md)->msg.hdr.type = FSM_TIMEOUT_EVENT; ! ((ISNS_Msg_Descp *)fsm_timeout_md)->msg.hdr.msg_len = 0; ! status = SendIPCMessage (SNS_EP, (void *)fsm_timeout_md, sizeof(fsm_timeout_md), IPC_NO_WAIT); - } --- 419,433 ---- sns_fsm_timeout = 1; ! bzero ((char *) fsm_timeout_md, sizeof (fsm_timeout_md)); ! ! /* ! * Send a FSM timeout message to the iSNS core task ! */ ((ISNS_Msg_Descp *)fsm_timeout_md)->msg.hdr.type = FSM_TIMEOUT_EVENT; ! ((ISNS_Msg_Descp *)fsm_timeout_md)->msg.hdr.msg_len = 0; ! status = SendIPCMessage (SNS_EP, (void *)fsm_timeout_md, sizeof(fsm_timeout_md), IPC_NO_WAIT); } *************** *** 441,445 **** STATUS status = 0; ! bzero ((char *) esi_timeout_md, sizeof (esi_timeout_md)); /* * Send a ESI timeout message to the iSNS core task --- 438,442 ---- STATUS status = 0; ! bzero ((char *) esi_timeout_md, sizeof (esi_timeout_md)); /* * Send a ESI timeout message to the iSNS core task *************** *** 447,453 **** ((ISNS_Msg_Descp *)esi_timeout_md)->msg.hdr.type = ESI_TIMEOUT_EVENT; ! ((ISNS_Msg_Descp *)esi_timeout_md)->msg.hdr.msg_len = 0; ! status = SendIPCMessage (SNS_EP, (void *)esi_timeout_md, sizeof(esi_timeout_md), IPC_NO_WAIT); } --- 444,450 ---- ((ISNS_Msg_Descp *)esi_timeout_md)->msg.hdr.type = ESI_TIMEOUT_EVENT; ! ((ISNS_Msg_Descp *)esi_timeout_md)->msg.hdr.msg_len = 0; ! status = SendIPCMessage (SNS_EP, (void *)esi_timeout_md, sizeof(esi_timeout_md), IPC_NO_WAIT); } Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSreg.c 13 Dec 2006 19:45:57 -0000 1.11 --- iSNSreg.c 13 Dec 2006 23:53:01 -0000 1.12 *************** *** 61,65 **** /* Global */ int isns_reg_debug=0; ! extern uint32_t isns_esi_interval; --- 61,65 ---- /* Global */ int isns_reg_debug=0; ! int sns_esi_interval; *************** *** 601,608 **** if (p_portal->esi_interval != 0 ! && p_portal->esi_interval < isns_esi_interval) { DEBUG_2 (isns_reg_debug & 1, (ESI Interval too small %u < %u), ! p_portal->esi_interval, isns_esi_interval); if (newPortalRegFlag) --- 601,608 ---- if (p_portal->esi_interval != 0 ! && p_portal->esi_interval < sns_esi_interval) { DEBUG_2 (isns_reg_debug & 1, (ESI Interval too small %u < %u), ! p_portal->esi_interval, sns_esi_interval); if (newPortalRegFlag) *************** *** 651,655 **** return (ISNS_INVALID_REG_ERR); } - if (p_portal->esi_port == 0 && p_portal->esi_interval != 0 && p_md->cb.sock.socketType == ISNS_SOCKET_TYPE_TCP) --- 651,654 ---- Index: iSNSMain.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSMain.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSMain.c 7 Dec 2006 22:47:38 -0000 1.10 --- iSNSMain.c 13 Dec 2006 23:53:01 -0000 1.11 *************** *** 344,347 **** --- 344,349 ---- inet_ntoa_b (source_ip, dot_not_addr); + DEBUG_2(isns_main_debug &1,(SNSProcessRequest type: 0x%x - %s),msg_type,FuncIDText(msg_type)); + switch (msg_type) { *************** *** 372,375 **** --- 374,378 ---- break; case ISNS_HEART_BEAT: + DEBUG_0 (isns_main_debug & 1, ISNS_HEART_BEAT Not Implemented); break; case ISNS_REG_DDS_REQ: *************** *** 605,614 **** } break; ! case ISNS_SAVE_DB_REQ: ! { ! DEBUG_1 (isns_main_debug & 16, (Received %s), FuncIDText((short)msg_type)); ! DEBUG_0( isns_main_debug & 1, (Save is not implemented) ); ! break; ! } default: printf ("Received unknown message type %#x : \n", msg_type); --- 608,612 ---- } break; ! default: printf ("Received unknown message type %#x : \n", msg_type); |