The branch, master has been updated
       via  e1a8c9b ctdb-common: Make parse_ip() and parse_ipv4() static
       via  c98691c ctdb-common: Replace parse_ip() -> 
ctdb_sock_addr_from_string()
       via  330436b ctdb-tests: Replace parse_ip() -> 
ctdb_sock_addr_from_string()
       via  a0051b8 ctdb-tools: Replace parse_ip() -> 
ctdb_sock_addr_from_string()
       via  4683ef2 ctdb-common: Remove unused function parse_ip_port()
       via  3ee9822 ctdb-tools: Replace parse_ip_port() -> 
ctdb_sock_addr_from_string()
       via  cadd0d5 ctdb-common: Remove unused function ctdb_parse_connections()
       via  96e3ea5 ctdb-tools: Use ctdb_connection_list_read()
       via  ddd9755 ctdb-common: Do not queue a packet if queue does not have 
valid fd
       via  bf11bea ctdb-tests: Send broadcast to connected nodes, not 
configured nodes
       via  70d3063 ctdb-daemon: Send broadcast to connected nodes, not 
configured nodes
      from  b07f221 s3: VFS: Ensure default SMB_VFS_GETWD() call can't return a 
partially completed struct smb_filename.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e1a8c9b27014f4f576d1508de4b380b7517c0861
Author: Martin Schwenke <[email protected]>
Date:   Tue Sep 19 23:51:21 2017 +1000

    ctdb-common: Make parse_ip() and parse_ipv4() static
    
    parse_ip() has interface checking for IPv6 that is still used
    indirectly by the IP takeover code via parse_ip_mask().  This will be
    removed eventually.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>
    
    Autobuild-User(master): Martin Schwenke <[email protected]>
    Autobuild-Date(master): Thu Oct  5 09:19:31 CEST 2017 on sn-devel-144

commit c98691c340e3463d90279014bbdc4e71da61de85
Author: Martin Schwenke <[email protected]>
Date:   Tue Sep 19 23:44:31 2017 +1000

    ctdb-common: Replace parse_ip() -> ctdb_sock_addr_from_string()
    
    ... and ctdb_sock_addr_set_port().
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit 330436bd6ca4ec2700fd3b493bfd569c4ec81e4e
Author: Martin Schwenke <[email protected]>
Date:   Tue Sep 19 23:38:31 2017 +1000

    ctdb-tests: Replace parse_ip() -> ctdb_sock_addr_from_string()
    
    ... and ctdb_sock_addr_set_port() where required.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit a0051b80d5126cca879bb1add24212020f9d5810
Author: Martin Schwenke <[email protected]>
Date:   Tue Sep 19 23:28:45 2017 +1000

    ctdb-tools: Replace parse_ip() -> ctdb_sock_addr_from_string()
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit 4683ef28ab9674f49fa050075186011a671d4c85
Author: Martin Schwenke <[email protected]>
Date:   Tue Sep 19 23:19:00 2017 +1000

    ctdb-common: Remove unused function parse_ip_port()
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit 3ee9822f9d776fcc57978e426c9ae8187cd5b1c6
Author: Martin Schwenke <[email protected]>
Date:   Tue Sep 19 23:17:36 2017 +1000

    ctdb-tools: Replace parse_ip_port() -> ctdb_sock_addr_from_string()
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit cadd0d51fb2fe861291f54cd8fc896c86bf76883
Author: Martin Schwenke <[email protected]>
Date:   Tue Sep 19 23:12:15 2017 +1000

    ctdb-common: Remove unused function ctdb_parse_connections()
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit 96e3ea54621f04f84b10b34caa0a1c13cb3a885b
Author: Martin Schwenke <[email protected]>
Date:   Tue Sep 19 23:10:55 2017 +1000

    ctdb-tools: Use ctdb_connection_list_read()
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit ddd97553f0a8bfaada178ec4a7460d76fa21f079
Author: Amitay Isaacs <[email protected]>
Date:   Fri Sep 29 14:23:24 2017 +1000

    ctdb-common: Do not queue a packet if queue does not have valid fd
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13056
    
    The only time a ctdb_queue is created without valid fd is when CTDB
    is trying to establish connections with other nodes in the cluster.
    All the other uses always create a ctdb_queue with valid fd.
    
    This avoids queueing up packets for dead nodes or nodes that are not
    running in the cluster and stops consuming memory.
    
    Signed-off-by: Amitay Isaacs <[email protected]>
    Reviewed-by: Martin Schwenke <[email protected]>

