diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2021-08-25 15:24:42 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2021-08-25 15:24:42 +0200 |
| commit | dbb91282fa488964fb20595f9494a9f0e4f36a58 (patch) | |
| tree | 142bc942e5320b35514cdf03a5f9f47a9b89df0e /src/libnm-core-impl/nm-setting-bond.c | |
| parent | 5f2ede3a2813b0e9204befdcfc67509d34be71c6 (diff) | |
| parent | cfb80376641fa49137b9996130352697e7f8b436 (diff) | |
Update upstream source from tag 'upstream/1.32.10'
Update to upstream version '1.32.10' with Debian dir fcf2778b50b013ede3e7375bc1d829e984175658
Diffstat (limited to 'src/libnm-core-impl/nm-setting-bond.c')
| -rw-r--r-- | src/libnm-core-impl/nm-setting-bond.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/libnm-core-impl/nm-setting-bond.c b/src/libnm-core-impl/nm-setting-bond.c index 93baa9d6..252adc73 100644 --- a/src/libnm-core-impl/nm-setting-bond.c +++ b/src/libnm-core-impl/nm-setting-bond.c @@ -90,6 +90,7 @@ static const char *const valid_options_lst[] = { NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB, NM_SETTING_BOND_OPTION_LP_INTERVAL, + NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, NULL, }; @@ -207,6 +208,7 @@ static NM_UTILS_STRING_TABLE_LOOKUP_STRUCT_DEFINE( {NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, {"1", NM_BOND_OPTION_TYPE_INT, 0, 255}}, {NM_SETTING_BOND_OPTION_NUM_UNSOL_NA, {"1", NM_BOND_OPTION_TYPE_INT, 0, 255}}, {NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, {"1", NM_BOND_OPTION_TYPE_INT, 0, 65535}}, + {NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, {"0", NM_BOND_OPTION_TYPE_INT, 0, G_MAXINT}}, {NM_SETTING_BOND_OPTION_PRIMARY, {"", NM_BOND_OPTION_TYPE_IFNAME}}, {NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, {"always", NM_BOND_OPTION_TYPE_BOTH, 0, 2, _option_default_strv_primary_reselect}}, @@ -782,6 +784,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) int arp_interval; int num_grat_arp; int num_unsol_na; + int peer_notif_delay; const char * mode_str; const char * arp_ip_target = NULL; const char * lacp_rate; @@ -810,6 +813,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) arp_interval = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_ARP_INTERVAL)); num_grat_arp = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP)); num_unsol_na = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_NUM_UNSOL_NA)); + peer_notif_delay = + _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY)); /* Option restrictions: * @@ -818,6 +823,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) * arp_validate does not work with [ BOND_MODE_8023AD, BOND_MODE_TLB, BOND_MODE_ALB ] * downdelay needs miimon * updelay needs miimon + * peer_notif_delay needs miimon enabled + * peer_notif_delay must be a miimon multiple * primary needs [ active-backup, tlb, alb ] */ @@ -926,6 +933,36 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) } } + if (peer_notif_delay) { + if (miimon == 0) { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("'%s' option requires '%s' option to be enabled"), + NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, + NM_SETTING_BOND_OPTION_MIIMON); + g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS); + return FALSE; + } + + /* The code disables miimon when arp is set, so they never occur together. + * But this occurs after this verification, so this check can occur in + * an invalid state, when both arp and miimon are enabled. To assure not + * dealing with an invalid state, this arp_interval == 0 condition, + * that is implicit, was made explicit. + */ + if ((peer_notif_delay % miimon) && (arp_interval == 0)) { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("'%s' option needs to be a value multiple of '%s' value"), + NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, + NM_SETTING_BOND_OPTION_MIIMON); + g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS); + return FALSE; + } + } + /* arp_ip_target can only be used with arp_interval, and must * contain a comma-separated list of IPv4 addresses. */ |