summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2015-03-23 17:06:31 +1100
committerJeremy Allison <jra@samba.org>2015-05-12 01:32:11 +0200
commit9b6865475ed1a88885975f07c5848bfe003c7f5c (patch)
tree808401f7ffdac6f99109e7d11fb165bd49fe47fb /ctdb
parent4f4e6ebace8ece37a90b08110a74b1a73030b28a (diff)
downloadsamba-9b6865475ed1a88885975f07c5848bfe003c7f5c.tar.gz
ctdb-daemon: Remove obsolete IPv4 only controls
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/client/ctdb_client.c147
-rw-r--r--ctdb/include/ctdb_private.h31
-rw-r--r--ctdb/server/ctdb_control.c12
-rw-r--r--ctdb/server/ctdb_recover.c31
-rw-r--r--ctdb/server/ctdb_takeover.c145
5 files changed, 49 insertions, 317 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index 7526362cba3..5bf3a68855e 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -1522,13 +1522,9 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
TDB_DATA outdata;
int32_t res;
- ret = ctdb_control(ctdb, destnode, 0,
- CTDB_CONTROL_GET_NODEMAP, 0, tdb_null,
+ ret = ctdb_control(ctdb, destnode, 0,
+ CTDB_CONTROL_GET_NODEMAP, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
- if (ret == 0 && res == -1 && outdata.dsize == 0) {
- DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed, falling back to ipv4-only control\n"));
- return ctdb_ctrl_getnodemapv4(ctdb, timeout, destnode, mem_ctx, nodemap);
- }
if (ret != 0 || res != 0 || outdata.dsize == 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed ret:%d res:%d\n", ret, res));
return -1;
@@ -1536,7 +1532,6 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
*nodemap = (struct ctdb_node_map *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
talloc_free(outdata.dptr);
-
return 0;
}
@@ -1566,45 +1561,6 @@ int ctdb_ctrl_getnodesfile(struct ctdb_context *ctdb,
}
/*
- old style ipv4-only get a list of nodes (vnn and flags ) from a remote node
- */
-int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb,
- struct timeval timeout, uint32_t destnode,
- TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap)
-{
- int ret, i, len;
- TDB_DATA outdata;
- struct ctdb_node_mapv4 *nodemapv4;
- int32_t res;
-
- ret = ctdb_control(ctdb, destnode, 0,
- CTDB_CONTROL_GET_NODEMAPv4, 0, tdb_null,
- mem_ctx, &outdata, &res, &timeout, NULL);
- if (ret != 0 || res != 0 || outdata.dsize == 0) {
- DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodesv4 failed ret:%d res:%d\n", ret, res));
- return -1;
- }
-
- nodemapv4 = (struct ctdb_node_mapv4 *)outdata.dptr;
-
- len = offsetof(struct ctdb_node_map, nodes) + nodemapv4->num*sizeof(struct ctdb_node_and_flags);
- (*nodemap) = talloc_zero_size(mem_ctx, len);
- CTDB_NO_MEMORY(ctdb, (*nodemap));
-
- (*nodemap)->num = nodemapv4->num;
- for (i=0; i<nodemapv4->num; i++) {
- (*nodemap)->nodes[i].pnn = nodemapv4->nodes[i].pnn;
- (*nodemap)->nodes[i].flags = nodemapv4->nodes[i].flags;
- (*nodemap)->nodes[i].addr.ip = nodemapv4->nodes[i].sin;
- (*nodemap)->nodes[i].addr.sa.sa_family = AF_INET;
- }
-
- talloc_free(outdata.dptr);
-
- return 0;
-}
-
-/*
drop the transport, reload the nodes file and restart the transport
*/
int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb,
@@ -2620,77 +2576,51 @@ int ctdb_ctrl_disable_monmode(struct ctdb_context *ctdb, struct timeval timeout,
-/*
+/*
sent to a node to make it take over an ip address
*/
-int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
+int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
uint32_t destnode, struct ctdb_public_ip *ip)
{
TDB_DATA data;
- struct ctdb_public_ipv4 ipv4;
int ret;
int32_t res;
- if (ip->addr.sa.sa_family == AF_INET) {
- ipv4.pnn = ip->pnn;
- ipv4.sin = ip->addr.ip;
-
- data.dsize = sizeof(ipv4);
- data.dptr = (uint8_t *)&ipv4;
-
- ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IPv4, 0, data, NULL,
- NULL, &res, &timeout, NULL);
- } else {
- data.dsize = sizeof(*ip);
- data.dptr = (uint8_t *)ip;
-
- ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IP, 0, data, NULL,
- NULL, &res, &timeout, NULL);
- }
+ data.dsize = sizeof(*ip);
+ data.dptr = (uint8_t *)ip;
+ ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IP, 0,
+ data, NULL, NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for takeover_ip failed\n"));
return -1;
}
- return 0;
+ return 0;
}
-/*
+/*
sent to a node to make it release an ip address
*/
-int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
+int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
uint32_t destnode, struct ctdb_public_ip *ip)
{
TDB_DATA data;
- struct ctdb_public_ipv4 ipv4;
int ret;
int32_t res;
- if (ip->addr.sa.sa_family == AF_INET) {
- ipv4.pnn = ip->pnn;
- ipv4.sin = ip->addr.ip;
-
- data.dsize = sizeof(ipv4);
- data.dptr = (uint8_t *)&ipv4;
-
- ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IPv4, 0, data, NULL,
- NULL, &res, &timeout, NULL);
- } else {
- data.dsize = sizeof(*ip);
- data.dptr = (uint8_t *)ip;
-
- ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IP, 0, data, NULL,
- NULL, &res, &timeout, NULL);
- }
+ data.dsize = sizeof(*ip);
+ data.dptr = (uint8_t *)ip;
+ ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IP, 0,
+ data, NULL, NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for release_ip failed\n"));
return -1;
}
- return 0;
+ return 0;
}
@@ -2830,21 +2760,19 @@ int ctdb_ctrl_get_public_ips_flags(struct ctdb_context *ctdb,
TDB_DATA outdata;
int32_t res;
- ret = ctdb_control(ctdb, destnode, 0,
+ ret = ctdb_control(ctdb, destnode, 0,
CTDB_CONTROL_GET_PUBLIC_IPS, flags, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
- if (ret == 0 && res == -1) {
- DEBUG(DEBUG_ERR,(__location__ " ctdb_control to get public ips failed, falling back to ipv4-only version\n"));
- return ctdb_ctrl_get_public_ipsv4(ctdb, timeout, destnode, mem_ctx, ips);
- }
if (ret != 0 || res != 0) {
- DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed ret:%d res:%d\n", ret, res));
+ DEBUG(DEBUG_ERR,(__location__
+ " ctdb_control for getpublicips failed ret:%d res:%d\n",
+ ret, res));
return -1;
}
*ips = (struct ctdb_all_public_ips *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
talloc_free(outdata.dptr);
-
+
return 0;
}
@@ -2858,39 +2786,6 @@ int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
0, ips);
}
-int ctdb_ctrl_get_public_ipsv4(struct ctdb_context *ctdb,
- struct timeval timeout, uint32_t destnode,
- TALLOC_CTX *mem_ctx, struct ctdb_all_public_ips **ips)
-{
- int ret, i, len;
- TDB_DATA outdata;
- int32_t res;
- struct ctdb_all_public_ipsv4 *ipsv4;
-
- ret = ctdb_control(ctdb, destnode, 0,
- CTDB_CONTROL_GET_PUBLIC_IPSv4, 0, tdb_null,
- mem_ctx, &outdata, &res, &timeout, NULL);
- if (ret != 0 || res != 0) {
- DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed\n"));
- return -1;
- }
-
- ipsv4 = (struct ctdb_all_public_ipsv4 *)outdata.dptr;
- len = offsetof(struct ctdb_all_public_ips, ips) +
- ipsv4->num*sizeof(struct ctdb_public_ip);
- *ips = talloc_zero_size(mem_ctx, len);
- CTDB_NO_MEMORY(ctdb, *ips);
- (*ips)->num = ipsv4->num;
- for (i=0; i<ipsv4->num; i++) {
- (*ips)->ips[i].pnn = ipsv4->ips[i].pnn;
- (*ips)->ips[i].addr.ip = ipsv4->ips[i].sin;
- }
-
- talloc_free(outdata.dptr);
-
- return 0;
-}
-
int ctdb_ctrl_get_public_ip_info(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx,
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 3391560421c..f34b5f27325 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -974,17 +974,6 @@ struct ctdb_control_list_tunable {
};
-struct ctdb_node_and_flagsv4 {
- uint32_t pnn;
- uint32_t flags;
- struct sockaddr_in sin;
-};
-
-struct ctdb_node_mapv4 {
- uint32_t num;
- struct ctdb_node_and_flagsv4 nodes[1];
-};
-
struct ctdb_control_wipe_database {
uint32_t db_id;
uint32_t transaction_id;
@@ -1111,24 +1100,15 @@ int32_t ctdb_control_end_recovery(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
bool *async_reply);
-struct ctdb_public_ipv4 {
- uint32_t pnn;
- struct sockaddr_in sin;
-};
-
int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
uint32_t destnode, struct ctdb_public_ip *ip);
int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
uint32_t destnode, struct ctdb_public_ip *ip);
-struct ctdb_all_public_ipsv4 {
- uint32_t num;
- struct ctdb_public_ipv4 ips[1];
-};
-
-int32_t ctdb_control_get_public_ipsv4(struct ctdb_context *ctdb, struct ctdb_req_control *c, TDB_DATA *outdata);
-int32_t ctdb_control_get_public_ips(struct ctdb_context *ctdb, struct ctdb_req_control *c, TDB_DATA *outdata);
-int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
+int32_t ctdb_control_get_public_ips(struct ctdb_context *ctdb,
+ struct ctdb_req_control *c,
+ TDB_DATA *outdata);
+int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
struct timeval timeout,
uint32_t destnode,
TALLOC_CTX *mem_ctx,
@@ -1139,9 +1119,6 @@ int ctdb_ctrl_get_public_ips_flags(struct ctdb_context *ctdb,
TALLOC_CTX *mem_ctx,
uint32_t flags,
struct ctdb_all_public_ips **ips);
-int ctdb_ctrl_get_public_ipsv4(struct ctdb_context *ctdb,
- struct timeval timeout, uint32_t destnode,
- TALLOC_CTX *mem_ctx, struct ctdb_all_public_ips **ips);
struct ctdb_control_iface_info {
char name[CTDB_IFACE_SIZE+2];
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index f3f70a38de5..9069087f1e1 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -164,7 +164,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
return ctdb_control_getdbmap(ctdb, opcode, indata, outdata);
case CTDB_CONTROL_GET_NODEMAPv4:
- return ctdb_control_getnodemapv4(ctdb, opcode, indata, outdata);
+ return control_not_implemented("GET_NODEMAPv4", "GET_NODEMAP");
case CTDB_CONTROL_GET_NODEMAP:
return ctdb_control_getnodemap(ctdb, opcode, indata, outdata);
@@ -351,16 +351,14 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
return 0;
case CTDB_CONTROL_TAKEOVER_IPv4:
- CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ipv4));
- return ctdb_control_takeover_ipv4(ctdb, c, indata, async_reply);
+ return control_not_implemented("TAKEOVER_IPv4", "TAKEOVER_IP");
case CTDB_CONTROL_TAKEOVER_IP:
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ip));
return ctdb_control_takeover_ip(ctdb, c, indata, async_reply);
case CTDB_CONTROL_RELEASE_IPv4:
- CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ipv4));
- return ctdb_control_release_ipv4(ctdb, c, indata, async_reply);
+ return control_not_implemented("RELEASE_IPv4", "RELEASE_IP");
case CTDB_CONTROL_RELEASE_IP:
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ip));
@@ -371,8 +369,8 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
return ctdb_control_ipreallocated(ctdb, c, async_reply);
case CTDB_CONTROL_GET_PUBLIC_IPSv4:
- CHECK_CONTROL_DATA_SIZE(0);
- return ctdb_control_get_public_ipsv4(ctdb, c, outdata);
+ return control_not_implemented("GET_PUBLIC_IPSv4",
+ "GET_PUBLIC_IPS");
case CTDB_CONTROL_GET_PUBLIC_IPS:
CHECK_CONTROL_DATA_SIZE(0);
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index 427d9858648..23f793be64f 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -136,37 +136,6 @@ ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA ind
}
/*
- get an old style ipv4-only nodemap
-*/
-int
-ctdb_control_getnodemapv4(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata)
-{
- uint32_t i, num_nodes;
- struct ctdb_node_mapv4 *node_map;
-
- CHECK_CONTROL_DATA_SIZE(0);
-
- num_nodes = ctdb->num_nodes;
-
- outdata->dsize = offsetof(struct ctdb_node_mapv4, nodes) + num_nodes*sizeof(struct ctdb_node_and_flagsv4);
- outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
- if (!outdata->dptr) {
- DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate nodemap array\n"));
- exit(1);
- }
-
- node_map = (struct ctdb_node_mapv4 *)outdata->dptr;
- node_map->num = num_nodes;
- for (i=0; i<num_nodes; i++) {
- node_map->nodes[i].sin = ctdb->nodes[i]->address.ip;
- node_map->nodes[i].pnn = ctdb->nodes[i]->pnn;
- node_map->nodes[i].flags = ctdb->nodes[i]->flags;
- }
-
- return 0;
-}
-
-/*
reload the nodes file
*/
int
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index 31e1b827cca..b09abd3a16b 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -814,24 +814,6 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
}
/*
- takeover an ip address old v4 style
- */
-int32_t ctdb_control_takeover_ipv4(struct ctdb_context *ctdb,
- struct ctdb_req_control *c,
- TDB_DATA indata,
- bool *async_reply)
-{
- TDB_DATA data;
-
- data.dsize = sizeof(struct ctdb_public_ip);
- data.dptr = (uint8_t *)talloc_zero(c, struct ctdb_public_ip);
- CTDB_NO_MEMORY(ctdb, data.dptr);
-
- memcpy(data.dptr, indata.dptr, indata.dsize);
- return ctdb_control_takeover_ip(ctdb, c, data, async_reply);
-}
-
-/*
kill any clients that are registered with a IP that is being released
*/
static void release_kill_clients(struct ctdb_context *ctdb, ctdb_sock_addr *addr)
@@ -1049,25 +1031,6 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
return 0;
}
-/*
- release an ip address old v4 style
- */
-int32_t ctdb_control_release_ipv4(struct ctdb_context *ctdb,
- struct ctdb_req_control *c,
- TDB_DATA indata,
- bool *async_reply)
-{
- TDB_DATA data;
-
- data.dsize = sizeof(struct ctdb_public_ip);
- data.dptr = (uint8_t *)talloc_zero(c, struct ctdb_public_ip);
- CTDB_NO_MEMORY(ctdb, data.dptr);
-
- memcpy(data.dptr, indata.dptr, indata.dsize);
- return ctdb_control_release_ip(ctdb, c, data, async_reply);
-}
-
-
static int ctdb_add_public_address(struct ctdb_context *ctdb,
ctdb_sock_addr *addr,
unsigned mask, const char *ifaces,
@@ -2609,7 +2572,6 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap,
{
int i, j, ret;
struct ctdb_public_ip ip;
- struct ctdb_public_ipv4 ipv4;
uint32_t *nodes;
struct ctdb_public_ip_list *all_ips, *tmp_ip;
TDB_DATA data;
@@ -2695,36 +2657,22 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap,
*/
continue;
}
- if (tmp_ip->addr.sa.sa_family == AF_INET) {
- ipv4.pnn = tmp_ip->pnn;
- ipv4.sin = tmp_ip->addr.ip;
-
- timeout = TAKEOVER_TIMEOUT();
- data.dsize = sizeof(ipv4);
- data.dptr = (uint8_t *)&ipv4;
- state = ctdb_control_send(ctdb, nodemap->nodes[i].pnn,
- 0, CTDB_CONTROL_RELEASE_IPv4, 0,
- data, async_data,
- &timeout, NULL);
- } else {
- ip.pnn = tmp_ip->pnn;
- ip.addr = tmp_ip->addr;
-
- timeout = TAKEOVER_TIMEOUT();
- data.dsize = sizeof(ip);
- data.dptr = (uint8_t *)&ip;
- state = ctdb_control_send(ctdb, nodemap->nodes[i].pnn,
- 0, CTDB_CONTROL_RELEASE_IP, 0,
- data, async_data,
- &timeout, NULL);
- }
+ ip.pnn = tmp_ip->pnn;
+ ip.addr = tmp_ip->addr;
+ timeout = TAKEOVER_TIMEOUT();
+ data.dsize = sizeof(ip);
+ data.dptr = (uint8_t *)&ip;
+ state = ctdb_control_send(ctdb, nodemap->nodes[i].pnn,
+ 0, CTDB_CONTROL_RELEASE_IP, 0,
+ data, async_data,
+ &timeout, NULL);
if (state == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_RELEASE_IP to node %u\n", nodemap->nodes[i].pnn));
talloc_free(tmp_ctx);
return -1;
}
-
+
ctdb_client_async_add(async_data, state);
}
}
@@ -2752,35 +2700,21 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap,
continue;
}
- if (tmp_ip->addr.sa.sa_family == AF_INET) {
- ipv4.pnn = tmp_ip->pnn;
- ipv4.sin = tmp_ip->addr.ip;
+ ip.pnn = tmp_ip->pnn;
+ ip.addr = tmp_ip->addr;
- timeout = TAKEOVER_TIMEOUT();
- data.dsize = sizeof(ipv4);
- data.dptr = (uint8_t *)&ipv4;
- state = ctdb_control_send(ctdb, tmp_ip->pnn,
- 0, CTDB_CONTROL_TAKEOVER_IPv4, 0,
- data, async_data,
- &timeout, NULL);
- } else {
- ip.pnn = tmp_ip->pnn;
- ip.addr = tmp_ip->addr;
-
- timeout = TAKEOVER_TIMEOUT();
- data.dsize = sizeof(ip);
- data.dptr = (uint8_t *)&ip;
- state = ctdb_control_send(ctdb, tmp_ip->pnn,
- 0, CTDB_CONTROL_TAKEOVER_IP, 0,
- data, async_data,
- &timeout, NULL);
- }
+ timeout = TAKEOVER_TIMEOUT();
+ data.dsize = sizeof(ip);
+ data.dptr = (uint8_t *)&ip;
+ state = ctdb_control_send(ctdb, tmp_ip->pnn,
+ 0, CTDB_CONTROL_TAKEOVER_IP, 0,
+ data, async_data, &timeout, NULL);
if (state == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_TAKEOVER_IP to node %u\n", tmp_ip->pnn));
talloc_free(tmp_ctx);
return -1;
}
-
+
ctdb_client_async_add(async_data, state);
}
if (ctdb_client_async_wait(ctdb, async_data) != 0) {
@@ -3283,47 +3217,6 @@ int32_t ctdb_control_get_public_ips(struct ctdb_context *ctdb,
}
-/*
- get list of public IPs, old ipv4 style. only returns ipv4 addresses
- */
-int32_t ctdb_control_get_public_ipsv4(struct ctdb_context *ctdb,
- struct ctdb_req_control *c, TDB_DATA *outdata)
-{
- int i, num, len;
- struct ctdb_all_public_ipsv4 *ips;
- struct ctdb_vnn *vnn;
-
- /* count how many public ip structures we have */
- num = 0;
- for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
- if (vnn->public_address.sa.sa_family != AF_INET) {
- continue;
- }
- num++;
- }
-
- len = offsetof(struct ctdb_all_public_ipsv4, ips) +
- num*sizeof(struct ctdb_public_ipv4);
- ips = talloc_zero_size(outdata, len);
- CTDB_NO_MEMORY(ctdb, ips);
-
- outdata->dsize = len;
- outdata->dptr = (uint8_t *)ips;
-
- ips->num = num;
- i = 0;
- for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
- if (vnn->public_address.sa.sa_family != AF_INET) {
- continue;
- }
- ips->ips[i].pnn = vnn->pnn;
- ips->ips[i].sin = vnn->public_address.ip;
- i++;
- }
-
- return 0;
-}
-
int32_t ctdb_control_get_public_ip_info(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA indata,