commit bf11bea5dbb589186a205fa1d81368cc89a6139b
Author: Amitay Isaacs <[email protected]>
Date:   Thu Sep 28 11:47:24 2017 +1000

    ctdb-tests: Send broadcast to connected nodes, not configured nodes
    
    https://bugzilla.samba.org/show_bug.cgi?id=13056
    
    Signed-off-by: Amitay Isaacs <[email protected]>
    Reviewed-by: Martin Schwenke <[email protected]>

commit 70d306373e80eafe3a356c60a823a2577001d7d1
Author: Amitay Isaacs <[email protected]>
Date:   Thu Sep 28 11:47:00 2017 +1000

    ctdb-daemon: Send broadcast to connected nodes, not configured nodes
    
    https://bugzilla.samba.org/show_bug.cgi?id=13056
    
    Database recovery takes care of attaching missing databases on all the 
nodes.
    
    Signed-off-by: Amitay Isaacs <[email protected]>
    Reviewed-by: Martin Schwenke <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/common/ctdb_io.c                   |   5 ++
 ctdb/common/ctdb_util.c                 |   7 ++-
 ctdb/common/system.h                    |   7 ---
 ctdb/common/system_util.c               | 102 +-------------------------------
 ctdb/server/ctdb_ltdb_server.c          |   5 +-
 ctdb/tests/src/cluster_wait.c           |   2 +-
 ctdb/tests/src/fake_ctdbd.c             |  17 ++++--
 ctdb/tests/src/ipalloc_read_known_ips.c |   6 +-
 ctdb/tools/ctdb.c                       |  86 ++++++++++++++++-----------
 ctdb/wscript                            |   3 +-
 10 files changed, 86 insertions(+), 154 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c
index 152d535..3e732e8 100644
--- a/ctdb/common/ctdb_io.c
+++ b/ctdb/common/ctdb_io.c
@@ -300,6 +300,11 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t 
*data, uint32_t length)
        struct ctdb_queue_pkt *pkt;
        uint32_t length2, full_length;
 
+       /* If the queue does not have valid fd, no point queueing a packet */
+       if (queue->fd == -1) {
+               return 0;
+       }
+
        if (queue->alignment) {
                /* enforce the length and alignment rules from the tcp packet 
allocator */
                length2 = (length+(queue->alignment-1)) & ~(queue->alignment-1);
diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c
index 72358ca..901e5e2 100644
--- a/ctdb/common/ctdb_util.c
+++ b/ctdb/common/ctdb_util.c
@@ -29,6 +29,8 @@
 
 #include "ctdb_private.h"
 
+#include "protocol/protocol_util.h"
+
 #include "common/reqid.h"
 #include "common/system.h"
 #include "common/common.h"
@@ -172,6 +174,7 @@ int ctdb_parse_address(TALLOC_CTX *mem_ctx, const char *str,
 {
        struct servent *se;
        int port;
+       int ret;
 
        setservent(0);
        se = getservbyname("ctdb", "tcp");
@@ -183,9 +186,11 @@ int ctdb_parse_address(TALLOC_CTX *mem_ctx, const char 
*str,
                port = ntohs(se->s_port);
        }
 
-       if (! parse_ip(str, NULL, port, address)) {
+       ret = ctdb_sock_addr_from_string(str, address, false);
+       if (ret != 0) {
                return -1;
        }
+       ctdb_sock_addr_set_port(address, port);
 
        return 0;
 }
diff --git a/ctdb/common/system.h b/ctdb/common/system.h
index 2875760..ae01c58 100644
--- a/ctdb/common/system.h
+++ b/ctdb/common/system.h
@@ -48,12 +48,8 @@ int ctdb_get_peer_pid(const int fd, pid_t *peer_pid);
 bool set_scheduler(void);
 void reset_scheduler(void);
 
-bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin);
-bool parse_ip(const char *addr, const char *ifaces, unsigned port,
-             ctdb_sock_addr *saddr);
 bool parse_ip_mask(const char *str, const char *ifaces, ctdb_sock_addr *addr,
                   unsigned *mask);
-bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr);
 
 void lockdown_memory(bool valgrinding);
 
@@ -62,7 +58,4 @@ void mkdir_p_or_die(const char *dir, int mode);
 
 void ctdb_wait_for_process_to_exit(pid_t pid);
 
-int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx,
-                          int *num_conn, struct ctdb_connection **out);
-
 #endif /* __CTDB_SYSTEM_H__ */
