mirror of
https://github.com/samba-team/samba.git
synced 2025-03-12 20:58:37 +03:00
ctdb-tools: Don't trust non-hosting nodes in "ctdb ip all"
Redundant RELEASE_IPs gives nodes a preview of where an IP address will move to. However, if the associated TAKEOVER_IP fails then the node will actually be unhosted. This is similar to commit 77a29b37334b9df62b755b6f538fb975e105e1ff. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Dec 16 12:32:02 CET 2016 on sn-devel-144
This commit is contained in:
parent
2514a9cd17
commit
cd20ced3fb
@ -1536,11 +1536,34 @@ static int get_all_public_ips(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
|
||||
ip.pnn = ips->ip[j].pnn;
|
||||
ip.addr = ips->ip[j].addr;
|
||||
|
||||
ret = db_hash_add(ipdb, (uint8_t *)&ip.addr,
|
||||
sizeof(ip.addr),
|
||||
(uint8_t *)&ip, sizeof(ip));
|
||||
if (ret != 0) {
|
||||
goto failed;
|
||||
if (pnn_list[i] == ip.pnn) {
|
||||
/* Node claims IP is hosted on it, so
|
||||
* save that information
|
||||
*/
|
||||
ret = db_hash_add(ipdb, (uint8_t *)&ip.addr,
|
||||
sizeof(ip.addr),
|
||||
(uint8_t *)&ip, sizeof(ip));
|
||||
if (ret != 0) {
|
||||
goto failed;
|
||||
}
|
||||
} else {
|
||||
/* Node thinks IP is hosted elsewhere,
|
||||
* so overwrite with CTDB_UNKNOWN_PNN
|
||||
* if there's no existing entry
|
||||
*/
|
||||
ret = db_hash_exists(ipdb, (uint8_t *)&ip.addr,
|
||||
sizeof(ip.addr));
|
||||
if (ret == ENOENT) {
|
||||
ip.pnn = CTDB_UNKNOWN_PNN;
|
||||
ret = db_hash_add(ipdb,
|
||||
(uint8_t *)&ip.addr,
|
||||
sizeof(ip.addr),
|
||||
(uint8_t *)&ip,
|
||||
sizeof(ip));
|
||||
if (ret != 0) {
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user