Skip to content

Commit

Permalink
Merge pull request #1645 from goharahmed/master
Browse files Browse the repository at this point in the history
Fixed bug where any addr get positive match in config if cluster_id i…
  • Loading branch information
liviuchircu committed Mar 26, 2019
2 parents b931ffe + b8cf933 commit 3c49188
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/clusterer/clusterer.c
Expand Up @@ -910,7 +910,7 @@ static int ip_check(cluster_info_t *cluster, union sockaddr_union *su, str *ip_s
return 1;
} else {
LM_ERR("No address to check\n");
return -1;
return 0;
}

return 0;
Expand All @@ -928,28 +928,29 @@ int clusterer_check_addr(int cluster_id, str *ip_str,
cluster = get_cluster_by_id(cluster_id);
if (!cluster) {
LM_WARN("Unknown cluster id [%d]\n", cluster_id);
return -1;
return 0;
}

if (check_type == NODE_BIN_ADDR) {
ip.af = AF_INET;
ip.len = 16;
if (inet_pton(AF_INET, ip_str->s, ip.u.addr) <= 0) {
LM_ERR("Invalid IP address\n");
return -1;
return 0;
}
ip_addr2su(&su, &ip, 0);

rc = ip_check(cluster, &su, NULL);

} else if (check_type == NODE_SIP_ADDR) {
rc = ip_check(cluster, NULL, ip_str);
} else {
LM_ERR("Bad address type\n");
rc = -1;
rc = 0;
}

lock_stop_read(cl_list_lock);

/* return 1 if addr matched, 0 for ALL other cases, unless return codes implemented */
return rc;
}

Expand Down

0 comments on commit 3c49188

Please sign in to comment.