diff --git a/ctdb/common/system_util.c b/ctdb/common/system_util.c
index 96ea71d..63dcd53 100644
--- a/ctdb/common/system_util.c
+++ b/ctdb/common/system_util.c
@@ -114,7 +114,7 @@ void reset_scheduler(void)
 #endif
 }
 
-bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin)
+static bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin)
 {
        sin->sin_family = AF_INET;
        sin->sin_port   = htons(port);
@@ -161,7 +161,8 @@ static bool parse_ipv6(const char *s, const char *ifaces, 
unsigned port, ctdb_so
 /*
   parse an ip
  */
-bool parse_ip(const char *addr, const char *ifaces, unsigned port, 
ctdb_sock_addr *saddr)
+static bool parse_ip(const char *addr, const char *ifaces, unsigned port,
+                    ctdb_sock_addr *saddr)
 {
        char *p;
        bool ret;
@@ -244,46 +245,6 @@ bool parse_ip_mask(const char *str, const char *ifaces, 
ctdb_sock_addr *addr, un
        return ret;
 }
 
-/*
-  parse a ip:port pair
- */
-bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr)
-{
-       char *p;
-       char s[64]; /* Much longer than INET6_ADDRSTRLEN */
-       unsigned port;
-       char *endp = NULL;
-       ssize_t len;
-       bool ret;
-
-       len = strlen(addr);
-       if (len >= sizeof(s)) {
-               DEBUG(DEBUG_ERR, ("Address %s is unreasonably long\n", addr));
-               return false;
-       }
-
-       strncpy(s, addr, len+1);
-
-       p = rindex(s, ':');
-       if (p == NULL) {
-               DEBUG(DEBUG_ERR, (__location__ " This addr: %s does not contain 
a port number\n", s));
-               return false;
-       }
-
-       port = strtoul(p+1, &endp, 10);
-       if (endp == NULL || *endp != 0) {
-               /* trailing garbage */
-               DEBUG(DEBUG_ERR, (__location__ " Trailing garbage after the 
port in %s\n", s));
-               return false;
-       }
-       *p = 0;
-
-       /* now is this a ipv4 or ipv6 address ?*/
-       ret = parse_ip(s, NULL, port, saddr);
-
-       return ret;
-}
-
 /* we don't lock future pages here; it would increase the chance that
  * we'd fail to mmap later on. */
 void lockdown_memory(bool valgrinding)
@@ -378,60 +339,3 @@ void ctdb_wait_for_process_to_exit(pid_t pid)
                sleep(5);
        }
 }
-
-int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx,
-                          int *num_conn, struct ctdb_connection **out)
-{
-       struct ctdb_connection *conn = NULL;
-       char line[128], src[128], dst[128]; /* long enough for IPv6 */
-       int line_num, ret;
-       int num = 0, max = 0;
-
-       line_num = 0;
-       while (! feof(fp)) {
-               if (fgets(line, sizeof(line), fp) == NULL) {
-                       break;
-               }
-               line_num += 1;
-
-               /* Skip empty lines */
-               if (line[0] == '\n') {
-                       continue;
-               }
-
-               ret = sscanf(line, "%s %s\n", src, dst);
-               if (ret != 2) {
-                       DEBUG(DEBUG_ERR, ("Bad line [%d]: %s\n",
-                                         line_num, line));
-                       talloc_free(conn);
-                       return EINVAL;
-               }
-
-               if (num >= max) {
-                       max += 1024;
-                       conn = talloc_realloc(mem_ctx, conn,
-                                             struct ctdb_connection, max);
-                       if (conn == NULL) {
-                               return ENOMEM;
-                       }
-               }
-
-               if (! parse_ip_port(src, &conn[num].src)) {
-                       DEBUG(DEBUG_ERR, ("Invalid IP address %s\n", src));
-                       talloc_free(conn);
-                       return EINVAL;
-               }
-
-               if (! parse_ip_port(dst, &conn[num].dst)) {
-                       DEBUG(DEBUG_ERR, ("Invalid IP address %s\n", dst));
-                       talloc_free(conn);
-                       return EINVAL;
-               }
-
-               num += 1;
-       }
-
-       *num_conn = num;
-       *out = conn;
-       return 0;
-}
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c
index d837838..c199aac 100644
--- a/ctdb/server/ctdb_ltdb_server.c
+++ b/ctdb/server/ctdb_ltdb_server.c
@@ -1206,7 +1206,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, 
TDB_DATA indata,
        }
 
        /* tell all the other nodes about this database */
-       ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, 0, opcode,
+       ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_CONNECTED, 0, opcode,
                                 0, CTDB_CTRL_FLAG_NOREPLY,
                                 indata, NULL, NULL);
 
@@ -1260,7 +1260,8 @@ int32_t ctdb_control_db_detach(struct ctdb_context *ctdb, 
TDB_DATA indata,
                client = reqid_find(ctdb->idr, client_id, struct ctdb_client);
                if (client != NULL) {
                        /* forward the control to all the nodes */
-                       ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, 0,
+                       ctdb_daemon_send_control(ctdb,
+                                                CTDB_BROADCAST_CONNECTED, 0,
                                                 CTDB_CONTROL_DB_DETACH, 0,
                                                 CTDB_CTRL_FLAG_NOREPLY,
                                                 indata, NULL, NULL);
diff --git a/ctdb/tests/src/cluster_wait.c b/ctdb/tests/src/cluster_wait.c
index 1405738..ecd2efd 100644
--- a/ctdb/tests/src/cluster_wait.c
+++ b/ctdb/tests/src/cluster_wait.c
@@ -264,7 +264,7 @@ static void cluster_wait_join_unregistered(struct 
tevent_req *subreq)
        msg.data.data = tdb_null;
 
        subreq = ctdb_client_message_send(state, state->ev, state->client,
-                                         CTDB_BROADCAST_ALL, &msg);
+                                         CTDB_BROADCAST_CONNECTED, &msg);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
diff --git a/ctdb/tests/src/fake_ctdbd.c b/ctdb/tests/src/fake_ctdbd.c
index 98aacbe..06b5b22 100644
--- a/ctdb/tests/src/fake_ctdbd.c
+++ b/ctdb/tests/src/fake_ctdbd.c
@@ -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;
                }
diff --git a/ctdb/tests/src/ipalloc_read_known_ips.c 
b/ctdb/tests/src/ipalloc_read_known_ips.c
index 5725d6d..354f7ec 100644
--- a/ctdb/tests/src/ipalloc_read_known_ips.c
+++ b/ctdb/tests/src/ipalloc_read_known_ips.c
@@ -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;
                }
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index a135da2..a5cfaf4 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -382,8 +382,10 @@ 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, 0, &addr)) {
+       ret = ctdb_sock_addr_from_string(nstr, &addr, false);
+       if (ret != 0) {
                fprintf(stderr, "Invalid IP address %s\n", nstr);
                return false;
        }
@@ -1714,7 +1716,8 @@ static int control_ipinfo(TALLOC_CTX *mem_ctx, struct 
ctdb_context *ctdb,
                usage("ipinfo");
        }
 
-       if (! parse_ip(argv[0], NULL, 0, &addr)) {
+       ret = ctdb_sock_addr_from_string(argv[0], &addr, false);
+       if (ret != 0) {
                fprintf(stderr, "Invalid IP address %s\n", argv[0]);
                return 1;
        }
@@ -2984,7 +2987,8 @@ static int control_gratarp(TALLOC_CTX *mem_ctx, struct 
ctdb_context *ctdb,
                usage("gratarp");
        }
 
-       if (! parse_ip(argv[0], NULL, 0, &addr_info.addr)) {
+       ret = ctdb_sock_addr_from_string(argv[0], &addr_info.addr, false);
+       if (ret != 0) {
                fprintf(stderr, "Invalid IP address %s\n", argv[0]);
                return 1;
        }
@@ -3013,19 +3017,19 @@ static int control_tickle(TALLOC_CTX *mem_ctx, struct 
ctdb_context *ctdb,
        }
 
        if (argc == 0) {
-               struct ctdb_connection *clist;
-               int count;
+               struct ctdb_connection_list *clist;
                int i, num_failed;
 
-               ret = ctdb_parse_connections(stdin, mem_ctx, &count, &clist);
+               /* Client first but the src/dst logic is confused */
+               ret = ctdb_connection_list_read(mem_ctx, false, &clist);
                if (ret != 0) {
                        return ret;
                }
 
                num_failed = 0;
-               for (i=0; i<count; i++) {
-                       ret = ctdb_sys_send_tcp(&clist[i].src,
-                                               &clist[i].dst,
+               for (i = 0; i < clist->num; i++) {
+                       ret = ctdb_sys_send_tcp(&clist->conn[i].src,
+                                               &clist->conn[i].dst,
                                                0, 0, 0);
                        if (ret != 0) {
                                num_failed += 1;
@@ -3044,12 +3048,14 @@ static int control_tickle(TALLOC_CTX *mem_ctx, struct 
ctdb_context *ctdb,
        }
 
 
-       if (! parse_ip_port(argv[0], &src)) {
+       ret = ctdb_sock_addr_from_string(argv[0], &src, true);
+       if (ret != 0) {
                fprintf(stderr, "Invalid IP address %s\n", argv[0]);
                return 1;
        }
 
-       if (! parse_ip_port(argv[1], &dst)) {
+       ret = ctdb_sock_addr_from_string(argv[1], &dst, true);
+       if (ret != 0) {
                fprintf(stderr, "Invalid IP address %s\n", argv[1]);
                return 1;
        }
@@ -3079,10 +3085,12 @@ static int control_gettickles(TALLOC_CTX *mem_ctx, 
struct ctdb_context *ctdb,
                port = strtoul(argv[1], NULL, 10);
        }
 
-       if (! parse_ip(argv[0], NULL, port, &addr)) {
+       ret = ctdb_sock_addr_from_string(argv[0], &addr, false);
+       if (ret != 0) {
                fprintf(stderr, "Invalid IP address %s\n", argv[0]);
                return 1;
        }
+       ctdb_sock_addr_set_port(&addr, port);
 
        ret = ctdb_ctrl_get_tcp_tickle_list(mem_ctx, ctdb->ev, ctdb->client,
                                            ctdb->cmd_pnn, TIMEOUT(), &addr,
@@ -3136,7 +3144,7 @@ typedef void (*clist_request_func)(struct 
ctdb_req_control *request,
 typedef int (*clist_reply_func)(struct ctdb_reply_control *reply);
 
 struct process_clist_state {
-       struct ctdb_connection *clist;
+       struct ctdb_connection_list *clist;
        int count;
        int num_failed, num_total;
        clist_reply_func reply_func;
@@ -3147,8 +3155,7 @@ static void process_clist_done(struct tevent_req *subreq);
 static struct tevent_req *process_clist_send(
                                        TALLOC_CTX *mem_ctx,
                                        struct ctdb_context *ctdb,
-                                       struct ctdb_connection *clist,
-                                       int count,
+                                       struct ctdb_connection_list *clist,
                                        clist_request_func request_func,
                                        clist_reply_func reply_func)
 {
@@ -3163,11 +3170,10 @@ static struct tevent_req *process_clist_send(
        }
 
        state->clist = clist;
-       state->count = count;
        state->reply_func = reply_func;
 
-       for (i=0; i<count; i++) {
-               request_func(&request, &clist[i]);
+       for (i = 0; i < clist->num; i++) {
+               request_func(&request, &clist->conn[i]);
                subreq = ctdb_client_control_send(state, ctdb->ev,
                                                  ctdb->client, ctdb->cmd_pnn,
                                                  TIMEOUT(), &request);
@@ -3205,7 +3211,7 @@ static void process_clist_done(struct tevent_req *subreq)
 
 done:
        state->num_total += 1;
-       if (state->num_total == state->count) {
+       if (state->num_total == state->clist->num) {
                tevent_req_done(req);
        }
 }
@@ -3229,19 +3235,19 @@ static int control_addtickle(TALLOC_CTX *mem_ctx, 
struct ctdb_context *ctdb,
        }
 
        if (argc == 0) {
-               struct ctdb_connection *clist;
+               struct ctdb_connection_list *clist;
                struct tevent_req *req;
-               int count;
 
-               ret = ctdb_parse_connections(stdin, mem_ctx, &count, &clist);
+               /* Client first but the src/dst logic is confused */
+               ret = ctdb_connection_list_read(mem_ctx, false, &clist);
                if (ret != 0) {
                        return ret;
                }
-               if (count == 0) {
+               if (clist->num == 0) {
                        return 0;
                }
 
-               req = process_clist_send(mem_ctx, ctdb, clist, count,


-- 
Samba Shared Repository

Reply via email to