Skip to content

ip link add: support bond device creation#30

Merged
cathay4t merged 1 commit into
rust-netlink:mainfrom
cathay4t:bond
Jun 1, 2026
Merged

ip link add: support bond device creation#30
cathay4t merged 1 commit into
rust-netlink:mainfrom
cathay4t:bond

Conversation

@cathay4t

@cathay4t cathay4t commented Jun 1, 2026

Copy link
Copy Markdown
Member

Introduced support ip link add NAME type bond [OPTIONS].
Accepts all bond options identical to iproute2:

mode, active_slave, miimon, updelay, downdelay,
peer_notify_delay, use_carrier, arp_interval, arp_validate,
arp_all_targets, arp_ip_target, ns_ip6_target, primary,
primary_reselect, fail_over_mac, xmit_hash_policy,
resend_igmp, num_grat_arp/num_unsol_na, all_slaves_active,
min_links, lp_interval, packets_per_slave, tlb_dynamic_lb,
lacp_rate, lacp_active/ad_lacp_active, coupled_control,
broadcast_neighbor, ad_select, ad_user_port_key,
ad_actor_sys_prio, ad_actor_system, arp_missed_max

Uses netlink-packet-route FromStr/Display for all bond options
(BondMode, BondArpValidate, BondArpAllTargets, BondPrimaryReselect,
BondFailOverMac, BondAdSelect, BondXmitHashPolicy) via a generic
parse_from_str helper.

Added arp_ip_target, ns_ip6_target, ad_actor_sys_prio,
ad_user_port_key, ad_actor_system display fields.

Includes 7 integration tests for bond creation with various
option combinations.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for creating, configuring, and displaying network bond interfaces, including parsing various bond options and adding integration tests. The review feedback suggests several improvements: using the matched key instead of hardcoded strings in error messages for certain bond parameters, trimming whitespace when parsing comma-separated IP target lists to prevent parsing failures, and checking for empty target vectors to avoid formatting issues in the display output.

Comment thread src/ip/link/ifaces/bond.rs
Comment thread src/ip/link/ifaces/bond.rs
Comment thread src/ip/link/ifaces/bond.rs
Comment thread src/ip/link/ifaces/bond.rs
Comment thread src/ip/link/ifaces/bond.rs Outdated
@cathay4t cathay4t force-pushed the bond branch 2 times, most recently from 3fd128f to 1b9c849 Compare June 1, 2026 02:56
@cathay4t

cathay4t commented Jun 1, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for creating and configuring network bond interfaces, including parsing bond parameters, updating serialization and display formatting, and adding integration tests. The review feedback highlights opportunities to improve parsing robustness and compatibility with standard iproute2 behavior. Specifically, it suggests filtering out empty segments when parsing comma-separated IP targets, supporting string descriptors for all_slaves_active, and allowing '0' and '1' values for boolean options like lacp_active, coupled_control, and broadcast_neighbor.

Comment thread src/ip/link/ifaces/bond.rs
Comment thread src/ip/link/ifaces/bond.rs
Comment thread src/ip/link/ifaces/bond.rs Outdated
Comment thread src/ip/link/ifaces/bond.rs
Comment thread src/ip/link/ifaces/bond.rs
Introduced support `ip link add NAME type bond [OPTIONS]`.
Accepts all bond options identical to iproute2.

Uses netlink-packet-route FromStr/Display for all bond options
(BondMode, BondArpValidate, BondArpAllTargets, BondPrimaryReselect,
BondFailOverMac, BondAdSelect, BondXmitHashPolicy) via a generic
parse_from_str helper.

Added arp_ip_target, ns_ip6_target, ad_actor_sys_prio,
ad_user_port_key, ad_actor_system display fields.

Includes 7 integration tests for bond creation with various
option combinations.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
@cathay4t cathay4t enabled auto-merge (rebase) June 1, 2026 03:18
@cathay4t cathay4t merged commit 38440f6 into rust-netlink:main Jun 1, 2026
3 checks passed
@cathay4t cathay4t deleted the bond branch June 1, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant