diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-10-08 18:26:45 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2015-10-12 14:44:31 +0200 |
commit | 5966e14abf589f821ddd58e7608b2e66dbb16457 (patch) | |
tree | 764f8dc55d4d5e1ccee6b5400c35ee10e7e08cdd | |
parent | 6f41f42533a06855878cab8f830e3de59d6b74ee (diff) | |
download | NetworkManager-5966e14abf589f821ddd58e7608b2e66dbb16457.tar.gz |
ifcfg-rh: add support for 'LLDP' connection property
-rw-r--r-- | libnm-core/nm-setting-connection.c | 9 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/reader.c | 8 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/writer.c | 12 |
3 files changed, 29 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c index af67c64c71..f341a3987d 100644 --- a/libnm-core/nm-setting-connection.c +++ b/libnm-core/nm-setting-connection.c @@ -1736,6 +1736,15 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) * * Since: 1.2 **/ + /* ---ifcfg-rh--- + * property: lldp + * variable: LLDP + * values: boolean value or 'rx' + * default: missing variable means global default + * description: whether LLDP is enabled for the connection + * example: LLDP=no + * ---end--- + */ g_object_class_install_property (object_class, PROP_LLDP, g_param_spec_int (NM_SETTING_CONNECTION_LLDP, "", "", diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 78eaefcb7f..5a29e924ea 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -128,6 +128,7 @@ make_connection_setting (const char *file, const char *prefix) { NMSettingConnection *s_con; + NMSettingConnectionLldp lldp; const char *ifcfg_name = NULL; char *new_id, *uuid = NULL, *zone = NULL, *value; @@ -165,6 +166,12 @@ make_connection_setting (const char *file, g_free (value); } + value = svGetValue (ifcfg, "LLDP", FALSE); + if (!g_strcmp0 (value, "rx")) + lldp = NM_SETTING_CONNECTION_LLDP_ENABLE_RX; + else + lldp = svParseBoolean (value, NM_SETTING_CONNECTION_LLDP_DEFAULT); + /* Missing ONBOOT is treated as "ONBOOT=true" by the old network service */ g_object_set (s_con, NM_SETTING_CONNECTION_AUTOCONNECT, @@ -176,6 +183,7 @@ make_connection_setting (const char *file, NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT), NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, svGetValueBoolean (ifcfg, "AUTOCONNECT_SLAVES", NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT), + NM_SETTING_CONNECTION_LLDP, lldp, NULL); value = svGetValue (ifcfg, "USERS", FALSE); diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index e6e68bce5f..376f38c0bd 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -1772,6 +1772,18 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) FALSE); } + switch (nm_setting_connection_get_lldp (s_con)) { + case NM_SETTING_CONNECTION_LLDP_ENABLE_RX: + tmp = "rx"; + break; + case NM_SETTING_CONNECTION_LLDP_DISABLE: + tmp = "no"; + break; + default: + tmp = NULL; + } + svSetValue (ifcfg, "LLDP", tmp, FALSE); + /* Permissions */ svSetValue (ifcfg, "USERS", NULL, FALSE); n = nm_setting_connection_get_num_permissions (s_con); |