ctdb-common: Replace parse_ip() -> ctdb_sock_addr_from_string()
authorMartin Schwenke <martin@meltin.net>
Tue, 19 Sep 2017 13:44:31 +0000 (23:44 +1000)
committerMartin Schwenke <martins@samba.org>
Thu, 5 Oct 2017 03:19:21 +0000 (05:19 +0200)
... and ctdb_sock_addr_set_port().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/ctdb_util.c
ctdb/wscript

index 72358ca7e729ebe6b4812e75f91a378a6929411f..901e5e2a6301384af83fefd0f6075d59953d4173 100644 (file)
@@ -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;
 }
index 0523bde5449f7ec1d31fabe1a2653f486ce2e2ba..255dbdc39780d2d66bcdda67030c11b2c226479e 100644 (file)
@@ -377,7 +377,8 @@ def build(bld):
                                           '''ctdb_io.c ctdb_util.c ctdb_ltdb.c
                                              sock_io.c'''),
                         includes='include',
-                        deps='replace popt talloc tevent tdb popt ctdb-system')
+                        deps='''replace popt talloc tevent tdb popt ctdb-system
+                                ctdb-protocol-util''')
 
     bld.SAMBA_SUBSYSTEM('ctdb-util',
                         source=bld.SUBDIR('common',