mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-16 12:21:37 +01:00
ifcfg-rh: add support for CONNECTION_METERED
(cherry picked from commit 7e5e624daf)
This commit is contained in:
parent
1ab766b61b
commit
975afac6a4
3 changed files with 28 additions and 0 deletions
|
|
@ -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, "", "",
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue