summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-05-29 17:41:21 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-07-22 13:52:46 +0200
commit975afac6a461e26b027c938deedb587ce9ec3158 (patch)
tree5198a9d57bf6a2c0bf82b7b436cf72956e6d704c
parent1ab766b61bfe1ff3ffcd7585c7ac243c0d7f7a43 (diff)
downloadNetworkManager-975afac6a461e26b027c938deedb587ce9ec3158.tar.gz
ifcfg-rh: add support for CONNECTION_METERED
(cherry picked from commit 7e5e624dafc9ad4e6ec2dc32cc0d7013476ca2c6)
-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 b73d2289f0..28e590df37 100644
--- a/libnm-core/nm-setting-connection.c
+++ b/libnm-core/nm-setting-connection.c
@@ -1671,6 +1671,14 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
*
* Since: 1.0.6
**/
+ /* ---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 ec87416775..170b4b2905 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -250,6 +250,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 52bf51d18b..146cd34096 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -1764,6 +1764,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