diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c index c7eb9b2db..3725553e1 100644 --- a/libnm-core/nm-setting-bond.c +++ b/libnm-core/nm-setting-bond.c @@ -111,6 +111,8 @@ static const BondDefault defaults[] = { { NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, "0", TYPE_BOTH, 0, 2, { "layer2", "layer3+4", "layer2+3", NULL } }, { NM_SETTING_BOND_OPTION_RESEND_IGMP, "1", TYPE_INT, 0, 255 }, + { NM_SETTING_BOND_OPTION_LACP_RATE, "0", TYPE_BOTH, 0, 1, + { "slow", "fast", NULL } }, }; /** @@ -462,6 +464,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) NULL }; int miimon = 0, arp_interval = 0; const char *arp_ip_target = NULL; + const char *lacp_rate; const char *primary; g_hash_table_iter_init (&iter, priv->options); @@ -643,6 +646,19 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) } } + lacp_rate = g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_LACP_RATE); + if ( lacp_rate + && (g_strcmp0 (value, "802.3ad") != 0 && g_strcmp0 (value, "4") != 0) + && (strcmp (lacp_rate, "slow") != 0 && strcmp (lacp_rate, "0") != 0)) { + g_set_error (error, + NM_SETTING_BOND_ERROR, + NM_SETTING_BOND_ERROR_INVALID_OPTION, + _("'%s' option is only valid with mode '%s'"), + NM_SETTING_BOND_OPTION_LACP_RATE, "802.3ad"); + g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS); + return FALSE; + } + return _nm_setting_verify_required_virtual_interface_name (all_settings, error); } diff --git a/libnm-core/nm-setting-bond.h b/libnm-core/nm-setting-bond.h index c3cee4d55..18f5e105f 100644 --- a/libnm-core/nm-setting-bond.h +++ b/libnm-core/nm-setting-bond.h @@ -74,6 +74,7 @@ GQuark nm_setting_bond_error_quark (void); #define NM_SETTING_BOND_OPTION_AD_SELECT "ad_select" #define NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY "xmit_hash_policy" #define NM_SETTING_BOND_OPTION_RESEND_IGMP "resend_igmp" +#define NM_SETTING_BOND_OPTION_LACP_RATE "lacp_rate" typedef struct { NMSetting parent; diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c index f321d0af2..7d82d31d2 100644 --- a/libnm-util/nm-setting-bond.c +++ b/libnm-util/nm-setting-bond.c @@ -120,6 +120,8 @@ static const BondDefault defaults[] = { { NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, "0", TYPE_BOTH, 0, 2, { "layer2", "layer3+4", "layer2+3", NULL } }, { NM_SETTING_BOND_OPTION_RESEND_IGMP, "1", TYPE_INT, 0, 255 }, + { NM_SETTING_BOND_OPTION_LACP_RATE, "0", TYPE_BOTH, 0, 1, + { "slow", "fast", NULL } }, }; /** @@ -487,6 +489,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) NULL }; int miimon = 0, arp_interval = 0; const char *arp_ip_target = NULL; + const char *lacp_rate; const char *primary; g_hash_table_iter_init (&iter, priv->options); @@ -668,6 +671,19 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) } } + lacp_rate = g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_LACP_RATE); + if ( lacp_rate + && (g_strcmp0 (value, "802.3ad") != 0 && g_strcmp0 (value, "4") != 0) + && (strcmp (lacp_rate, "slow") != 0 && strcmp (lacp_rate, "0") != 0)) { + g_set_error (error, + NM_SETTING_BOND_ERROR, + NM_SETTING_BOND_ERROR_INVALID_OPTION, + _("'%s' option is only valid with mode '%s'"), + NM_SETTING_BOND_OPTION_LACP_RATE, "802.3ad"); + g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS); + return FALSE; + } + return _nm_setting_verify_deprecated_virtual_iface_name ( priv->interface_name, FALSE, NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_INTERFACE_NAME, diff --git a/libnm-util/nm-setting-bond.h b/libnm-util/nm-setting-bond.h index e7807380b..cf969995e 100644 --- a/libnm-util/nm-setting-bond.h +++ b/libnm-util/nm-setting-bond.h @@ -71,6 +71,7 @@ GQuark nm_setting_bond_error_quark (void); #define NM_SETTING_BOND_OPTION_AD_SELECT "ad_select" #define NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY "xmit_hash_policy" #define NM_SETTING_BOND_OPTION_RESEND_IGMP "resend_igmp" +#define NM_SETTING_BOND_OPTION_LACP_RATE "lacp_rate" typedef struct { NMSetting parent; diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 40151d472..e365ee6d6 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -360,6 +360,7 @@ apply_bonding_config (NMDevice *device) set_simple_option (device, "ad_select", s_bond, NM_SETTING_BOND_OPTION_AD_SELECT); set_simple_option (device, "xmit_hash_policy", s_bond, NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY); set_simple_option (device, "resend_igmp", s_bond, NM_SETTING_BOND_OPTION_RESEND_IGMP); + set_simple_option (device, "lacp_rate", s_bond, NM_SETTING_BOND_OPTION_LACP_RATE); return NM_ACT_STAGE_RETURN_SUCCESS; }