osaf/libs/core/include/mds_papi.h | 3 + osaf/libs/core/mds/include/mds_dt2c.h | 4 +- osaf/libs/core/mds/mds_c_api.c | 18 +++++++++- osaf/libs/core/mds/mds_dt_tipc.c | 4 +- osaf/libs/core/mds/mds_dt_trans.c | 16 ++++++++- osaf/services/infrastructure/dtms/dtm/dtm_inter_svc.c | 6 +++- osaf/services/infrastructure/dtms/dtm/dtm_intra.c | 22 +++++++++---- osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c | 22 ++++++++++++- osaf/services/infrastructure/dtms/dtm/dtm_main.c | 2 +- osaf/services/infrastructure/dtms/dtm/dtm_node.c | 10 +++-- osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c | 16 ++++++--- osaf/services/infrastructure/dtms/include/dtm.h | 5 ++- osaf/services/infrastructure/dtms/include/dtm_cb.h | 1 + osaf/services/infrastructure/dtms/include/dtm_inter.h | 2 +- osaf/services/infrastructure/dtms/include/dtm_intra.h | 2 +- osaf/services/infrastructure/dtms/include/dtm_intra_disc.h | 12 +++++-- osaf/services/infrastructure/dtms/include/dtm_node.h | 2 +- 17 files changed, 108 insertions(+), 39 deletions(-)
diff --git a/osaf/libs/core/include/mds_papi.h b/osaf/libs/core/include/mds_papi.h --- a/osaf/libs/core/include/mds_papi.h +++ b/osaf/libs/core/include/mds_papi.h @@ -816,6 +816,9 @@ unpack individual structure members. */ */ NCSMDS_NODE_CHG node_chg; NODE_ID node_id; + uint16_t addr_family; + uint16_t length; + uint8_t ip_addr[INET6_ADDRSTRLEN]; } MDS_CALLBACK_NODE_EVENT_INFO; typedef struct mds_callback_msg_loss_event_info { diff --git a/osaf/libs/core/mds/include/mds_dt2c.h b/osaf/libs/core/mds/include/mds_dt2c.h --- a/osaf/libs/core/mds/include/mds_dt2c.h +++ b/osaf/libs/core/mds/include/mds_dt2c.h @@ -394,10 +394,10 @@ extern uint32_t mds_mcm_svc_down(PW_ENV_ MDS_SVC_PVT_SUB_PART_VER svc_sub_part_ver, MDS_SVC_ARCHWORD_TYPE archword_type); /* NODE UP */ -extern uint32_t mds_mcm_node_up(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id); +extern uint32_t mds_mcm_node_up(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id, char *node_ip, uint16_t addr_family); /* NODE DOWN */ -extern uint32_t mds_mcm_node_down(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id); +extern uint32_t mds_mcm_node_down(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id, uint16_t addr_family); /* VDEST UP */ extern uint32_t mds_mcm_vdest_up(MDS_VDEST_ID vdest_id, MDS_DEST adest); diff --git a/osaf/libs/core/mds/mds_c_api.c b/osaf/libs/core/mds/mds_c_api.c --- a/osaf/libs/core/mds/mds_c_api.c +++ b/osaf/libs/core/mds/mds_c_api.c @@ -2941,7 +2941,7 @@ else (entry exists) 2 - NCSCC_RC_FAILURE *********************************************************/ -uint32_t mds_mcm_node_up(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id) +uint32_t mds_mcm_node_up(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id, char *node_ip, uint16_t addr_family) { MDS_MCM_MSG_ELEM *event_msg = NULL; @@ -2984,6 +2984,15 @@ uint32_t mds_mcm_node_up(MDS_SVC_HDL loc cbinfo->info.node_evt.node_chg = NCSMDS_NODE_UP; cbinfo->info.node_evt.node_id = node_id; + cbinfo->info.node_evt.addr_family = addr_family; + if (node_ip) { + memcpy(cbinfo->info.node_evt.ip_addr, node_ip, INET6_ADDRSTRLEN); + cbinfo->info.node_evt.length = strlen(node_ip); + } + + m_MDS_LOG_INFO("MDTM: node up node_ip:%s, length:%d node_id:%u addr_family:%d msg_type:%d", + cbinfo->info.node_evt.ip_addr, cbinfo->info.node_evt.length, + cbinfo->info.node_evt.node_id, cbinfo->info.node_evt.addr_family, cbinfo->info.node_evt.node_chg); /* Post to mail box If Q Ownership is enabled Else Call user callback */ if (local_svc_info->q_ownership == true) { @@ -3021,7 +3030,7 @@ uint32_t mds_mcm_node_up(MDS_SVC_HDL loc 2 - NCSCC_RC_FAILURE *********************************************************/ -uint32_t mds_mcm_node_down(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id) +uint32_t mds_mcm_node_down(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id, uint16_t addr_family) { MDS_MCM_MSG_ELEM *event_msg = NULL; @@ -3063,7 +3072,10 @@ uint32_t mds_mcm_node_down(MDS_SVC_HDL l cbinfo->info.node_evt.node_chg = NCSMDS_NODE_DOWN; cbinfo->info.node_evt.node_id = node_id; - + cbinfo->info.node_evt.addr_family = addr_family; + + m_MDS_LOG_INFO("MDTM: node down node_id:%u addr_family:%d msg_type:%d", + cbinfo->info.node_evt.node_id, cbinfo->info.node_evt.addr_family, cbinfo->info.node_evt.node_chg); /* Post to mail box If Q Ownership is enabled Else Call user callback */ if (local_svc_info->q_ownership == true) { diff --git a/osaf/libs/core/mds/mds_dt_tipc.c b/osaf/libs/core/mds/mds_dt_tipc.c --- a/osaf/libs/core/mds/mds_dt_tipc.c +++ b/osaf/libs/core/mds/mds_dt_tipc.c @@ -1004,10 +1004,10 @@ static uint32_t mdtm_process_discovery_e if (TIPC_PUBLISHED == discovery_event) { m_MDS_LOG_INFO("MDTM: Raising the NODE UP event for NODE id = %d", node_id); - return mds_mcm_node_up(svc_hdl, node_id); + return mds_mcm_node_up(svc_hdl, node_id, NULL, AF_TIPC); } else if (TIPC_WITHDRAWN == discovery_event) { m_MDS_LOG_INFO("MDTM: Raising the NODE DOWN event for NODE id = %d", node_id); - return mds_mcm_node_down(svc_hdl, node_id); + return mds_mcm_node_down(svc_hdl, node_id, AF_TIPC); } else { m_MDS_LOG_INFO ("MDTM: TIPC EVENT UNSUPPORTED for Node (other than Publish and Withdraw)\n"); diff --git a/osaf/libs/core/mds/mds_dt_trans.c b/osaf/libs/core/mds/mds_dt_trans.c --- a/osaf/libs/core/mds/mds_dt_trans.c +++ b/osaf/libs/core/mds/mds_dt_trans.c @@ -1012,6 +1012,8 @@ static uint32_t mds_mdtm_process_recvdat case MDTM_LIB_NODE_DOWN_TYPE: { + uint16_t addr_family; /* Indicates V4 or V6 */ + char node_ip[INET6_ADDRSTRLEN]; node_id = ncs_decode_32bit(&buffer); ref_val = ncs_decode_64bit(&buffer); @@ -1021,11 +1023,21 @@ static uint32_t mds_mdtm_process_recvdat } if (msg_type == MDTM_LIB_NODE_UP_TYPE) { - mds_mcm_node_up(svc_hdl, node_id); + addr_family = ncs_decode_8bit(&buffer); + memset(node_ip,0, INET6_ADDRSTRLEN); + memcpy(node_ip, (uint8_t *)buffer, INET6_ADDRSTRLEN); + m_MDS_LOG_INFO("MDTM: NODE_UP node_ip:%s, node_id:%u addr_family:%d msg_type:%d", + node_ip, node_id, addr_family, msg_type); + mds_mcm_node_up(svc_hdl, node_id, node_ip, addr_family); } if (msg_type == MDTM_LIB_NODE_DOWN_TYPE) { - mds_mcm_node_down(svc_hdl, node_id); + m_MDS_LOG_INFO("MDTM: NODE_DOWN node_id:%u msg_type:%d",node_id, msg_type); + /* TBD if required this can be AF_INET or AF_INET6 + for now to distinguished between TCP & TIPC hardcoding to AF_INET + in case of TIPC we receive this as AF_TIPC */ + addr_family = AF_INET; /* AF_INET or AF_INET6 */ + mds_mcm_node_down(svc_hdl, node_id, addr_family); } } break; diff --git a/osaf/services/infrastructure/dtms/dtm/dtm_inter_svc.c b/osaf/services/infrastructure/dtms/dtm/dtm_inter_svc.c --- a/osaf/services/infrastructure/dtms/dtm/dtm_inter_svc.c +++ b/osaf/services/infrastructure/dtms/dtm/dtm_inter_svc.c @@ -112,7 +112,7 @@ uint32_t dtm_internode_process_rcv_down_ * @return NCSCC_RC_FAILURE * */ -uint32_t dtm_node_up(NODE_ID node_id, char *node_name, SYSF_MBX mbx) +uint32_t dtm_node_up(NODE_ID node_id, char *node_name, char *node_ip, DTM_IP_ADDR_TYPE i_addr_family, SYSF_MBX mbx) { /* Function call from inter thread */ /* Post the event to the mailbox of the intra_thread */ @@ -129,6 +129,10 @@ uint32_t dtm_node_up(NODE_ID node_id, ch dtm_msg_elem->info.node.node_id = node_id; dtm_msg_elem->info.node.mbx = mbx; strcpy(dtm_msg_elem->info.node.node_name, node_name); + dtm_msg_elem->info.node.i_addr_family = i_addr_family; /* Indicates V4 or V6 */ + strcpy(dtm_msg_elem->info.node.node_ip, node_ip); + TRACE("DTM: node_ip:%s, node_id:%u i_addr_family:%d ", dtm_msg_elem->info.node.node_ip, + dtm_msg_elem->info.node.node_id, dtm_msg_elem->info.node.i_addr_family); /* Do a mailbox post */ if ((m_NCS_IPC_SEND(&dtm_intranode_cb->mbx, dtm_msg_elem, dtm_msg_elem->pri)) != NCSCC_RC_SUCCESS) { diff --git a/osaf/services/infrastructure/dtms/dtm/dtm_intra.c b/osaf/services/infrastructure/dtms/dtm/dtm_intra.c --- a/osaf/services/infrastructure/dtms/dtm/dtm_intra.c +++ b/osaf/services/infrastructure/dtms/dtm/dtm_intra.c @@ -58,7 +58,7 @@ static struct pollfd pfd_list[DTM_INTRAN static int dtm_intranode_max_fd; -static uint32_t dtm_intra_processing_init(void); +static uint32_t dtm_intra_processing_init(char *node_ip, DTM_IP_ADDR_TYPE i_addr_family); static void dtm_intranode_processing(void); static uint32_t dtm_intranode_add_poll_fdlist(int fd, uint16_t event); static uint32_t dtm_intranode_create_rcv_task(int task_hdl); @@ -77,9 +77,9 @@ uint32_t dtm_socket_domain = AF_UNIX; * @return NCSCC_RC_FAILURE * */ -uint32_t dtm_service_discovery_init(void) +uint32_t dtm_service_discovery_init(DTM_INTERNODE_CB *dtms_cb) { - return dtm_intra_processing_init(); + return dtm_intra_processing_init(dtms_cb->ip_addr, dtms_cb->i_addr_family); } #define DTM_INTRANODE_SOCK_SIZE 64000 @@ -92,7 +92,7 @@ uint32_t dtm_service_discovery_init(void * @return NCSCC_RC_FAILURE * */ -uint32_t dtm_intra_processing_init(void) +uint32_t dtm_intra_processing_init(char *node_ip, DTM_IP_ADDR_TYPE i_addr_family) { int servlen, size = DTM_INTRANODE_SOCK_SIZE; /* For socket fd and server len */ @@ -244,7 +244,7 @@ uint32_t dtm_intra_processing_init(void) return NCSCC_RC_FAILURE; } - dtm_intranode_add_self_node_to_node_db(dtm_intranode_cb->nodeid); + dtm_intranode_add_self_node_to_node_db(dtm_intranode_cb->nodeid, node_ip, i_addr_family); if (m_NCS_IPC_CREATE(&dtm_intranode_cb->mbx) != NCSCC_RC_SUCCESS) { /* Mail box creation failed */ @@ -626,10 +626,18 @@ static void dtm_intranode_processing(voi node_id); free(msg_elem->info.svc_event.buffer); } else if (DTM_MBX_NODE_UP_TYPE == msg_elem->type) { + TRACE("DTM: node_ip:%s, node_id:%u i_addr_family:%d ", + msg_elem->info.node.node_ip, msg_elem->info.node.node_id, + msg_elem->info.node.i_addr_family); dtm_intranode_process_node_up(msg_elem->info.node.node_id, - msg_elem->info.node.node_name, - msg_elem->info.node.mbx); + msg_elem->info.node.node_name, + msg_elem->info.node.node_ip, + msg_elem->info.node.i_addr_family, + msg_elem->info.node.mbx); } else if (DTM_MBX_NODE_DOWN_TYPE == msg_elem->type) { + TRACE("DTM: node_ip:%s, node_id:%u i_addr_family:%d ", + msg_elem->info.node.node_ip, msg_elem->info.node.node_id, + msg_elem->info.node.i_addr_family); dtm_intranode_process_node_down(msg_elem->info.node.node_id); } else if (DTM_MBX_MSG_TYPE == msg_elem->type) { dtm_process_rcv_internode_data_msg(msg_elem->info.data.buffer, diff --git a/osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c b/osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c --- a/osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c +++ b/osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c @@ -657,6 +657,9 @@ uint32_t dtm_intranode_process_node_subs } else { node_up_msg.node_id = node_db->node_id; node_up_msg.ref_val = node_subscr_info->subtn_ref_val; + strcpy(node_up_msg.node_ip, node_db->node_ip); + node_up_msg.i_addr_family = node_db->i_addr_family; + TRACE("DTM: node_ip:%s, node_id:%u i_addr_family:%d ", node_up_msg.node_ip, node_up_msg.node_id, node_up_msg.i_addr_family); dtm_lib_prepare_node_up_msg(&node_up_msg, buffer); dtm_lib_msg_snd_common(buffer, node_subscr_info->process_id, DTM_LIB_NODE_UP_MSG_SIZE_FULL); @@ -1193,6 +1196,7 @@ uint32_t dtm_add_to_node_db_list(DTM_INT { DTM_INTRANODE_NODE_DB *node_db = dtm_intranode_node_list_db; TRACE_ENTER(); + TRACE("node_ip:%s, node_id:%u i_addr_family:%d ",add_node->node_ip,add_node->node_id,add_node->i_addr_family); if (NULL == node_db) { add_node->next = NULL; dtm_intranode_node_list_db = add_node; @@ -1360,12 +1364,15 @@ static uint32_t dtm_lib_prepare_node_up_ { uint8_t *data = buffer; TRACE_ENTER(); + TRACE("node_ip:%s, node_id:%u i_addr_family:%d ", up_msg->node_ip, up_msg->node_id, up_msg->i_addr_family); ncs_encode_16bit(&data, (uint16_t)DTM_LIB_NODE_UP_MSG_SIZE); ncs_encode_32bit(&data, (uint32_t)DTM_INTRANODE_SND_MSG_IDENTIFIER); ncs_encode_8bit(&data, (uint8_t)DTM_INTRANODE_SND_MSG_VER); ncs_encode_8bit(&data, (uint8_t)DTM_LIB_NODE_UP_TYPE); ncs_encode_32bit(&data, up_msg->node_id); ncs_encode_64bit(&data, up_msg->ref_val); + ncs_encode_8bit(&data, (uint8_t)up_msg->i_addr_family); + memcpy(data, up_msg->node_ip, INET6_ADDRSTRLEN); TRACE_LEAVE(); return NCSCC_RC_SUCCESS; } @@ -1406,7 +1413,7 @@ static uint32_t dtm_lib_prepare_node_dow 2 - NCSCC_RC_FAILURE *********************************************************/ -uint32_t dtm_intranode_process_node_up(NODE_ID node_id, char *node_name, SYSF_MBX mbx) +uint32_t dtm_intranode_process_node_up(NODE_ID node_id, char *node_name, char *node_ip, DTM_IP_ADDR_TYPE i_addr_family, SYSF_MBX mbx) { /* Add to the node db list */ DTM_INTRANODE_NODE_DB *node_db_info = NULL; @@ -1418,6 +1425,9 @@ uint32_t dtm_intranode_process_node_up(N node_db_info->node_id = node_id; strcpy(node_db_info->node_name, node_name); node_db_info->mbx = mbx; + node_db_info->i_addr_family = i_addr_family; + strcpy(node_db_info->node_ip, node_ip); + TRACE("node_ip:%s, node_id:%u i_addr_family:%d ", node_db_info->node_ip, node_db_info->node_id, node_db_info->i_addr_family); /* Initialize the pat tree */ pat_tree_params.key_size = sizeof(uint32_t); if (NCSCC_RC_SUCCESS != ncs_patricia_tree_init(&node_db_info->dtm_rem_node_svc_tree, &pat_tree_params)) { @@ -1436,6 +1446,9 @@ uint32_t dtm_intranode_process_node_up(N DTM_LIB_NODE_UP_MSG node_up_msg = { 0 }; uint8_t buffer[DTM_LIB_NODE_UP_MSG_SIZE_FULL]; node_up_msg.node_id = node_id; + node_up_msg.i_addr_family = i_addr_family; + strcpy(node_up_msg.node_ip, node_ip); + TRACE("DTM: node_ip:%s, node_id:%u i_addr_family:%d ", node_up_msg.node_ip, node_up_msg.node_id, node_up_msg.i_addr_family); dtm_lib_prepare_node_up_msg(&node_up_msg, buffer); while (NULL != node_subscr_info) { uint8_t *snd_buf = NULL; @@ -1492,7 +1505,7 @@ uint32_t dtm_intranode_process_node_down } else { uint8_t *ptr = &buffer[12]; ncs_encode_64bit(&ptr, node_subscr_info->subtn_ref_val); - memcpy(snd_buf, buffer, DTM_LIB_NODE_UP_MSG_SIZE_FULL); + memcpy(snd_buf, buffer, DTM_LIB_NODE_DOWN_MSG_SIZE_FULL); dtm_lib_msg_snd_common(snd_buf, node_subscr_info->process_id, DTM_LIB_NODE_DOWN_MSG_SIZE_FULL); } node_subscr_info = node_subscr_info->next; @@ -1891,7 +1904,7 @@ uint32_t dtm_process_internode_service_d 2 - NCSCC_RC_FAILURE *********************************************************/ -uint32_t dtm_intranode_add_self_node_to_node_db(NODE_ID node_id) +uint32_t dtm_intranode_add_self_node_to_node_db(NODE_ID node_id,char *node_ip, DTM_IP_ADDR_TYPE i_addr_family) { /* Add to the node db list */ DTM_INTRANODE_NODE_DB *node_db_info = NULL; @@ -1900,6 +1913,9 @@ uint32_t dtm_intranode_add_self_node_to_ return NCSCC_RC_FAILURE; } node_db_info->node_id = node_id; + node_db_info->i_addr_family = i_addr_family; + memcpy(node_db_info->node_ip, node_ip, INET6_ADDRSTRLEN); + TRACE("DTM: node_ip:%s, node_id:%u i_addr_family:%d ",node_db_info->node_ip,node_db_info->node_id,node_db_info->i_addr_family); if (NCSCC_RC_SUCCESS != (dtm_add_to_node_db_list(node_db_info))) { /* This is critical */ TRACE("DTM : Unable to add the node to node_db_list"); diff --git a/osaf/services/infrastructure/dtms/dtm/dtm_main.c b/osaf/services/infrastructure/dtms/dtm/dtm_main.c --- a/osaf/services/infrastructure/dtms/dtm/dtm_main.c +++ b/osaf/services/infrastructure/dtms/dtm/dtm_main.c @@ -321,7 +321,7 @@ int main(int argc, char *argv[]) /*************************************************************/ /* Set up the initialservice_discovery_task */ /*************************************************************/ - rc = dtm_service_discovery_init(); + rc = dtm_service_discovery_init(dtms_cb); if (NCSCC_RC_SUCCESS != rc) { LOG_ER("DTM:service_discovery thread CREATE failed rc : %d ", rc); goto done1; diff --git a/osaf/services/infrastructure/dtms/dtm/dtm_node.c b/osaf/services/infrastructure/dtms/dtm/dtm_node.c --- a/osaf/services/infrastructure/dtms/dtm/dtm_node.c +++ b/osaf/services/infrastructure/dtms/dtm/dtm_node.c @@ -124,7 +124,8 @@ uint32_t dtm_process_node_info(DTM_INTER } else osafassert(0); - rc = dtm_process_node_up_down(node->node_id, node->node_name, node->comm_status); + TRACE("DTM: dtm_process_node_info node_ip:%s, node_id:%u i_addr_family:%d ", node->node_ip, node->node_id, node->i_addr_family); + rc = dtm_process_node_up_down(node->node_id, node->node_name, node->node_ip , node->i_addr_family, node->comm_status); if (rc != NCSCC_RC_SUCCESS) { LOG_ER("DTM: dtm_process_node_up_down() failed rc : %d ", rc); @@ -161,7 +162,7 @@ uint32_t add_self_node(DTM_INTERNODE_CB tmp_node.cluster_id = dtms_cb->cluster_id; tmp_node.node_id = dtms_cb->node_id; memcpy(tmp_node.node_ip, (uint8_t *)dtms_cb->ip_addr, INET6_ADDRSTRLEN); - + tmp_node.i_addr_family = dtms_cb->i_addr_family; strncpy(tmp_node.node_name, dtms_cb->node_name, strlen(dtms_cb->node_name)); tmp_node.comm_status = true; tmp_node.comm_socket = 0; @@ -238,10 +239,11 @@ void datagram_buff_dump(uint8_t *buff, u * @return NCSCC_RC_FAILURE * */ -uint32_t dtm_process_node_up_down(NODE_ID node_id, char *node_name, uint8_t comm_status) +uint32_t dtm_process_node_up_down(NODE_ID node_id, char *node_name, char *node_ip, DTM_IP_ADDR_TYPE i_addr_family, uint8_t comm_status) { if (true == comm_status) { - dtm_node_up(node_id, node_name, 0); + TRACE("DTM: dtm_process_node_up_down node_ip:%s, node_id:%u i_addr_family:%d ", node_ip, node_id, i_addr_family); + dtm_node_up(node_id, node_name, node_ip, i_addr_family, 0); } else { dtm_node_down(node_id, node_name, 0); } diff --git a/osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c b/osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c --- a/osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c +++ b/osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c @@ -373,7 +373,8 @@ uint32_t dtm_comm_socket_close(int *comm if (node != NULL) { TRACE("DTM: node deleting enty "); if (true == node->comm_status) { - if (dtm_process_node_up_down(node->node_id, node->node_name, false) != NCSCC_RC_SUCCESS) { + TRACE("DTM: dtm_comm_socket_close node_ip:%s, node_id:%u i_addr_family:%d ", node->node_ip, node->node_id, node->i_addr_family); + if (dtm_process_node_up_down(node->node_id, node->node_name, node->node_ip, node->i_addr_family, false) != NCSCC_RC_SUCCESS) { LOG_ER(" dtm_process_node_up_down() failed rc : %d ", rc); rc = NCSCC_RC_FAILURE; goto done; @@ -1116,7 +1117,6 @@ int dtm_process_connect(DTM_INTERNODE_CB DTM_NODE_DB node = { 0 }; DTM_NODE_DB *new_node = NULL; uint8_t *buffer = data, mcast_flag; - DTM_IP_ADDR_TYPE ip_addr_type = 0; TRACE_ENTER(); memset(&node, 0, sizeof(DTM_NODE_DB)); @@ -1149,8 +1149,8 @@ int dtm_process_connect(DTM_INTERNODE_CB /* foreign_port = htons((in_port_t)(ncs_decode_16bit(&buffer))); */ foreign_port = ((in_port_t)(ncs_decode_16bit(&buffer))); - ip_addr_type = ncs_decode_8bit(&buffer); - memcpy(node.node_ip, buffer, INET6_ADDRSTRLEN); + node.i_addr_family = ncs_decode_8bit(&buffer); + memcpy(node.node_ip, (uint8_t *)buffer, INET6_ADDRSTRLEN); if (initial_discovery_phase == true) { if (node.node_id < dtms_cb->node_id) { @@ -1205,11 +1205,12 @@ int dtm_process_connect(DTM_INTERNODE_CB goto node_fail; } - sock_desc = comm_socket_setup_new(dtms_cb, (char *)&node.node_ip, foreign_port, ip_addr_type); + sock_desc = comm_socket_setup_new(dtms_cb, (char *)&node.node_ip, foreign_port, node.i_addr_family); new_node->comm_socket = sock_desc; new_node->node_id = node.node_id; memcpy(new_node->node_ip, node.node_ip, INET6_ADDRSTRLEN); + new_node->i_addr_family = node.i_addr_family; if (sock_desc != -1) { @@ -1238,6 +1239,8 @@ int dtm_process_connect(DTM_INTERNODE_CB free(new_node); goto node_fail; } + else + TRACE("DTM: dtm_node_add add .node_ip: %s, node_id: %u", new_node->node_ip, new_node->node_id); } node_fail: @@ -1325,6 +1328,7 @@ int dtm_process_accept(DTM_INTERNODE_CB goto done; } else { memcpy(node.node_ip, (uint8_t *)addrBuffer, INET6_ADDRSTRLEN); + node.i_addr_family = clnt_addr1->sa_family; } if (new_conn_sd != -1) { @@ -1404,7 +1408,7 @@ int dtm_dgram_recvfrom_bmcast(DTM_INTERN if (inet_ntop(clnt_addr1->sa_family, numericAddress, addrBuffer, sizeof(addrBuffer)) == NULL) { TRACE("DTM: invalid address :%s", addrBuffer); } else { - memcpy(node_ip, (char *)addrBuffer, INET6_ADDRSTRLEN); + memcpy(node_ip, (uint8_t *)addrBuffer, INET6_ADDRSTRLEN); } } diff --git a/osaf/services/infrastructure/dtms/include/dtm.h b/osaf/services/infrastructure/dtms/include/dtm.h --- a/osaf/services/infrastructure/dtms/include/dtm.h +++ b/osaf/services/infrastructure/dtms/include/dtm.h @@ -68,6 +68,9 @@ typedef struct dtm_rcv_msg_elem { char node_name[255]; NODE_ID node_id; SYSF_MBX mbx; + DTM_IP_ADDR_TYPE i_addr_family; /* Indicates V4 or V6 */ + char node_ip[INET6_ADDRSTRLEN]; + } node; } info; @@ -109,6 +112,6 @@ extern uint32_t dtm_node_add(DTM_NODE_DB extern uint32_t dtm_node_delete(DTM_NODE_DB * nnode, int i); extern DTM_NODE_DB *dtm_node_new(DTM_NODE_DB * new_node); extern int dtm_read_config(DTM_INTERNODE_CB * config, char *dtm_config_file); -uint32_t dtm_service_discovery_init(void); +uint32_t dtm_service_discovery_init(DTM_INTERNODE_CB *dtms_cb); #endif diff --git a/osaf/services/infrastructure/dtms/include/dtm_cb.h b/osaf/services/infrastructure/dtms/include/dtm_cb.h --- a/osaf/services/infrastructure/dtms/include/dtm_cb.h +++ b/osaf/services/infrastructure/dtms/include/dtm_cb.h @@ -40,6 +40,7 @@ typedef struct node_list { NODE_ID node_id; char node_name[MAX_NAME_LENGTH]; char node_ip[INET6_ADDRSTRLEN]; + DTM_IP_ADDR_TYPE i_addr_family; /* Indicates V4 or V6 */ int comm_socket; NCS_PATRICIA_NODE pat_nodeid; NCS_PATRICIA_NODE pat_comm_socket; diff --git a/osaf/services/infrastructure/dtms/include/dtm_inter.h b/osaf/services/infrastructure/dtms/include/dtm_inter.h --- a/osaf/services/infrastructure/dtms/include/dtm_inter.h +++ b/osaf/services/infrastructure/dtms/include/dtm_inter.h @@ -33,7 +33,7 @@ typedef enum dtm_msg_types { DTM_MESSAGE_MSG_TYPE = 4, } DTM_MSG_TYPES; -extern uint32_t dtm_node_up(NODE_ID node_id, char *node_name, SYSF_MBX mbx); +extern uint32_t dtm_node_up(NODE_ID node_id, char *node_name, char *node_ip, DTM_IP_ADDR_TYPE i_addr_family, SYSF_MBX mbx); extern uint32_t dtm_internode_process_rcv_up_msg(uint8_t *buffer, uint16_t len, NODE_ID node_id); extern uint32_t dtm_internode_process_rcv_down_msg(uint8_t *buffer, uint16_t len, NODE_ID node_id); extern uint32_t dtm_node_down(NODE_ID node_id, char *node_name, SYSF_MBX mbx); diff --git a/osaf/services/infrastructure/dtms/include/dtm_intra.h b/osaf/services/infrastructure/dtms/include/dtm_intra.h --- a/osaf/services/infrastructure/dtms/include/dtm_intra.h +++ b/osaf/services/infrastructure/dtms/include/dtm_intra.h @@ -46,7 +46,7 @@ typedef enum dtm_lib_types { DTM_LIB_MESSAGE_TYPE = 5, } DTM_LIB_TYPES; -extern uint32_t dtm_intranode_add_self_node_to_node_db(NODE_ID node_id); +extern uint32_t dtm_intranode_add_self_node_to_node_db(NODE_ID node_id, char *node_ip, DTM_IP_ADDR_TYPE i_addr_family); uint32_t dtm_intranode_reset_poll_fdlist(int fd); #endif diff --git a/osaf/services/infrastructure/dtms/include/dtm_intra_disc.h b/osaf/services/infrastructure/dtms/include/dtm_intra_disc.h --- a/osaf/services/infrastructure/dtms/include/dtm_intra_disc.h +++ b/osaf/services/infrastructure/dtms/include/dtm_intra_disc.h @@ -34,13 +34,13 @@ /* 2 -len(0), 4 - iden(2), 1- ver(6), 1-msg type(7), 4- node_id (8), 8 -ref_val(12) */ -#define DTM_LIB_NODE_UP_MSG_SIZE 18 +#define DTM_LIB_NODE_UP_MSG_SIZE (18 + 1 /*i_addr_family*/ + 46 /*ip_addr*/) -#define DTM_LIB_NODE_DOWN_MSG_SIZE DTM_LIB_NODE_UP_MSG_SIZE +#define DTM_LIB_NODE_DOWN_MSG_SIZE 18 #define DTM_LIB_NODE_UP_MSG_SIZE_FULL (DTM_LIB_NODE_UP_MSG_SIZE+2) -#define DTM_LIB_NODE_DOWN_MSG_SIZE_FULL DTM_LIB_NODE_UP_MSG_SIZE_FULL +#define DTM_LIB_NODE_DOWN_MSG_SIZE_FULL (DTM_LIB_NODE_DOWN_MSG_SIZE+2) typedef enum dtm_svc_install_scope { DTM_SVC_INSTALL_SCOPE_PCON = 1, @@ -65,6 +65,8 @@ typedef DTM_LIB_UP_MSG DTM_LIB_DOWN_MSG; typedef struct dtm_lib_node_up_msg { NODE_ID node_id; uint64_t ref_val; + DTM_IP_ADDR_TYPE i_addr_family; /* Indicates V4 or V6 */ + char node_ip[INET6_ADDRSTRLEN]; } DTM_LIB_NODE_UP_MSG; typedef DTM_LIB_NODE_UP_MSG DTM_LIB_NODE_DOWN_MSG; @@ -117,6 +119,8 @@ typedef struct dtm_intranode_node_db { char node_name[255]; SYSF_MBX mbx; int fd; + DTM_IP_ADDR_TYPE i_addr_family; + char node_ip[INET6_ADDRSTRLEN]; NCS_PATRICIA_TREE dtm_rem_node_svc_tree; /* Tree of service install info */ } DTM_INTRANODE_NODE_DB; @@ -175,7 +179,7 @@ uint32_t dtm_intranode_process_node_unsu uint32_t dtm_process_internode_service_up_msg(uint8_t *buffer, uint16_t len, NODE_ID node_id); uint32_t dtm_process_internode_service_down_msg(uint8_t *buffer, uint16_t len, NODE_ID node_id); -uint32_t dtm_intranode_process_node_up(NODE_ID node_id, char *node_name, SYSF_MBX mbx); +uint32_t dtm_intranode_process_node_up(NODE_ID node_id, char *node_name, char *node_ip, DTM_IP_ADDR_TYPE i_addr_family, SYSF_MBX mbx); uint32_t dtm_intranode_process_node_down(NODE_ID node_id); uint32_t dtm_intranode_process_pid_down(int fd); diff --git a/osaf/services/infrastructure/dtms/include/dtm_node.h b/osaf/services/infrastructure/dtms/include/dtm_node.h --- a/osaf/services/infrastructure/dtms/include/dtm_node.h +++ b/osaf/services/infrastructure/dtms/include/dtm_node.h @@ -35,7 +35,7 @@ extern int dtm_dgram_recvfrom_bmcast(DTM extern uint32_t dtm_comm_socket_send(int sock_desc, const void *buffer, int buffer_len); extern uint32_t dtm_comm_socket_recv(int sock_desc, void *buffer, int buffer_len); extern uint32_t dtm_comm_socket_close(int *comm_socket); -extern uint32_t dtm_process_node_up_down(NODE_ID node_id, char *node_name, uint8_t comm_status); +extern uint32_t dtm_process_node_up_down(NODE_ID node_id, char *node_name, char *node_ip, DTM_IP_ADDR_TYPE i_addr_family, uint8_t comm_status); uint32_t dtm_internode_set_poll_fdlist(int fd, uint16_t event); uint32_t dtm_internode_reset_poll_fdlist(int fd); ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel