mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-01 22:00:48 +01:00
l3cfg: add helper function to fetch all the IPv4 configured addresses
This function would be useful when performing operations related to the
IPv4 addresses configured on the l3cfg. E.g this function will be used
for getting the IPv4 to announce on a GARP on bonding-slb when one of
the ports failover.
(cherry picked from commit 69f3493670)
This commit is contained in:
parent
55261eb112
commit
bfe2047acc
2 changed files with 26 additions and 0 deletions
|
|
@ -5419,6 +5419,30 @@ nm_l3cfg_get_best_default_route(NML3Cfg *self, int addr_family, gboolean get_com
|
|||
return nm_l3_config_data_get_best_default_route(l3cd, addr_family);
|
||||
}
|
||||
|
||||
in_addr_t *
|
||||
nm_l3cfg_get_configured_ip4_addresses(NML3Cfg *self, gsize *out_len)
|
||||
{
|
||||
GArray *array = NULL;
|
||||
NMDedupMultiIter iter;
|
||||
const NMPObject *obj;
|
||||
const NML3ConfigData *l3cd;
|
||||
|
||||
l3cd = nm_l3cfg_get_combined_l3cd(self, FALSE);
|
||||
|
||||
if (!l3cd)
|
||||
return NULL;
|
||||
|
||||
array = g_array_new(FALSE, FALSE, sizeof(in_addr_t));
|
||||
|
||||
nm_l3_config_data_iter_obj_for_each (&iter, l3cd, &obj, NMP_OBJECT_TYPE_IP4_ADDRESS) {
|
||||
in_addr_t tmp = NMP_OBJECT_CAST_IP4_ADDRESS(obj)->address;
|
||||
nm_g_array_append_simple(array, tmp);
|
||||
}
|
||||
|
||||
*out_len = array->len;
|
||||
return NM_CAST_ALIGN(in_addr_t, g_array_free(array, FALSE));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean
|
||||
|
|
|
|||
|
|
@ -441,6 +441,8 @@ const NML3ConfigData *nm_l3cfg_get_combined_l3cd(NML3Cfg *self, gboolean get_com
|
|||
const NMPObject *
|
||||
nm_l3cfg_get_best_default_route(NML3Cfg *self, int addr_family, gboolean get_commited);
|
||||
|
||||
in_addr_t *nm_l3cfg_get_configured_ip4_addresses(NML3Cfg *self, gsize *out_len);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean nm_l3cfg_has_commited_ip6_addresses_pending_dad(NML3Cfg *self);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue