diff options
author | Martin Schwenke <martin@meltin.net> | 2015-02-20 11:47:23 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2015-03-23 12:23:12 +0100 |
commit | a5be2c245d5634695bd23387913c7e2e2481879b (patch) | |
tree | 3d891e1e738045b5fd52a1dbd3b8a93315f6228c /ctdb/common/system_util.c | |
parent | 3cbeb17d0f9f1e4b6a3faa9aba2982793cf8494b (diff) | |
download | samba-a5be2c245d5634695bd23387913c7e2e2481879b.tar.gz |
ctdb-daemon: Store node addresses as ctdb_sock_addr rather than strings
Every time a nodemap is contructed the node IP addresses all need to
be parsed. This isn't very productive use of CPU.
Instead, parse each string once when the nodes file is loaded. This
results in much simpler code.
This code also removes the use of ctdb_address. Duplicating the port
is pointless without an abstraction layer around ctdb_address. If
CTDB gets an incompatible transport in the future then add an
abstraction layer.
Note that the infiniband code is not updated. Compilation of the
infiniband code is already broken. Fixing it will be a separate,
properly tested effort.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/common/system_util.c')
-rw-r--r-- | ctdb/common/system_util.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ctdb/common/system_util.c b/ctdb/common/system_util.c index 6ff82f7147b..1ae0bae8039 100644 --- a/ctdb/common/system_util.c +++ b/ctdb/common/system_util.c @@ -156,6 +156,9 @@ bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin) return false; } +#ifdef HAVE_SOCK_SIN_LEN + sin->ip.sin_len = sizeof(*sin); +#endif return true; } @@ -181,6 +184,9 @@ static bool parse_ipv6(const char *s, const char *ifaces, unsigned port, ctdb_so saddr->ip6.sin6_scope_id = if_nametoindex(ifaces); } +#ifdef HAVE_SOCK_SIN_LEN + saddr->ip6.sin6_len = sizeof(*saddr); +#endif return true; } |