mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 13:40:11 +01:00
libnm-util: support the "primary" bond option
This commit is contained in:
parent
6b9b3adbd1
commit
e69727bf8a
2 changed files with 28 additions and 0 deletions
|
|
@ -93,6 +93,7 @@ static const BondDefault defaults[] = {
|
|||
{ NM_SETTING_BOND_OPTION_UPDELAY, "0" },
|
||||
{ NM_SETTING_BOND_OPTION_ARP_INTERVAL, "0" },
|
||||
{ NM_SETTING_BOND_OPTION_ARP_IP_TARGET, "" },
|
||||
{ NM_SETTING_BOND_OPTION_PRIMARY, "" },
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -370,6 +371,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
NULL };
|
||||
int miimon = 0, arp_interval = 0;
|
||||
const char *arp_ip_target = NULL;
|
||||
const char *primary;
|
||||
|
||||
if (!priv->interface_name || !strlen(priv->interface_name)) {
|
||||
g_set_error_literal (error,
|
||||
|
|
@ -456,6 +458,31 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
primary = g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_PRIMARY);
|
||||
if (strcmp (value, "active-backup") == 0) {
|
||||
if (primary && !nm_utils_iface_valid_name (primary)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_BOND_ERROR,
|
||||
NM_SETTING_BOND_ERROR_INVALID_OPTION,
|
||||
_("'%s' is not a valid interface name for '%s' option"),
|
||||
primary, NM_SETTING_BOND_OPTION_PRIMARY);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (primary) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_BOND_ERROR,
|
||||
NM_SETTING_BOND_ERROR_INVALID_OPTION,
|
||||
_("'%s' option is only valid for '%s=%s'"),
|
||||
NM_SETTING_BOND_OPTION_PRIMARY,
|
||||
NM_SETTING_BOND_OPTION_MODE, "active-backup");
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_slist_find_custom (all_settings, NM_SETTING_INFINIBAND_SETTING_NAME, find_setting_by_name)) {
|
||||
if (strcmp (value, "active-backup") != 0) {
|
||||
g_set_error (error,
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ GQuark nm_setting_bond_error_quark (void);
|
|||
#define NM_SETTING_BOND_OPTION_UPDELAY "updelay"
|
||||
#define NM_SETTING_BOND_OPTION_ARP_INTERVAL "arp_interval"
|
||||
#define NM_SETTING_BOND_OPTION_ARP_IP_TARGET "arp_ip_target"
|
||||
#define NM_SETTING_BOND_OPTION_PRIMARY "primary"
|
||||
|
||||
typedef struct {
|
||||
NMSetting parent;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue