mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 04:50:30 +01:00
initrd: add a 'origin' user tag to connections
Introduce a user tag key to indicate where the connection comes from. It would also be possible to have this as a standard property (as 'connection.origin'), but since this information can be considered 'meta-data' I think the user setting is more appropriate.
This commit is contained in:
parent
df2fe15714
commit
86f22ce8ba
2 changed files with 13 additions and 0 deletions
|
|
@ -60,6 +60,7 @@
|
|||
#include "nm-setting-team-port.h"
|
||||
#include "nm-setting-team.h"
|
||||
#include "nm-setting-tun.h"
|
||||
#include "nm-setting-user.h"
|
||||
#include "nm-setting-veth.h"
|
||||
#include "nm-setting-vlan.h"
|
||||
#include "nm-setting-vpn.h"
|
||||
|
|
@ -80,6 +81,10 @@
|
|||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-glib-aux/nm-value-type.h"
|
||||
|
||||
#define NM_USER_TAG_ORIGIN "org.freedesktop.NetworkManager.origin"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* NM_SETTING_COMPARE_FLAG_INFERRABLE: check whether a device-generated
|
||||
* connection can be replaced by a already-defined connection. This flag only
|
||||
* takes into account properties marked with the %NM_SETTING_PARAM_INFERRABLE
|
||||
|
|
|
|||
|
|
@ -35,6 +35,14 @@ output_conn(gpointer key, gpointer value, gpointer user_data)
|
|||
gs_free char * data = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
gsize len;
|
||||
NMSetting * setting;
|
||||
|
||||
setting = nm_setting_user_new();
|
||||
nm_connection_add_setting(connection, setting);
|
||||
nm_setting_user_set_data(NM_SETTING_USER(setting),
|
||||
NM_USER_TAG_ORIGIN,
|
||||
"nm-initrd-generator",
|
||||
NULL);
|
||||
|
||||
if (!nm_connection_normalize(connection, NULL, NULL, &error))
|
||||
goto err_out;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue