mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-24 03:20:39 +02:00
l3cfg: add nm_l3_config_data_set_source()
It's useful to have a NML3ConfigData track the source. Previously, NMIP4Config tracks the source per MTU. But the source really belongs to the entire setting.
This commit is contained in:
parent
9798a90d53
commit
60ad076094
2 changed files with 23 additions and 0 deletions
|
|
@ -109,6 +109,8 @@ struct _NML3ConfigData {
|
|||
|
||||
NML3ConfigDatFlags flags;
|
||||
|
||||
NMIPConfigSource source;
|
||||
|
||||
guint32 mtu;
|
||||
|
||||
NMTernary metered:3;
|
||||
|
|
@ -376,6 +378,7 @@ nm_l3_config_data_new (NMDedupMultiIndex *multi_idx,
|
|||
.metered = NM_TERNARY_DEFAULT,
|
||||
.route_table_sync_4 = NM_IP_ROUTE_TABLE_SYNC_MODE_NONE,
|
||||
.route_table_sync_6 = NM_IP_ROUTE_TABLE_SYNC_MODE_NONE,
|
||||
.source = NM_IP_CONFIG_SOURCE_UNKNOWN,
|
||||
};
|
||||
|
||||
_idx_type_init (&self->idx_addresses_4, NMP_OBJECT_TYPE_IP4_ADDRESS);
|
||||
|
|
@ -1114,6 +1117,19 @@ nm_l3_config_data_set_mtu (NML3ConfigData *self,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_l3_config_data_set_source (NML3ConfigData *self,
|
||||
NMIPConfigSource source)
|
||||
{
|
||||
nm_assert (_NM_IS_L3_CONFIG_DATA (self, FALSE));
|
||||
|
||||
if (self->source == source)
|
||||
return FALSE;
|
||||
|
||||
self->source = source;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int
|
||||
|
|
@ -1197,6 +1213,8 @@ nm_l3_config_data_cmp (const NML3ConfigData *a, const NML3ConfigData *b)
|
|||
NM_CMP_DIRECT (a->mtu, b->mtu);
|
||||
NM_CMP_DIRECT_UNSAFE (a->metered, b->metered);
|
||||
|
||||
NM_CMP_FIELD (a, b, source);
|
||||
|
||||
/* these fields are not considered by cmp():
|
||||
*
|
||||
* - multi_idx
|
||||
|
|
@ -1914,6 +1932,8 @@ _init_merge (NML3ConfigData *self,
|
|||
self->mtu = src->mtu;
|
||||
self->flags |= NM_L3_CONFIG_DAT_FLAGS_HAS_MTU;
|
||||
}
|
||||
|
||||
/* self->source does not get merged. */
|
||||
}
|
||||
|
||||
NML3ConfigData *
|
||||
|
|
|
|||
|
|
@ -235,6 +235,9 @@ nm_l3_config_data_unset_flags (NML3ConfigData *self,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean nm_l3_config_data_set_source (NML3ConfigData *self,
|
||||
NMIPConfigSource source);
|
||||
|
||||
gboolean nm_l3_config_data_add_address_full (NML3ConfigData *self,
|
||||
int addr_family,
|
||||
const NMPObject *obj_new,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue