Rev 595: fixed segv when no public interface is set in
http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Mon Aug 27 01:49:43 GMT 2007
------------------------------------------------------------
revno: 595
revision-id: tridge at samba.org-20070827014942-qj7t7y2t7c1lfa9h
parent: tridge at samba.org-20070822073129-ot641pslynosp6d2
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Mon 2007-08-27 11:49:42 +1000
message:
fixed segv when no public interface is set
modified:
server/ctdb_takeover.c ctdb_takeover.c-20070525071636-a5n1ihghjtppy08r-2
=== modified file 'server/ctdb_takeover.c'
--- a/server/ctdb_takeover.c 2007-08-20 04:16:58 +0000
+++ b/server/ctdb_takeover.c 2007-08-27 01:49:42 +0000
@@ -185,7 +185,7 @@
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;
}
@@ -641,6 +641,14 @@
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);
@@ -653,16 +661,6 @@
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;
@@ -677,7 +675,7 @@
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 */
More information about the samba-cvs
mailing list