ifcfg-rh: add support for CONNECTION_METERED

This commit is contained in:
Beniamino Galvani 2015-05-29 17:41:21 +02:00
parent 862fd91df0
commit 7e5e624daf
3 changed files with 28 additions and 0 deletions

View file

@ -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, "", "",

View file

@ -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);
}

View file

@ -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