mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 02:04:17 +00:00
nm-setting-bond: add API to libnm to get the normalized bond option value
Add 'nm_setting_bond_get_option_normalized()', the purpose of this API is to retrieve a bond option normalized value which is the option that NetworkManager will actually apply to the bond when activating the connection, this takes into account default values for some options that NM assumes. For example, if you create a connection: $ nmcli c add type bond con-name nm-bond ifname bond0 bond.options mode=0 Calling 'nm_setting_bond_get_option_normalized(s_bond, "miimon")' would return "100" as even if not specified NetworkManager enables miimon for bond connections. Another example: $ nmcli c add type bond con-name nm-bond ifname bond0 bond.options mode=0,arp_interval=100 Calling 'nm_setting_bond_get_option_normalized(s_bond, "miimon")' would return NULL in this case because NetworkManager disables miimon if 'arp_interval' is set explicitly but 'miimon' is not.
This commit is contained in:
parent
9bd07336ef
commit
b868fee9cb
|
@ -661,6 +661,29 @@ nm_setting_bond_get_option_default (NMSettingBond *setting, const char *name)
|
|||
TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_bond_get_option_normalized:
|
||||
* @setting: the #NMSettingBond
|
||||
* @name: the name of the option
|
||||
*
|
||||
* Since: 1.24
|
||||
*
|
||||
* Returns: the value of the bond option after normalization, which is what NetworkManager
|
||||
* will actually apply when activating the connection. %NULL if the option won't be applied
|
||||
* to the connection.
|
||||
**/
|
||||
const char *
|
||||
nm_setting_bond_get_option_normalized (NMSettingBond *setting,
|
||||
const char *name)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_BOND (setting), NULL);
|
||||
g_return_val_if_fail (name, NULL);
|
||||
|
||||
return _bond_get_option_normalized (setting,
|
||||
name,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_bond_get_option_type:
|
||||
* @setting: the #NMSettingBond
|
||||
|
|
|
@ -94,6 +94,10 @@ const char **nm_setting_bond_get_valid_options (NMSettingBond *setting);
|
|||
const char * nm_setting_bond_get_option_default (NMSettingBond *setting,
|
||||
const char *name);
|
||||
|
||||
NM_AVAILABLE_IN_1_24
|
||||
const char * nm_setting_bond_get_option_normalized (NMSettingBond *setting,
|
||||
const char *name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __NM_SETTING_BOND_H__ */
|
||||
|
|
|
@ -1678,6 +1678,7 @@ global:
|
|||
nm_secret_agent_old_get_dbus_connection;
|
||||
nm_secret_agent_old_get_dbus_name_owner;
|
||||
nm_secret_agent_old_get_main_context;
|
||||
nm_setting_bond_get_option_normalized;
|
||||
nm_setting_vrf_get_table;
|
||||
nm_setting_vrf_get_type;
|
||||
nm_setting_vrf_new;
|
||||
|
|
Loading…
Reference in a new issue