From 45382be34d12a40ca80872b301a99f036b3f7aba Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 16 Sep 2022 15:59:41 +0200 Subject: [PATCH 1/4] bond: assert integer range in _nm_setting_bond_opt_value_as_u{8,16,32}() The bond setting does some minimal validation of the options. At least for those number typed values, it validates that the string can be interpreted as a number and is within a certain range. Add nm_assert() checks to our opt_value_u$SIZE() functions, that the requested option is validated to be in a range which is sufficiently narrow to be converted to the requested type. If that were not the case, we would need some special handling (or question whether the option should be retrieved as this type). (cherry picked from commit a19458e11dfca701a058a87f0473bd199487384a) --- src/libnm-core-impl/nm-setting-bond.c | 63 +++++++++++++++--------- src/libnm-core-impl/tests/test-setting.c | 52 +++++++++++++++++++ src/libnm-core-intern/nm-core-internal.h | 4 +- 3 files changed, 95 insertions(+), 24 deletions(-) diff --git a/src/libnm-core-impl/nm-setting-bond.c b/src/libnm-core-impl/nm-setting-bond.c index cdfc764187..1861d6cdf6 100644 --- a/src/libnm-core-impl/nm-setting-bond.c +++ b/src/libnm-core-impl/nm-setting-bond.c @@ -764,37 +764,56 @@ _nm_setting_bond_get_option_type(NMSettingBond *setting, const char *name) return option_meta->opt_type; } -guint32 -_nm_setting_bond_opt_value_as_u32(NMSettingBond *s_bond, const char *opt) +#define _opt_value_as_u64(s_bond, opt, v_max) \ + ({ \ + const OptionMeta *_meta; \ + NMSettingBond *_s_bond = (s_bond); \ + const char *_opt = (opt); \ + const guint64 _v_max = (v_max); \ + const char *_s; \ + guint64 _val; \ + \ + nm_assert(NM_IS_SETTING_BOND(_s_bond)); \ + nm_assert(_opt); \ + \ + _meta = _get_option_meta(_opt); \ + \ + nm_assert(_meta); \ + nm_assert(_meta->opt_type == NM_BOND_OPTION_TYPE_INT); \ + nm_assert(_meta->min < _meta->max); \ + nm_assert(_meta->max <= _v_max); \ + nm_assert(_meta->val); \ + \ + _s = nm_setting_bond_get_option_normalized(_s_bond, _opt); \ + if (_s) { \ + _val = _nm_utils_ascii_str_to_uint64(_s, 10, _meta->min, _meta->max, 0); \ + /* Note that _s is only a valid integer, if the profile verifies. We require + * that the caller only calls these functions on valid profile. */ \ + nm_assert(errno == 0); \ + } else { \ + _val = 0; \ + errno = EINVAL; \ + } \ + \ + _val; \ + }) + +guint8 +_nm_setting_bond_opt_value_as_u8(NMSettingBond *s_bond, const char *opt) { - nm_assert(_get_option_meta(opt)->opt_type == NM_BOND_OPTION_TYPE_INT); - return _nm_utils_ascii_str_to_uint64(nm_setting_bond_get_option_normalized(s_bond, opt), - 10, - 0, - G_MAXUINT32, - 0); + return _opt_value_as_u64(s_bond, opt, G_MAXUINT8); } guint16 _nm_setting_bond_opt_value_as_u16(NMSettingBond *s_bond, const char *opt) { - nm_assert(_get_option_meta(opt)->opt_type == NM_BOND_OPTION_TYPE_INT); - return _nm_utils_ascii_str_to_uint64(nm_setting_bond_get_option_normalized(s_bond, opt), - 10, - 0, - G_MAXUINT16, - 0); + return _opt_value_as_u64(s_bond, opt, G_MAXUINT16); } -guint8 -_nm_setting_bond_opt_value_as_u8(NMSettingBond *s_bond, const char *opt) +guint32 +_nm_setting_bond_opt_value_as_u32(NMSettingBond *s_bond, const char *opt) { - nm_assert(_get_option_meta(opt)->opt_type == NM_BOND_OPTION_TYPE_INT); - return _nm_utils_ascii_str_to_uint64(nm_setting_bond_get_option_normalized(s_bond, opt), - 10, - 0, - G_MAXUINT8, - 0); + return _opt_value_as_u64(s_bond, opt, G_MAXUINT32); } /*****************************************************************************/ diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 5bdae71660..85654b5e5b 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -5068,6 +5068,56 @@ test_6lowpan_1(void) /*****************************************************************************/ +static void +test_bond_meta(void) +{ + gs_unref_object NMConnection *con = NULL; + NMSettingBond *set; + char sbuf[200]; + + create_bond_connection(&con, &set); + + g_assert_cmpstr(nm_setting_bond_get_option_normalized(set, NM_SETTING_BOND_OPTION_MODE), + ==, + "balance-rr"); + +#define _A(_nm_setting_bond_opt_value_as_xxx, set, opt, value, errsv) \ + G_STMT_START \ + { \ + g_assert_cmpint(_nm_setting_bond_opt_value_as_xxx((set), (opt)), ==, (value)); \ + g_assert_cmpint(errno, ==, (errsv)); \ + } \ + G_STMT_END + + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_MIIMON, 100, 0); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_UPDELAY, 0, 0); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_DOWNDELAY, 0, 0); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_ARP_INTERVAL, 0, 0); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_RESEND_IGMP, 1, 0); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_MIN_LINKS, 0, 0); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_LP_INTERVAL, 1, 0); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, 1, 0); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, 0, 0); + _A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, 0, EINVAL); + _A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY, 0, EINVAL); + _A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, 1, 0); + _A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, 0, 0); + + nm_setting_bond_add_option(set, NM_SETTING_BOND_OPTION_ARP_INTERVAL, "5"); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_ARP_INTERVAL, 5, 0); + + nm_setting_bond_add_option(set, + NM_SETTING_BOND_OPTION_ARP_INTERVAL, + nm_sprintf_buf(sbuf, "%d", G_MAXINT)); + _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_ARP_INTERVAL, G_MAXINT, 0); + + nm_setting_bond_add_option(set, NM_SETTING_BOND_OPTION_MODE, "802.3ad"); + _A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, 65535, 0); + _A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY, 0, 0); +} + +/*****************************************************************************/ + NMTST_DEFINE(); int @@ -5185,5 +5235,7 @@ main(int argc, char **argv) g_test_add_func("/libnm/test_setting_metadata", test_setting_metadata); + g_test_add_func("/libnm/test_bond_meta", test_bond_meta); + return g_test_run(); } diff --git a/src/libnm-core-intern/nm-core-internal.h b/src/libnm-core-intern/nm-core-internal.h index ee4cc25b42..ecfb2cd44f 100644 --- a/src/libnm-core-intern/nm-core-internal.h +++ b/src/libnm-core-intern/nm-core-internal.h @@ -517,9 +517,9 @@ NMConnectionMultiConnect _nm_connection_get_multi_connect(NMConnection *connecti gboolean _nm_setting_bond_option_supported(const char *option, NMBondMode mode); -guint32 _nm_setting_bond_opt_value_as_u32(NMSettingBond *s_bond, const char *opt); -guint16 _nm_setting_bond_opt_value_as_u16(NMSettingBond *s_bond, const char *opt); guint8 _nm_setting_bond_opt_value_as_u8(NMSettingBond *s_bond, const char *opt); +guint16 _nm_setting_bond_opt_value_as_u16(NMSettingBond *s_bond, const char *opt); +guint32 _nm_setting_bond_opt_value_as_u32(NMSettingBond *s_bond, const char *opt); /*****************************************************************************/ From 1ae5af9898be929eee8648577729fe9b4ed8c605 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 19 Sep 2022 08:22:11 +0200 Subject: [PATCH 2/4] bond: add _nm_setting_bond_opt_value_as_intbool() helper Bond option values are just strings, however, some of them get validated to be numbers, etc. We also have effectively boolean values, like "use-carrier". Internally, this is not validates as a boolean (_nm_utils_ascii_str_to_bool()) but instead is an integer of either "0" or "1". Add a helper function_nm_setting_bond_opt_value_as_intbool() to access and parse such values. (cherry picked from commit 489a1b8f1eb2d9e21873f4af6fdf6be5adcb11c9) --- src/libnm-core-impl/nm-setting-bond.c | 8 ++++++++ src/libnm-core-impl/tests/test-setting.c | 9 +++++++++ src/libnm-core-intern/nm-core-internal.h | 1 + 3 files changed, 18 insertions(+) diff --git a/src/libnm-core-impl/nm-setting-bond.c b/src/libnm-core-impl/nm-setting-bond.c index 1861d6cdf6..18b6fefbc0 100644 --- a/src/libnm-core-impl/nm-setting-bond.c +++ b/src/libnm-core-impl/nm-setting-bond.c @@ -816,6 +816,14 @@ _nm_setting_bond_opt_value_as_u32(NMSettingBond *s_bond, const char *opt) return _opt_value_as_u64(s_bond, opt, G_MAXUINT32); } +bool +_nm_setting_bond_opt_value_as_intbool(NMSettingBond *s_bond, const char *opt) +{ + /* This does not parse the value as a boolean string, instead, it requires + * that it's a number, either "0" or "1". */ + return _opt_value_as_u64(s_bond, opt, 1); +} + /*****************************************************************************/ static gboolean diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 85654b5e5b..a4e3932adf 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -5102,6 +5102,12 @@ test_bond_meta(void) _A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY, 0, EINVAL); _A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, 1, 0); _A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, 0, 0); + _A(_nm_setting_bond_opt_value_as_intbool, set, NM_SETTING_BOND_OPTION_USE_CARRIER, 1, 0); + _A(_nm_setting_bond_opt_value_as_intbool, + set, + NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB, + 0, + EINVAL); nm_setting_bond_add_option(set, NM_SETTING_BOND_OPTION_ARP_INTERVAL, "5"); _A(_nm_setting_bond_opt_value_as_u32, set, NM_SETTING_BOND_OPTION_ARP_INTERVAL, 5, 0); @@ -5114,6 +5120,9 @@ test_bond_meta(void) nm_setting_bond_add_option(set, NM_SETTING_BOND_OPTION_MODE, "802.3ad"); _A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, 65535, 0); _A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY, 0, 0); + + nm_setting_bond_add_option(set, NM_SETTING_BOND_OPTION_MODE, "balance-tlb"); + _A(_nm_setting_bond_opt_value_as_intbool, set, NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB, 1, 0); } /*****************************************************************************/ diff --git a/src/libnm-core-intern/nm-core-internal.h b/src/libnm-core-intern/nm-core-internal.h index ecfb2cd44f..4e1bab4723 100644 --- a/src/libnm-core-intern/nm-core-internal.h +++ b/src/libnm-core-intern/nm-core-internal.h @@ -520,6 +520,7 @@ gboolean _nm_setting_bond_option_supported(const char *option, NMBondMode mode); guint8 _nm_setting_bond_opt_value_as_u8(NMSettingBond *s_bond, const char *opt); guint16 _nm_setting_bond_opt_value_as_u16(NMSettingBond *s_bond, const char *opt); guint32 _nm_setting_bond_opt_value_as_u32(NMSettingBond *s_bond, const char *opt); +bool _nm_setting_bond_opt_value_as_intbool(NMSettingBond *s_bond, const char *opt); /*****************************************************************************/ From bb0fb8369424e008eb3d5b297877eef7844fa6c6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 18 Sep 2022 20:28:54 +0200 Subject: [PATCH 3/4] bond: make _platform_lnk_bond_init_from_setting() more readable via a macro Use macros to make the code shorter and easier to read. (cherry picked from commit b7c56c3ae1c3a334b9413fc1646cbc7312ac1c5e) --- src/core/devices/nm-device-bond.c | 78 ++++++++++++++++--------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/src/core/devices/nm-device-bond.c b/src/core/devices/nm-device-bond.c index 721acf027b..c854701f6a 100644 --- a/src/core/devices/nm-device-bond.c +++ b/src/core/devices/nm-device-bond.c @@ -395,46 +395,48 @@ _platform_lnk_bond_init_from_setting(NMSettingBond *s_bond, NMPlatformLnkBond *p { const char *opt_value; +#define _v_fcn(fcn, s_bond, opt) (fcn(nm_setting_bond_get_option_normalized((s_bond), (opt)))) +#define _v_u8(s_bond, opt) _nm_setting_bond_opt_value_as_u8((s_bond), (opt)) +#define _v_u16(s_bond, opt) _nm_setting_bond_opt_value_as_u16((s_bond), (opt)) +#define _v_u32(s_bond, opt) _nm_setting_bond_opt_value_as_u32((s_bond), (opt)) + *props = (NMPlatformLnkBond){ - .mode = _nm_setting_bond_mode_from_string( - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_MODE)), + .mode = _v_fcn(_nm_setting_bond_mode_from_string, s_bond, NM_SETTING_BOND_OPTION_MODE), .primary = _setting_bond_primary_opt_as_ifindex(s_bond), - .miimon = _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_MIIMON), - .updelay = _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_UPDELAY), - .downdelay = _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_DOWNDELAY), - .arp_interval = - _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_ARP_INTERVAL), - .resend_igmp = - _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_RESEND_IGMP), - .min_links = _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_MIN_LINKS), - .lp_interval = - _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_LP_INTERVAL), - .packets_per_port = - _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE), - .peer_notif_delay = - _nm_setting_bond_opt_value_as_u32(s_bond, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY), - .arp_all_targets = _nm_setting_bond_arp_all_targets_from_string( - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_ARP_ALL_TARGETS)), - .arp_validate = _nm_setting_bond_arp_validate_from_string( - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_ARP_VALIDATE)), - .ad_actor_sys_prio = - _nm_setting_bond_opt_value_as_u16(s_bond, NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO), - .ad_user_port_key = - _nm_setting_bond_opt_value_as_u16(s_bond, NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY), - .primary_reselect = _nm_setting_bond_primary_reselect_from_string( - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_PRIMARY_RESELECT)), - .fail_over_mac = _nm_setting_bond_fail_over_mac_from_string( - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_FAIL_OVER_MAC)), - .xmit_hash_policy = _nm_setting_bond_xmit_hash_policy_from_string( - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY)), - .num_grat_arp = - _nm_setting_bond_opt_value_as_u8(s_bond, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP), - .all_ports_active = - _nm_setting_bond_opt_value_as_u8(s_bond, NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE), - .lacp_rate = _nm_setting_bond_lacp_rate_from_string( - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_LACP_RATE)), - .ad_select = _nm_setting_bond_ad_select_from_string( - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_AD_SELECT)), + .miimon = _v_u32(s_bond, NM_SETTING_BOND_OPTION_MIIMON), + .updelay = _v_u32(s_bond, NM_SETTING_BOND_OPTION_UPDELAY), + .downdelay = _v_u32(s_bond, NM_SETTING_BOND_OPTION_DOWNDELAY), + .arp_interval = _v_u32(s_bond, NM_SETTING_BOND_OPTION_ARP_INTERVAL), + .resend_igmp = _v_u32(s_bond, NM_SETTING_BOND_OPTION_RESEND_IGMP), + .min_links = _v_u32(s_bond, NM_SETTING_BOND_OPTION_MIN_LINKS), + .lp_interval = _v_u32(s_bond, NM_SETTING_BOND_OPTION_LP_INTERVAL), + .packets_per_port = _v_u32(s_bond, NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE), + .peer_notif_delay = _v_u32(s_bond, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY), + .arp_all_targets = _v_fcn(_nm_setting_bond_arp_all_targets_from_string, + s_bond, + NM_SETTING_BOND_OPTION_ARP_ALL_TARGETS), + .arp_validate = _v_fcn(_nm_setting_bond_arp_validate_from_string, + s_bond, + NM_SETTING_BOND_OPTION_ARP_VALIDATE), + .ad_actor_sys_prio = _v_u16(s_bond, NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO), + .ad_user_port_key = _v_u16(s_bond, NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY), + .primary_reselect = _v_fcn(_nm_setting_bond_primary_reselect_from_string, + s_bond, + NM_SETTING_BOND_OPTION_PRIMARY_RESELECT), + .fail_over_mac = _v_fcn(_nm_setting_bond_fail_over_mac_from_string, + s_bond, + NM_SETTING_BOND_OPTION_FAIL_OVER_MAC), + .xmit_hash_policy = _v_fcn(_nm_setting_bond_xmit_hash_policy_from_string, + s_bond, + NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY), + .num_grat_arp = _v_u8(s_bond, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP), + .all_ports_active = _v_u8(s_bond, NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE), + .lacp_rate = _v_fcn(_nm_setting_bond_lacp_rate_from_string, + s_bond, + NM_SETTING_BOND_OPTION_LACP_RATE), + .ad_select = _v_fcn(_nm_setting_bond_ad_select_from_string, + s_bond, + NM_SETTING_BOND_OPTION_AD_SELECT), }; nm_ether_addr_from_string( From 46e3c23d857c8349f8c7f3d583005398310f4308 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 19 Sep 2022 08:27:13 +0200 Subject: [PATCH 4/4] bond: use _nm_setting_bond_opt_value_as_intbool() in _platform_lnk_bond_init_from_setting() Previously, we used _nm_utils_ascii_str_to_bool(). That can accept any kind of input (like "true"), so one might think that this is better to use on user-input. However, NMSettingBond already validates the these options are integers (either "0" or "1"). So a value like "true" could never be here. Use _nm_setting_bond_opt_value_as_intbool() because that asserts that the option if of the expected type (integer). (cherry picked from commit b1a72d0f212f0a7213d39a982ffa7540f27c1eeb) --- src/core/devices/nm-device-bond.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/core/devices/nm-device-bond.c b/src/core/devices/nm-device-bond.c index c854701f6a..3e083de461 100644 --- a/src/core/devices/nm-device-bond.c +++ b/src/core/devices/nm-device-bond.c @@ -399,6 +399,7 @@ _platform_lnk_bond_init_from_setting(NMSettingBond *s_bond, NMPlatformLnkBond *p #define _v_u8(s_bond, opt) _nm_setting_bond_opt_value_as_u8((s_bond), (opt)) #define _v_u16(s_bond, opt) _nm_setting_bond_opt_value_as_u16((s_bond), (opt)) #define _v_u32(s_bond, opt) _nm_setting_bond_opt_value_as_u32((s_bond), (opt)) +#define _v_intbool(s_bond, opt) _nm_setting_bond_opt_value_as_intbool((s_bond), (opt)) *props = (NMPlatformLnkBond){ .mode = _v_fcn(_nm_setting_bond_mode_from_string, s_bond, NM_SETTING_BOND_OPTION_MODE), @@ -437,21 +438,14 @@ _platform_lnk_bond_init_from_setting(NMSettingBond *s_bond, NMPlatformLnkBond *p .ad_select = _v_fcn(_nm_setting_bond_ad_select_from_string, s_bond, NM_SETTING_BOND_OPTION_AD_SELECT), + .use_carrier = _v_intbool(s_bond, NM_SETTING_BOND_OPTION_USE_CARRIER), + .tlb_dynamic_lb = _v_intbool(s_bond, NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB), }; nm_ether_addr_from_string( &props->ad_actor_system, nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM)); - opt_value = nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_USE_CARRIER); - if (opt_value != NULL) - props->use_carrier = _nm_utils_ascii_str_to_bool(opt_value, FALSE); - - opt_value = - nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB); - if (opt_value != NULL) - props->tlb_dynamic_lb = _nm_utils_ascii_str_to_bool(opt_value, FALSE); - opt_value = nm_setting_bond_get_option_normalized(s_bond, NM_SETTING_BOND_OPTION_ARP_IP_TARGET); if (opt_value != NULL) props->arp_ip_targets_num =