summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-01-18 15:04:32 +0100
committerStefan Metzmacher <metze@samba.org>2010-01-20 11:11:04 +0100
commit76cb4ce34c57ebf3b33e36bed388fe15e7e77732 (patch)
treea3df3d359b9503746057e29ff83e4a48ebbe9371 /ctdb
parent405368eeb031f99bb589cfac4df4874b3fc9dd21 (diff)
downloadsamba-76cb4ce34c57ebf3b33e36bed388fe15e7e77732.tar.gz
samba-76cb4ce34c57ebf3b33e36bed388fe15e7e77732.tar.xz
samba-76cb4ce34c57ebf3b33e36bed388fe15e7e77732.zip
server: ban ourself if the ctdb and kernel knowledge of a public ip differs
metze (This used to be ctdb commit 48e0af91113d6cead6cae3f28d8d8f610cacaa71)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/ctdb_takeover.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index b9ba445c91..cc74739df4 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -575,11 +575,9 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
ctdb_addr_to_str(&pip->addr)));
return 0;
}
- vnn->pnn = pip->pnn;
have_ip = ctdb_sys_have_ip(&pip->addr);
best_iface = ctdb_vnn_best_iface(ctdb, vnn);
-
if (best_iface == NULL) {
DEBUG(DEBUG_ERR,("takeoverip of IP %s/%u failed to find"
"a usable interface (old %s, have_ip %d)\n",
@@ -590,6 +588,25 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
return -1;
}
+ if (vnn->iface == NULL && have_ip) {
+ DEBUG(DEBUG_CRIT,(__location__ " takeoverip of IP %s is known to the kernel, "
+ "but we have no interface assigned, has someone manually configured it?"
+ "banning ourself\n",
+ ctdb_addr_to_str(&vnn->public_address)));
+ ctdb_ban_self(ctdb);
+ return -1;
+ }
+
+ if (vnn->pnn != ctdb->pnn && have_ip) {
+ DEBUG(DEBUG_CRIT,(__location__ " takeoverip of IP %s is known to the kernel, "
+ "and we have it on iface[%s], but it was assigned to node %d"
+ "and we are node %d, banning ourself\n",
+ ctdb_addr_to_str(&vnn->public_address),
+ ctdb_vnn_iface_string(vnn), vnn->pnn, ctdb->pnn));
+ ctdb_ban_self(ctdb);
+ return -1;
+ }
+
if (vnn->iface) {
if (vnn->iface->link_up) {
/* only move when the rebalance gains something */
@@ -763,6 +780,15 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
return 0;
}
+ if (vnn->iface == NULL) {
+ DEBUG(DEBUG_CRIT,(__location__ " release_ip of IP %s is known to the kernel, "
+ "but we have no interface assigned, has someone manually configured it?"
+ "banning ourself\n",
+ ctdb_addr_to_str(&vnn->public_address)));
+ ctdb_ban_self(ctdb);
+ return -1;
+ }
+
DEBUG(DEBUG_NOTICE,("Release of IP %s/%u on interface %s node:%d\n",
ctdb_addr_to_str(&pip->addr),
vnn->public_netmask_bits,