summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-05-29 17:41:21 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-06-04 17:32:29 +0200
commit329bb9809d0b6472aecd1b0394aadf24a4ca3f2d (patch)
tree036fcdd232a030ea7c5be3c6c6d527e6646c67bb
parentfb21a15746404bbc13132374a3674bd86fc0608f (diff)
downloadNetworkManager-329bb9809d0b6472aecd1b0394aadf24a4ca3f2d.tar.gz
ifcfg-rh: add support for CONNECTION_METERED
-rw-r--r--libnm-core/nm-setting-connection.c8
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.c9
-rw-r--r--src/settings/plugins/ifcfg-rh/writer.c11
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 ccbcdb07ab..a91c450e38 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 27f1c70599..a52d7cc691 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -1775,6 +1775,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