From 882a79adf22e128a98794b0c51d34b526baec6ba Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 9 Sep 2020 10:27:44 +0200 Subject: [PATCH 1/7] shared: extend NM_IN_SET()/NM_IN_STRSET() macros to support up to 30 arguments (cherry picked from commit 0f4221da423f3cece034d20f78801df0927c7e60) --- shared/nm-glib-aux/nm-macros-internal.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 57ddee0501..9b8b241892 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -744,6 +744,16 @@ NM_G_ERROR_MSG (GError *error) #define _NM_IN_SET_EVAL_18(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_17 (op, _x, __VA_ARGS__) #define _NM_IN_SET_EVAL_19(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_18 (op, _x, __VA_ARGS__) #define _NM_IN_SET_EVAL_20(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_19 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_21(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_20 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_22(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_21 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_23(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_22 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_24(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_23 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_25(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_24 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_26(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_25 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_27(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_26 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_28(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_27 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_29(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_28 (op, _x, __VA_ARGS__) +#define _NM_IN_SET_EVAL_30(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_29 (op, _x, __VA_ARGS__) #define _NM_IN_SET_EVAL_N2(op, _x, n, ...) (_NM_IN_SET_EVAL_##n(op, _x, __VA_ARGS__)) #define _NM_IN_SET_EVAL_N(op, type, x, n, ...) \ @@ -814,6 +824,16 @@ _NM_IN_STRSET_streq (const char *x, const char *s) #define _NM_IN_STRSET_EVAL_18(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_17 (op, _x, __VA_ARGS__) #define _NM_IN_STRSET_EVAL_19(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_18 (op, _x, __VA_ARGS__) #define _NM_IN_STRSET_EVAL_20(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_19 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_21(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_20 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_22(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_21 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_23(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_22 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_24(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_23 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_25(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_24 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_26(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_25 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_27(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_26 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_28(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_27 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_29(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_28 (op, _x, __VA_ARGS__) +#define _NM_IN_STRSET_EVAL_30(op, _x, y, ...) _NM_IN_STRSET_streq (_x, y) op _NM_IN_STRSET_EVAL_29 (op, _x, __VA_ARGS__) #define _NM_IN_STRSET_EVAL_N2(op, _x, n, ...) (_NM_IN_STRSET_EVAL_##n(op, _x, __VA_ARGS__)) #define _NM_IN_STRSET_EVAL_N(op, x, n, ...) \ From 4c83321286611cbe4f6e6eddd60bf443cbf93cab Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 9 Sep 2020 10:22:28 +0200 Subject: [PATCH 2/7] device: allow "active_slave" and "arp_ip_target" bond option for reapply I guess the idea was to only accept options that can be changed without taking the interface !IFF_UP. "active_slave" is wrongly omitted from that list. Also, "active_slave" option doesn't really make sense for NetworkManager to configure. Instead "primary" should be used. In the future, we should re-map the properties and deprecate "active_slave" for "primary" ([1]). Fixes: 746dc119a6bc ('bond: let 'reapply()' reapply all supported options') [1] https://bugzilla.redhat.com/show_bug.cgi?id=1856640#c19 https://bugzilla.redhat.com/show_bug.cgi?id=1876577 (cherry picked from commit 2eea22ae95dd664605adafb5ee22b9f3c75a2055) --- src/devices/nm-device-bond.c | 69 +++++++++++++++--------------------- 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 71332ba390..cddce59c65 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -22,6 +22,30 @@ _LOG_DECLARE_SELF(NMDeviceBond); /*****************************************************************************/ +#define OPTIONS_REAPPLY_SUBSET \ + NM_SETTING_BOND_OPTION_PRIMARY, \ + NM_SETTING_BOND_OPTION_MIIMON, \ + NM_SETTING_BOND_OPTION_UPDELAY, \ + NM_SETTING_BOND_OPTION_DOWNDELAY, \ + NM_SETTING_BOND_OPTION_ARP_INTERVAL, \ + NM_SETTING_BOND_OPTION_ARP_VALIDATE, \ + NM_SETTING_BOND_OPTION_PRIMARY, \ + NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM, \ + NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, \ + NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, \ + NM_SETTING_BOND_OPTION_ARP_ALL_TARGETS, \ + NM_SETTING_BOND_OPTION_FAIL_OVER_MAC, \ + NM_SETTING_BOND_OPTION_LP_INTERVAL, \ + NM_SETTING_BOND_OPTION_MIN_LINKS, \ + NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, \ + NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, \ + NM_SETTING_BOND_OPTION_RESEND_IGMP, \ + NM_SETTING_BOND_OPTION_USE_CARRIER, \ + NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, \ + NM_SETTING_BOND_OPTION_NUM_GRAT_ARP + +/*****************************************************************************/ + struct _NMDeviceBond { NMDevice parent; }; @@ -542,28 +566,10 @@ check_changed_options (NMSettingBond *s_a, NMSettingBond *s_b, GError **error) /* We support changes to these */ if (NM_IN_STRSET (name, - NM_SETTING_BOND_OPTION_PRIMARY, - NM_SETTING_BOND_OPTION_MIIMON, - NM_SETTING_BOND_OPTION_UPDELAY, - NM_SETTING_BOND_OPTION_DOWNDELAY, - NM_SETTING_BOND_OPTION_ARP_INTERVAL, - NM_SETTING_BOND_OPTION_ARP_VALIDATE, - NM_SETTING_BOND_OPTION_PRIMARY, - NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM, - NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, - NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, - NM_SETTING_BOND_OPTION_ARP_ALL_TARGETS, - NM_SETTING_BOND_OPTION_FAIL_OVER_MAC, - NM_SETTING_BOND_OPTION_LP_INTERVAL, - NM_SETTING_BOND_OPTION_MIN_LINKS, - NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, - NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, - NM_SETTING_BOND_OPTION_RESEND_IGMP, - NM_SETTING_BOND_OPTION_USE_CARRIER, - NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, - NM_SETTING_BOND_OPTION_NUM_GRAT_ARP)) { + OPTIONS_REAPPLY_SUBSET, + NM_SETTING_BOND_OPTION_ACTIVE_SLAVE, + NM_SETTING_BOND_OPTION_ARP_IP_TARGET)) continue; - } /* Reject any other changes */ if (!nm_streq0 (nm_setting_bond_get_option_normalized (s_a, name), @@ -638,26 +644,7 @@ reapply_connection (NMDevice *device, NMConnection *con_old, NMConnection *con_n set_bond_attrs_or_default (device, s_bond, - NM_MAKE_STRV (NM_SETTING_BOND_OPTION_PRIMARY, - NM_SETTING_BOND_OPTION_MIIMON, - NM_SETTING_BOND_OPTION_UPDELAY, - NM_SETTING_BOND_OPTION_DOWNDELAY, - NM_SETTING_BOND_OPTION_ARP_INTERVAL, - NM_SETTING_BOND_OPTION_ARP_VALIDATE, - NM_SETTING_BOND_OPTION_PRIMARY, - NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM, - NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, - NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, - NM_SETTING_BOND_OPTION_ARP_ALL_TARGETS, - NM_SETTING_BOND_OPTION_FAIL_OVER_MAC, - NM_SETTING_BOND_OPTION_LP_INTERVAL, - NM_SETTING_BOND_OPTION_MIN_LINKS, - NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, - NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, - NM_SETTING_BOND_OPTION_RESEND_IGMP, - NM_SETTING_BOND_OPTION_USE_CARRIER, - NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, - NM_SETTING_BOND_OPTION_NUM_GRAT_ARP)); + NM_MAKE_STRV (OPTIONS_REAPPLY_SUBSET)); } /*****************************************************************************/ From a0ae53c8bb4a870894dd272321babd8332deaf1b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 9 Sep 2020 11:07:08 +0200 Subject: [PATCH 3/7] device: remove duplicate option "primary" from list to reapply (cherry picked from commit 0ea73cdcece4f03c4fed83c8684aee58fa477b29) --- src/devices/nm-device-bond.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index cddce59c65..7244874293 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -23,7 +23,6 @@ _LOG_DECLARE_SELF(NMDeviceBond); /*****************************************************************************/ #define OPTIONS_REAPPLY_SUBSET \ - NM_SETTING_BOND_OPTION_PRIMARY, \ NM_SETTING_BOND_OPTION_MIIMON, \ NM_SETTING_BOND_OPTION_UPDELAY, \ NM_SETTING_BOND_OPTION_DOWNDELAY, \ From 7030cd2c8b4d54728775c72f6a8a1a6b1407b722 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 9 Sep 2020 11:05:24 +0200 Subject: [PATCH 4/7] device: unify setting of bond options Add a macro for the list of bond options we are going to set. By seeing them side-by-side, it is hopefully simpler to see that all options are specified correctly. We see that: - the *_SUBSET defines don't include the options that we are explicitly setting, that is "mode", "active_slave" and "arp_ip_target". - OPTIONS_REAPPLY_SUBSET contains 4 options less than OPTIONS_APPLY_SUBSET: "ad_select", "ad_user_port_key", "lacp_rate" and "tlb_dynamic_lb". These are the options that are marked as BOND_OPTFLAG_IFDOWN in kernel. (cherry picked from commit 5402943420ca5697e3d9bfe72c1c1969c4f29aca) --- src/devices/nm-device-bond.c | 59 +++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 7244874293..ced07c00e7 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -22,6 +22,31 @@ _LOG_DECLARE_SELF(NMDeviceBond); /*****************************************************************************/ +#define OPTIONS_APPLY_SUBSET \ + NM_SETTING_BOND_OPTION_MIIMON, \ + NM_SETTING_BOND_OPTION_UPDELAY, \ + NM_SETTING_BOND_OPTION_DOWNDELAY, \ + NM_SETTING_BOND_OPTION_ARP_INTERVAL, \ + NM_SETTING_BOND_OPTION_ARP_VALIDATE, \ + NM_SETTING_BOND_OPTION_PRIMARY, \ + NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM, \ + NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, \ + NM_SETTING_BOND_OPTION_AD_SELECT, \ + NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY, \ + NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, \ + NM_SETTING_BOND_OPTION_ARP_ALL_TARGETS, \ + NM_SETTING_BOND_OPTION_FAIL_OVER_MAC, \ + NM_SETTING_BOND_OPTION_LACP_RATE, \ + NM_SETTING_BOND_OPTION_LP_INTERVAL, \ + NM_SETTING_BOND_OPTION_MIN_LINKS, \ + NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, \ + NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, \ + NM_SETTING_BOND_OPTION_RESEND_IGMP, \ + NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB, \ + NM_SETTING_BOND_OPTION_USE_CARRIER, \ + NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, \ + NM_SETTING_BOND_OPTION_NUM_GRAT_ARP + #define OPTIONS_REAPPLY_SUBSET \ NM_SETTING_BOND_OPTION_MIIMON, \ NM_SETTING_BOND_OPTION_UPDELAY, \ @@ -43,6 +68,11 @@ _LOG_DECLARE_SELF(NMDeviceBond); NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, \ NM_SETTING_BOND_OPTION_NUM_GRAT_ARP +#define OPTIONS_REAPPLY_FULL \ + OPTIONS_REAPPLY_SUBSET, \ + NM_SETTING_BOND_OPTION_ACTIVE_SLAVE, \ + NM_SETTING_BOND_OPTION_ARP_IP_TARGET + /*****************************************************************************/ struct _NMDeviceBond { @@ -369,29 +399,7 @@ apply_bonding_config (NMDeviceBond *self) set_bond_attrs_or_default (device, s_bond, - NM_MAKE_STRV (NM_SETTING_BOND_OPTION_MIIMON, - NM_SETTING_BOND_OPTION_UPDELAY, - NM_SETTING_BOND_OPTION_DOWNDELAY, - NM_SETTING_BOND_OPTION_ARP_INTERVAL, - NM_SETTING_BOND_OPTION_ARP_VALIDATE, - NM_SETTING_BOND_OPTION_PRIMARY, - NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM, - NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, - NM_SETTING_BOND_OPTION_AD_SELECT, - NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY, - NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, - NM_SETTING_BOND_OPTION_ARP_ALL_TARGETS, - NM_SETTING_BOND_OPTION_FAIL_OVER_MAC, - NM_SETTING_BOND_OPTION_LACP_RATE, - NM_SETTING_BOND_OPTION_LP_INTERVAL, - NM_SETTING_BOND_OPTION_MIN_LINKS, - NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, - NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, - NM_SETTING_BOND_OPTION_RESEND_IGMP, - NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB, - NM_SETTING_BOND_OPTION_USE_CARRIER, - NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, - NM_SETTING_BOND_OPTION_NUM_GRAT_ARP)); + NM_MAKE_STRV (OPTIONS_APPLY_SUBSET)); return TRUE; } @@ -564,10 +572,7 @@ check_changed_options (NMSettingBond *s_a, NMSettingBond *s_b, GError **error) const char *name = *option_list; /* We support changes to these */ - if (NM_IN_STRSET (name, - OPTIONS_REAPPLY_SUBSET, - NM_SETTING_BOND_OPTION_ACTIVE_SLAVE, - NM_SETTING_BOND_OPTION_ARP_IP_TARGET)) + if (NM_IN_STRSET (name, OPTIONS_REAPPLY_FULL)) continue; /* Reject any other changes */ From 97f7d4f64f28caed0f71ac2caaaf0922f9dd2b92 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 9 Sep 2020 11:20:10 +0200 Subject: [PATCH 5/7] device: inline check_changed_options() in can_reapply_change() Code doesn't get simpler by having more functions -- if these functions are only called once. What actually is a problem is repeated, redundant code. Like the list of bond options that can be reapplied. But the function didn't help to avoid repeating the list. (cherry picked from commit f807b68376616fd8a77d2859e336e81665df1782) --- src/devices/nm-device-bond.c | 56 +++++++++++++++++------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index ced07c00e7..9d8e0eeac5 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -561,35 +561,6 @@ create_and_realize (NMDevice *device, return TRUE; } -static gboolean -check_changed_options (NMSettingBond *s_a, NMSettingBond *s_b, GError **error) -{ - const char **option_list; - - option_list = nm_setting_bond_get_valid_options (NULL); - - for (; *option_list; ++option_list) { - const char *name = *option_list; - - /* We support changes to these */ - if (NM_IN_STRSET (name, OPTIONS_REAPPLY_FULL)) - continue; - - /* Reject any other changes */ - if (!nm_streq0 (nm_setting_bond_get_option_normalized (s_a, name), - nm_setting_bond_get_option_normalized (s_b, name))) { - g_set_error (error, - NM_DEVICE_ERROR, - NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, - "Can't reapply '%s' bond option", - name); - return FALSE; - } - } - - return TRUE; -} - static gboolean can_reapply_change (NMDevice *device, const char *setting_name, @@ -602,13 +573,38 @@ can_reapply_change (NMDevice *device, /* Only handle bond setting here, delegate other settings to parent class */ if (nm_streq (setting_name, NM_SETTING_BOND_SETTING_NAME)) { + NMSettingBond *s_a = NM_SETTING_BOND (s_old); + NMSettingBond *s_b = NM_SETTING_BOND (s_new); + const char **option_list; + if (!nm_device_hash_check_invalid_keys (diffs, NM_SETTING_BOND_SETTING_NAME, error, NM_SETTING_BOND_OPTIONS)) return FALSE; - return check_changed_options (NM_SETTING_BOND (s_old), NM_SETTING_BOND (s_new), error); + option_list = nm_setting_bond_get_valid_options (NULL); + + for (; *option_list; ++option_list) { + const char *name = *option_list; + + /* We support changes to these */ + if (NM_IN_STRSET (name, OPTIONS_REAPPLY_FULL)) + continue; + + /* Reject any other changes */ + if (!nm_streq0 (nm_setting_bond_get_option_normalized (s_a, name), + nm_setting_bond_get_option_normalized (s_b, name))) { + g_set_error (error, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, + "Can't reapply '%s' bond option", + name); + return FALSE; + } + } + + return TRUE; } device_class = NM_DEVICE_CLASS (nm_device_bond_parent_class); From 2d4e604007abaab2196bcbc452aeacedef17865e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 9 Sep 2020 12:34:47 +0200 Subject: [PATCH 6/7] libnm: allow setting "primary" option with modes "tlb" and "alb" (cherry picked from commit cb3a73af92fe142b23d6a33cfb9c10061ac941d3) --- libnm-core/nm-setting-bond.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c index 6e0a5e5b3a..f246ed11c9 100644 --- a/libnm-core/nm-setting-bond.c +++ b/libnm-core/nm-setting-bond.c @@ -835,7 +835,9 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) } primary = _bond_get_option (self, NM_SETTING_BOND_OPTION_PRIMARY); - if (bond_mode == NM_BOND_MODE_ACTIVEBACKUP) { + if (NM_IN_SET (bond_mode, NM_BOND_MODE_ACTIVEBACKUP, + NM_BOND_MODE_TLB, + NM_BOND_MODE_ALB)) { GError *tmp_error = NULL; if (primary && !nm_utils_ifname_valid_kernel (primary, &tmp_error)) { From 7ff222c05107d2788b86c9475c656718da503fc9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 10 Sep 2020 09:40:19 +0200 Subject: [PATCH 7/7] tui: allow configuring "primary" bond option with "balance-{alb,tlb}" (cherry picked from commit b5041c14f4bc69c0a89e7320d4e84289579a5e09) --- clients/tui/nmt-page-bond.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clients/tui/nmt-page-bond.c b/clients/tui/nmt-page-bond.c index e92b9f6c26..51ed8356c5 100644 --- a/clients/tui/nmt-page-bond.c +++ b/clients/tui/nmt-page-bond.c @@ -255,13 +255,16 @@ mode_widget_changed (GObject *object, _bond_add_option (priv->s_bond, NM_SETTING_BOND_OPTION_MODE, mode); priv->updating = FALSE; - if (!strcmp (mode, "balance-tlb") || !strcmp (mode, "balance-alb")) { + if (NM_IN_STRSET (mode, "balance-tlb", + "balance-alb")) { nmt_newt_popup_set_active (priv->monitoring, NMT_PAGE_BOND_MONITORING_MII); nmt_newt_component_set_sensitive (NMT_NEWT_COMPONENT (priv->monitoring), FALSE); } else nmt_newt_component_set_sensitive (NMT_NEWT_COMPONENT (priv->monitoring), TRUE); - if (!strcmp (mode, "active-backup")) { + if (NM_IN_STRSET (mode, "active-backup", + "balance-alb", + "balance-tlb")) { nmt_newt_widget_set_visible (NMT_NEWT_WIDGET (priv->primary), TRUE); _bond_add_option (priv->s_bond, NM_SETTING_BOND_OPTION_PRIMARY, nmt_newt_entry_get_text (priv->primary));