Commit b247950c authored by Beniamino Galvani's avatar Beniamino Galvani

tui: add only some options to new bond connections

Instead of adding every known option to new bond connections, only add
the ones supported by UI.

https://bugzilla.redhat.com/show_bug.cgi?id=1715720
parent fa0f87fe
Pipeline #41897 passed with stages
in 44 minutes and 20 seconds
...@@ -68,14 +68,23 @@ bond_connection_setup_func (NMConnection *connection, ...@@ -68,14 +68,23 @@ bond_connection_setup_func (NMConnection *connection,
NMSetting *s_hw) NMSetting *s_hw)
{ {
NMSettingBond *s_bond = NM_SETTING_BOND (s_hw); NMSettingBond *s_bond = NM_SETTING_BOND (s_hw);
const char **options, *def, *cur; const char *def, *cur;
int i; static const char *const options[] = {
NM_SETTING_BOND_OPTION_ARP_INTERVAL,
options = nm_setting_bond_get_valid_options (s_bond); NM_SETTING_BOND_OPTION_ARP_IP_TARGET,
for (i = 0; options[i]; i++) { NM_SETTING_BOND_OPTION_DOWNDELAY,
NM_SETTING_BOND_OPTION_MIIMON,
NM_SETTING_BOND_OPTION_MODE,
NM_SETTING_BOND_OPTION_PRIMARY,
NM_SETTING_BOND_OPTION_UPDELAY,
};
guint i;
/* Only add options supported by the UI */
for (i = 0; i < G_N_ELEMENTS (options); i++) {
def = nm_setting_bond_get_option_default (s_bond, options[i]); def = nm_setting_bond_get_option_default (s_bond, options[i]);
cur = nm_setting_bond_get_option_by_name (s_bond, options[i]); cur = nm_setting_bond_get_option_by_name (s_bond, options[i]);
if (g_strcmp0 (def, cur) != 0) if (!nm_streq0 (def, cur))
nm_setting_bond_add_option (s_bond, options[i], def); nm_setting_bond_add_option (s_bond, options[i], def);
} }
} }
......
...@@ -45,6 +45,9 @@ typedef enum { ...@@ -45,6 +45,9 @@ typedef enum {
typedef struct { typedef struct {
NmtSlaveList *slaves; NmtSlaveList *slaves;
/* Note: when adding new options to the UI also ensure they are
* initialized in bond_connection_setup_func()
*/
NmtNewtPopup *mode; NmtNewtPopup *mode;
NmtNewtEntry *primary; NmtNewtEntry *primary;
NmtNewtPopup *monitoring; NmtNewtPopup *monitoring;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment