bond: merge branch 'ff/bond_primary'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1362
This commit is contained in:
Thomas Haller 2022-09-13 10:41:35 +02:00
commit c92fe1bfa0
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
4 changed files with 9 additions and 8 deletions

View file

@ -493,6 +493,10 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason)
if (!nm_device_hw_addr_set_cloned(device, nm_device_get_applied_connection(device), FALSE))
ret = NM_ACT_STAGE_RETURN_FAILURE;
}
/* This is a workaround because netlink do not support ifname as primary */
set_bond_attr_or_default(device, s_bond, NM_SETTING_BOND_OPTION_PRIMARY);
nm_device_bring_up(device, TRUE, NULL);
return ret;

View file

@ -1589,11 +1589,8 @@ _parse_lnk_bond(const char *kind, struct nlattr *info_data)
if (tb[IFLA_BOND_MODE])
props->mode = nla_get_u8(tb[IFLA_BOND_MODE]);
if (tb[IFLA_BOND_PRIMARY]) {
props->primary = nla_get_u32(tb[IFLA_BOND_PRIMARY]);
} else if (tb[IFLA_BOND_ACTIVE_SLAVE]) {
props->primary = nla_get_u32(tb[IFLA_BOND_ACTIVE_SLAVE]);
}
if (tb[IFLA_BOND_PRIMARY])
props->primary = NM_CLAMP((int) nla_get_u32(tb[IFLA_BOND_PRIMARY]), 0, G_MAXINT);
if (tb[IFLA_BOND_MIIMON]) {
props->miimon = nla_get_u32(tb[IFLA_BOND_MIIMON]);
props->miimon_has = TRUE;
@ -4539,7 +4536,7 @@ _nl_msg_new_link_set_linkinfo(struct nl_msg *msg, NMLinkType link_type, gconstpo
NLA_PUT_U32(msg, IFLA_BOND_PACKETS_PER_SLAVE, props->packets_per_port);
if (props->peer_notif_delay_has)
NLA_PUT_U32(msg, IFLA_BOND_PEER_NOTIF_DELAY, props->peer_notif_delay);
if (props->primary)
if (props->primary > 0)
NLA_PUT_U32(msg, IFLA_BOND_PRIMARY, props->primary);
if (props->resend_igmp_has)
NLA_PUT_U32(msg, IFLA_BOND_RESEND_IGMP, props->resend_igmp);

View file

@ -6093,7 +6093,7 @@ nm_platform_lnk_bond_to_string(const NMPlatformLnkBond *lnk, char *buf, gsize le
&len,
"bond"
" mode %u"
" primary %u"
" primary %d"
"%s" /* miimon */
"%s" /* updelay */
"%s" /* downdelay */

View file

@ -889,6 +889,7 @@ extern const NMPlatformLnkBridge nm_platform_lnk_bridge_default;
#define NM_BOND_MAX_ARP_TARGETS 16
typedef struct {
int primary;
in_addr_t arp_ip_target[NM_BOND_MAX_ARP_TARGETS];
guint32 arp_all_targets;
guint32 arp_interval;
@ -899,7 +900,6 @@ typedef struct {
guint32 min_links;
guint32 packets_per_port;
guint32 peer_notif_delay;
guint32 primary;
guint32 resend_igmp;
guint32 updelay;
guint16 ad_actor_sys_prio;