TALLOC_FREE(ctdb->ip_tree);
ctdb->ip_tree = trbt_create(ctdb, 0);
- for (i=0; i < ctdb->num_nodes; i++) {
-
- if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) {
- continue;
- }
+ if (ipalloc_state->known_public_ips == NULL) {
+ DEBUG(DEBUG_ERR, ("Known public IPs not set\n"));
+ return NULL;
+ }
- /* there were no public ips for this node */
- if (ipalloc_state->known_public_ips == NULL) {
- continue;
- }
+ for (i=0; i < ipalloc_state->num; i++) {
public_ips = &ipalloc_state->known_public_ips[i];
CTDB_NO_MEMORY_NULL(ctdb, tmp_ip);
/* Do not use information about IP addresses hosted
* on other nodes, it may not be accurate */
- if (public_ips->ip[j].pnn == ctdb->nodes[i]->pnn) {
+ if (public_ips->ip[j].pnn == i) {
tmp_ip->pnn = public_ips->ip[j].pnn;
} else {
tmp_ip->pnn = -1;