From d6cbfe259079e75fb0900eda228d89ee8f971d6a Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 1 Jul 2009 13:36:00 +0000 Subject: [PATCH] Don't deliver cpg messages from unknown nodes This patch fixes situation, when in the middle of sync some node will send regular message before another node will receive confch message, and regular message is delivered to application. From application point of view, this node is unknown -> don't expect any messages. Now, no such messages are delivered to application. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2332 fd59a12c-fef9-0310-b244-a6a79926bd2f --- services/cpg.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/services/cpg.c b/services/cpg.c index 5c93586c..1212ef0a 100644 --- a/services/cpg.c +++ b/services/cpg.c @@ -822,9 +822,10 @@ static void message_handler_req_exec_cpg_mcast ( const struct req_exec_cpg_mcast *req_exec_cpg_mcast = message; struct res_lib_cpg_deliver_callback res_lib_cpg_mcast; int msglen = req_exec_cpg_mcast->msglen; - struct list_head *iter; + struct list_head *iter, *pi_iter; struct cpg_pd *cpd; struct iovec iovec[2]; + int known_node = 0; res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_DELIVER_CALLBACK; res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast) + msglen; @@ -846,6 +847,27 @@ static void message_handler_req_exec_cpg_mcast ( if ((cpd->cpd_state == CPD_STATE_LEAVE_STARTED || cpd->cpd_state == CPD_STATE_JOIN_COMPLETED) && (mar_name_compare (&cpd->group_name, &req_exec_cpg_mcast->group_name) == 0)) { + + if (!known_node) { + /* Try to find, if we know the node */ + for (pi_iter = process_info_list_head.next; + pi_iter != &process_info_list_head; pi_iter = pi_iter->next) { + + struct process_info *pi = list_entry (pi_iter, struct process_info, list); + + if (pi->nodeid == nodeid && + mar_name_compare (&pi->group, &req_exec_cpg_mcast->group_name) == 0) { + known_node = 1; + break; + } + } + } + + if (!known_node) { + /* Unknown node -> we will not deliver message */ + return ; + } + api->ipc_dispatch_iov_send (cpd->conn, iovec, 2); } }