summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-06-10 15:30:53 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-06-11 18:30:20 +0200
commitb247950c6fa1b332402068e5eeda7d6708f8c9af (patch)
treebcaaa41f79d4a7523a9d8c96f918c9e16b18d4a0
parentfa0f87fef735ad8359baa21f2553360bc88da530 (diff)
downloadNetworkManager-b247950c6fa1b332402068e5eeda7d6708f8c9af.tar.gz
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
-rw-r--r--clients/tui/nm-editor-utils.c21
-rw-r--r--clients/tui/nmt-page-bond.c3
2 files changed, 18 insertions, 6 deletions
diff --git a/clients/tui/nm-editor-utils.c b/clients/tui/nm-editor-utils.c
index 2ca3ed637c..9698c1d7a5 100644
--- a/clients/tui/nm-editor-utils.c
+++ b/clients/tui/nm-editor-utils.c
@@ -68,14 +68,23 @@ bond_connection_setup_func (NMConnection *connection,
NMSetting *s_hw)
{
NMSettingBond *s_bond = NM_SETTING_BOND (s_hw);
- const char **options, *def, *cur;
- int i;
-
- options = nm_setting_bond_get_valid_options (s_bond);
- for (i = 0; options[i]; i++) {
+ const char *def, *cur;
+ static const char *const options[] = {
+ NM_SETTING_BOND_OPTION_ARP_INTERVAL,
+ NM_SETTING_BOND_OPTION_ARP_IP_TARGET,
+ 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]);
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);
}
}
diff --git a/clients/tui/nmt-page-bond.c b/clients/tui/nmt-page-bond.c
index 339e7749fa..11a68eaa18 100644
--- a/clients/tui/nmt-page-bond.c
+++ b/clients/tui/nmt-page-bond.c
@@ -45,6 +45,9 @@ typedef enum {
typedef struct {
NmtSlaveList *slaves;
+ /* Note: when adding new options to the UI also ensure they are
+ * initialized in bond_connection_setup_func()
+ */
NmtNewtPopup *mode;
NmtNewtEntry *primary;
NmtNewtPopup *monitoring;