diff options
| author | Michael Biebl <biebl@debian.org> | 2020-03-13 00:45:02 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-03-13 00:45:02 +0100 |
| commit | dae4785d3a29c5df3740c2676b400c0da1a72e3e (patch) | |
| tree | 9fe17185cbbcbd096c85e5973e1b909ae3f751e4 /libnm-core/nm-setting-bond.c | |
| parent | 3cbb3d6ecfef1076fc757632ee8327935250afee (diff) | |
| parent | b012fa6e1d808e0736c009799c62d835cbfcc1dd (diff) | |
Update upstream source from tag 'upstream/1.22.10'
Update to upstream version '1.22.10' with Debian dir df10a9f9ccf26e17902b3dc19a866a22c47764e8
Diffstat (limited to 'libnm-core/nm-setting-bond.c')
| -rw-r--r-- | libnm-core/nm-setting-bond.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c index f4c35663..f3ae9ef5 100644 --- a/libnm-core/nm-setting-bond.c +++ b/libnm-core/nm-setting-bond.c @@ -92,6 +92,16 @@ static const BondDefault defaults[] = { /*****************************************************************************/ +static int +_atoi (const char *value) +{ + int v; + + v = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXINT, -1); + nm_assert (v >= 0); + return v; +}; + /** * nm_setting_bond_get_num_options: * @setting: the #NMSettingBond @@ -647,21 +657,26 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) } if (miimon == 0) { - /* updelay and downdelay can only be used with miimon */ - if (g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_UPDELAY)) { + gpointer delayopt; + + /* updelay and downdelay need miimon to be enabled to be valid */ + delayopt = g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_UPDELAY); + if (delayopt && _atoi (delayopt) > 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("'%s' option requires '%s' option to be set"), + _("'%s' option requires '%s' option to be enabled"), NM_SETTING_BOND_OPTION_UPDELAY, NM_SETTING_BOND_OPTION_MIIMON); g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS); return FALSE; } - if (g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_DOWNDELAY)) { + + delayopt = g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_DOWNDELAY); + if (delayopt && _atoi (delayopt) > 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("'%s' option requires '%s' option to be set"), + _("'%s' option requires '%s' option to be enabled"), NM_SETTING_BOND_OPTION_DOWNDELAY, NM_SETTING_BOND_OPTION_MIIMON); g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS); return FALSE; |