mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 03:30:14 +01:00
ifcfg-rh: add support for CONNECTION_METERED
This commit is contained in:
parent
862fd91df0
commit
7e5e624daf
3 changed files with 28 additions and 0 deletions
|
|
@ -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, "", "",
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue