Skip to content

Commit

Permalink
clusterer: throw error when receiving message from own node id
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlad-patrascu committed Apr 25, 2018
1 parent 1e7b883 commit 19ee687
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/clusterer/clusterer.c
Expand Up @@ -1697,6 +1697,11 @@ void bin_rcv_cl_extra_packets(bin_packet_t *packet, int packet_type,
LM_DBG("received clusterer message from: %s:%hu with source id: %d and"
" cluster id: %d\n", ip, port, source_id, cluster_id);

if (source_id == current_id) {
LM_ERR("Received message with bad source - same node id as current instance\n");
return;
}

lock_start_read(cl_list_lock);

cl = get_cluster_by_id(cluster_id);
Expand Down Expand Up @@ -1795,6 +1800,11 @@ void bin_rcv_cl_packets(bin_packet_t *packet, int packet_type,
LM_DBG("received clusterer message from: %s:%hu with source id: %d and "
"cluster id: %d\n", ip, port, source_id, cl_id);

if (source_id == current_id) {
LM_ERR("Received message with bad source - same node id as current instance\n");
return;
}

lock_start_sw_read(cl_list_lock);

cl = get_cluster_by_id(cl_id);
Expand Down Expand Up @@ -1847,6 +1857,11 @@ static void bin_rcv_mod_packets(bin_packet_t *packet, int packet_type,
LM_DBG("received bin packet from: %s:%hu with source id: %d and cluster id: %d\n",
ip, port, source_id, cluster_id);

if (source_id == current_id) {
LM_ERR("Received message with bad source - same node id as current instance\n");
return;
}

cap = (struct capability_reg *)ptr;

lock_start_read(cl_list_lock);
Expand Down

0 comments on commit 19ee687

Please sign in to comment.