int i;
for (i=0;i<ctdb->num_nodes;i++) {
- if (!strcmp(ip, ctdb->nodes[i]->public_address)) {
+ if (ctdb->nodes[i]->public_address && !strcmp(ip, ctdb->nodes[i]->public_address)) {
vnn = i;
break;
}
char *addr;
int32_t takeover_vnn;
+ addr = inet_ntoa(p->dest.sin_addr);
+
+ takeover_vnn = find_public_ip_vnn(ctdb, addr);
+ if (takeover_vnn == -1) {
+ DEBUG(3,("Could not add client IP %s. This is not a public address.\n", addr));
+ return 0;
+ }
+
ip = talloc(client, struct ctdb_client_ip);
CTDB_NO_MEMORY(ctdb, ip);
tcp = talloc(client, struct ctdb_tcp_list);
CTDB_NO_MEMORY(ctdb, tcp);
- addr = inet_ntoa(p->dest.sin_addr);
-
- takeover_vnn = find_public_ip_vnn(ctdb, addr);
- if (takeover_vnn == -1) {
- DEBUG(3,("Could not add client IP %s. This is not a public address.\n", addr));
- return -1;
- }
-
- addr = inet_ntoa(p->src.sin_addr);
-
tcp->connection.saddr = p->src;
tcp->connection.daddr = p->dest;
DEBUG(2,("registered tcp client for %u->%s:%u\n",
(unsigned)ntohs(p->dest.sin_port),
- addr,
+ inet_ntoa(p->src.sin_addr),
(unsigned)ntohs(p->src.sin_port)));
/* tell all nodes about this tcp connection */