diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-05-29 17:41:21 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2015-06-09 18:18:45 +0200 |
commit | 7e5e624dafc9ad4e6ec2dc32cc0d7013476ca2c6 (patch) | |
tree | 34e9930f5687d19e9ad6d281e484c646fd775386 | |
parent | 862fd91df06087257dfa2b647172bafc60328487 (diff) | |
download | NetworkManager-7e5e624dafc9ad4e6ec2dc32cc0d7013476ca2c6.tar.gz |
ifcfg-rh: add support for CONNECTION_METERED
-rw-r--r-- | libnm-core/nm-setting-connection.c | 8 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/reader.c | 9 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/writer.c | 11 |
3 files changed, 28 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c index b2274d36b0..5812a0a442 100644 --- a/libnm-core/nm-setting-connection.c +++ b/libnm-core/nm-setting-connection.c @@ -1612,6 +1612,14 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) * * Since: 1.2 **/ + /* ---ifcfg-rh--- + * property: metered + * variable: CONNECTION_METERED + * values: yes,no,unknown + * description: Whether the device is metered + * example: CONNECTION_METERED=yes + * ---end--- + */ g_object_class_install_property (object_class, PROP_METERED, g_param_spec_enum (NM_SETTING_CONNECTION_METERED, "", "", diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 71bb2b942d..2387be3fcd 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -248,6 +248,15 @@ make_connection_setting (const char *file, g_free (value); } + switch (svTrueValue (ifcfg, "CONNECTION_METERED", -1)) { + case TRUE: + g_object_set (s_con, NM_SETTING_CONNECTION_METERED, NM_METERED_YES, NULL); + break; + case FALSE: + g_object_set (s_con, NM_SETTING_CONNECTION_METERED, NM_METERED_NO, NULL); + break; + } + return NM_SETTING (s_con); } diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index e432d1b95e..df2308e405 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -1777,6 +1777,17 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) svSetValue (ifcfg, "GATEWAY_PING_TIMEOUT", tmp, FALSE); g_free (tmp); } + + switch (nm_setting_connection_get_metered (s_con)) { + case NM_METERED_YES: + svSetValue (ifcfg, "CONNECTION_METERED", "yes", FALSE); + break; + case NM_METERED_NO: + svSetValue (ifcfg, "CONNECTION_METERED", "no", FALSE); + break; + default: + svSetValue (ifcfg, "CONNECTION_METERED", NULL, FALSE); + } } static gboolean |