mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-11 08:20:30 +01:00
libnm: verify that ethtool coalesce options "adaptive-[rt]x" are boolean
nm_setting_ethtool_set_coalesce() coerces the values to be either 0 or 1. Verification of NMSettingEthtool should ensure the same.
This commit is contained in:
parent
501554732c
commit
20a2399aa9
1 changed files with 13 additions and 0 deletions
|
|
@ -540,6 +540,19 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
g_prefix_error (error, "%s.%s: ", NM_SETTING_ETHTOOL_SETTING_NAME, optname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (NM_IN_SET (ethtool_id,
|
||||
NM_ETHTOOL_ID_COALESCE_ADAPTIVE_RX,
|
||||
NM_ETHTOOL_ID_COALESCE_ADAPTIVE_TX)) {
|
||||
if (!NM_IN_SET (g_variant_get_uint32 (variant), 0, 1)) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("coalesce option must be either 0 or 1"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_ETHTOOL_SETTING_NAME, optname);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue