Skip to content

feat: Add network bonding configuration API#92

Open
kcirtapfromspace wants to merge 1 commit into
turing-machines:masterfrom
kcirtapfromspace:feature/network-bonding-config
Open

feat: Add network bonding configuration API#92
kcirtapfromspace wants to merge 1 commit into
turing-machines:masterfrom
kcirtapfromspace:feature/network-bonding-config

Conversation

@kcirtapfromspace

Copy link
Copy Markdown

Summary

Add support for configuring NIC link aggregation (bonding) via the REST API.

Changes

New Files

  • src/app/network_config.rs - Network bonding configuration module

Modified Files

  • src/app.rs - Added network_config module
  • src/api/legacy.rs - Added API handlers for network_config

Features

  • Manages bonding configuration via /etc/bonding.conf and /etc/bonding.enabled
  • Reads bonding status from /proc/net/bonding/bond0
  • Supports all Linux bonding modes:
    • balance-rr (0) - Round-robin
    • active-backup (1) - Failover
    • balance-xor (2) - XOR hash
    • broadcast (3) - All slaves transmit
    • 802.3ad (4) - LACP
    • balance-tlb (5) - Transmit load balancing
    • balance-alb (6) - Adaptive load balancing

API Endpoints

GET /api/bmc?opt=get&type=network_config

Returns current bonding status:

{
  "bonding_enabled": true,
  "bonding_mode": "802.3ad",
  "bonding_active": true,
  "slaves": ["ge0", "ge1"],
  "miimon": 100
}

GET /api/bmc?opt=set&type=network_config&enabled=1&mode=802.3ad&apply=1

Sets bonding configuration. Parameters:

  • enabled - "1" or "true" to enable bonding
  • mode - Bonding mode name or number
  • apply - "1" or "true" to apply changes immediately

Use Case

This enables the Turing Pi 2.5's dual NICs (ge0 and ge1) to be bonded for:

  • Increased bandwidth with 802.3ad LACP (requires switch support)
  • Failover redundancy with active-backup mode (no switch config needed)

Related PRs

🤖 Generated with Claude Code

Add support for configuring NIC link aggregation (bonding) via the REST API.

New module: src/app/network_config.rs
- Manages bonding configuration via /etc/bonding.conf and /etc/bonding.enabled
- Reads bonding status from /proc/net/bonding/bond0
- Supports all Linux bonding modes (balance-rr, active-backup, balance-xor,
  broadcast, 802.3ad, balance-tlb, balance-alb)

API endpoints:
- GET /api/bmc?opt=get&type=network_config
  Returns: bonding_enabled, bonding_mode, bonding_active, slaves, miimon

- GET /api/bmc?opt=set&type=network_config&enabled=1&mode=802.3ad&apply=1
  Sets bonding configuration and optionally applies changes

This enables the Turing Pi 2.5's dual NICs (ge0 and ge1) to be bonded
for increased bandwidth (with 802.3ad LACP) or failover redundancy
(with active-backup mode).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant