diff options
| author | Michael Biebl <biebl@debian.org> | 2017-07-12 17:57:30 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-07-12 17:57:30 +0200 |
| commit | b9f0451fa35393ceedf6d9d20b78c43578ebea5d (patch) | |
| tree | 417afcdd717020ad44e25fadee4b89de23316e83 /libnm-core/nm-connection.c | |
| parent | c333f062ddcba9b35330647bf6cbd0a07f2d786e (diff) | |
New upstream version 1.8.2 upstream/1.8.2
Diffstat (limited to 'libnm-core/nm-connection.c')
| -rw-r--r-- | libnm-core/nm-connection.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index ecfb9780..c1b75068 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -913,6 +913,36 @@ _normalize_bond_mode (NMConnection *self, GHashTable *parameters) } static gboolean +_normalize_bond_options (NMConnection *self, GHashTable *parameters) +{ + NMSettingBond *s_bond = nm_connection_get_setting_bond (self); + gboolean changed = FALSE; + const char *name, *mode_str; + NMBondMode mode; + guint32 num, i; + + /* Strip away unsupported options for current mode */ + if (s_bond) { + mode_str = nm_setting_bond_get_option_by_name (s_bond, NM_SETTING_BOND_OPTION_MODE); + mode = _nm_setting_bond_mode_from_string (mode_str); + if (mode == NM_BOND_MODE_UNKNOWN) + return FALSE; +again: + num = nm_setting_bond_get_num_options (s_bond); + for (i = 0; i < num; i++) { + if ( nm_setting_bond_get_option (s_bond, i, &name, NULL) + && !_nm_setting_bond_option_supported (name, mode)) { + nm_setting_bond_remove_option (s_bond, name); + changed = TRUE; + goto again; + } + } + } + + return changed; +} + +static gboolean _normalize_wireless_mac_address_randomization (NMConnection *self, GHashTable *parameters) { NMSettingWireless *s_wifi = nm_connection_get_setting_wireless (self); @@ -1275,6 +1305,7 @@ nm_connection_normalize (NMConnection *connection, was_modified |= _normalize_ethernet_link_neg (connection); was_modified |= _normalize_infiniband_mtu (connection, parameters); was_modified |= _normalize_bond_mode (connection, parameters); + was_modified |= _normalize_bond_options (connection, parameters); was_modified |= _normalize_wireless_mac_address_randomization (connection, parameters); was_modified |= _normalize_team_config (connection, parameters); was_modified |= _normalize_team_port_config (connection, parameters); |