1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

ctdb-daemon: Store public address string in VNN

These are currently converted to strings constantly in log messages
and other places.  This clutters the code and probably has a minor
performance impact.

Add a new string field to the VNN structure.  Populate it when a
public address is added and the VNN structure is allocated.  This is
consistent with how node addresses are handled.

Don't use it yet, or this commit becomes huge.

A short-term goal is that each VNN public address will be converted to
a string only once.  A longer-term goal is to reduce use of
ctdb_addr_to_str().

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
This commit is contained in:
Martin Schwenke 2024-07-25 14:40:18 +10:00 committed by Anoop C S
parent ef3d9c227f
commit 766e6d35c4

View File

@ -74,6 +74,7 @@ struct ctdb_vnn {
struct vnn_interface *ifaces;
ctdb_sock_addr public_address;
uint8_t public_netmask_bits;
const char *name;
/*
* The node number that is serving this public address - set
@ -1072,6 +1073,14 @@ static int ctdb_add_public_address(struct ctdb_context *ctdb,
DBG_ERR("Memory allocation error\n");
return -1;
}
vnn->name = ctdb_sock_addr_to_string(vnn, addr, false);
if (vnn->name == NULL) {
DBG_ERR("Memory allocation error\n");
talloc_free(vnn);
return -1;
}
tmp = talloc_strdup(vnn, ifaces);
if (tmp == NULL) {
DBG_ERR("Memory allocation error\n");