mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
ctdb-tests: Replace parse_ip() -> ctdb_sock_addr_from_string()
... and ctdb_sock_addr_set_port() where required. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
a0051b80d5
commit
330436bd6c
@ -37,7 +37,6 @@
|
||||
#include "protocol/protocol_util.h"
|
||||
|
||||
#include "common/comm.h"
|
||||
#include "common/system.h"
|
||||
#include "common/logging.h"
|
||||
#include "common/tunable.h"
|
||||
#include "common/srvid.h"
|
||||
@ -170,6 +169,7 @@ static bool nodemap_parse(struct node_map *node_map)
|
||||
char *ip;
|
||||
ctdb_sock_addr saddr;
|
||||
struct node *node;
|
||||
int ret;
|
||||
|
||||
if (line[0] == '\n') {
|
||||
break;
|
||||
@ -194,10 +194,12 @@ static bool nodemap_parse(struct node_map *node_map)
|
||||
fprintf(stderr, "bad line (%s) - missing IP\n", line);
|
||||
continue;
|
||||
}
|
||||
if (!parse_ip(tok, NULL, CTDB_PORT, &saddr)) {
|
||||
ret = ctdb_sock_addr_from_string(tok, &saddr, false);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "bad line (%s) - invalid IP\n", line);
|
||||
continue;
|
||||
}
|
||||
ctdb_sock_addr_set_port(&saddr, CTDB_PORT);
|
||||
ip = talloc_strdup(node_map, tok);
|
||||
if (ip == NULL) {
|
||||
goto fail;
|
||||
@ -249,7 +251,8 @@ static bool nodemap_parse(struct node_map *node_map)
|
||||
}
|
||||
node = &node_map->node[node_map->num_nodes];
|
||||
|
||||
parse_ip(ip, NULL, CTDB_PORT, &node->addr);
|
||||
ctdb_sock_addr_from_string(ip, &node->addr, false);
|
||||
ctdb_sock_addr_set_port(&node->addr, CTDB_PORT);
|
||||
node->pnn = pnn;
|
||||
node->flags = flags;
|
||||
node->capabilities = capabilities;
|
||||
@ -275,11 +278,14 @@ static bool node_map_add(struct ctdb_node_map *nodemap,
|
||||
ctdb_sock_addr addr;
|
||||
uint32_t num;
|
||||
struct ctdb_node_and_flags *n;
|
||||
int ret;
|
||||
|
||||
if (! parse_ip(nstr, NULL, CTDB_PORT, &addr)) {
|
||||
ret = ctdb_sock_addr_from_string(nstr, &addr, false);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Invalid IP address %s\n", nstr);
|
||||
return false;
|
||||
}
|
||||
ctdb_sock_addr_set_port(&addr, CTDB_PORT);
|
||||
|
||||
num = nodemap->num;
|
||||
nodemap->node = talloc_realloc(nodemap, nodemap->node,
|
||||
@ -1959,7 +1965,8 @@ static void control_reload_nodes_file(TALLOC_CTX *mem_ctx,
|
||||
node = &node_map->node[i];
|
||||
|
||||
node->flags |= NODE_FLAGS_DELETED;
|
||||
parse_ip("0.0.0.0", NULL, 0, &node->addr);
|
||||
ctdb_sock_addr_from_string("0.0.0.0", &node->addr,
|
||||
false);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
#include "lib/util/debug.h"
|
||||
|
||||
#include "protocol/protocol.h"
|
||||
#include "protocol/protocol_util.h"
|
||||
#include "common/logging.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "ipalloc_read_known_ips.h"
|
||||
|
||||
@ -69,6 +69,7 @@ static bool read_ctdb_public_ip_info_node(bool multi,
|
||||
}
|
||||
|
||||
while (fgets(line, sizeof(line), stdin) != NULL) {
|
||||
int ret;
|
||||
|
||||
/* Get rid of pesky newline */
|
||||
if ((t = strchr(line, '\n')) != NULL) {
|
||||
@ -87,7 +88,8 @@ static bool read_ctdb_public_ip_info_node(bool multi,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!parse_ip(tok, NULL, 0, &addr)) {
|
||||
ret = ctdb_sock_addr_from_string(tok, &addr, false);
|
||||
if (ret != 0) {
|
||||
D_ERR("ERROR, bad address :%s\n", tok);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user