Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-mod-network: link bonding policy not propagated #7683

Open
1 task done
jpsollie opened this issue Mar 17, 2025 · 12 comments
Open
1 task done

luci-mod-network: link bonding policy not propagated #7683

jpsollie opened this issue Mar 17, 2025 · 12 comments

Comments

@jpsollie
Copy link

jpsollie commented Mar 17, 2025

Is there an existing issue for this?

  • I have searched among all existing issues (including closed issues)

screenshots or captures

when creating a link aggregation interface with the new netifd system instead of luci-proto-bonding (which was removed a few weeks ago), I enter in luci the option "active-backup" (view screenshot):

Image

But in /proc/net/bondjp it states round-robin:

cat /proc/net/bonding/bondjp 
Ethernet Channel Bonding Driver: v6.6.83

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: lan1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: ba:96:7a:2e:1b:71
Slave queue ID: 0

Slave Interface: sfp-lan
MII Status: up
Speed: 2500 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: ba:96:7a:2e:1b:72
Slave queue ID: 0
root@APBureau4:~# 

There's also nothing written in /etc/config/networks about an active-backup policy (though I don't know whether this should be, the documentation isn't clear):

config device
        option type 'bonding'
        option name 'bondjp'
        list ports 'lan1'
        list ports 'sfp-lan'
        option primary 'sfp-lan'
        option multicast_router '2'
        option multicast_fast_leave '1'
        option promisc '1'

IMO this is a bug, and I hope the missing parameter can be added, but if someone could help me to verify whether uci knows it should be active-backup (which makes it a main openwrt bug), it'd love to hear

Actual behaviour

a newly created link aggegation interface is started in round-robin mode, whereas it should be as active-backup

Expected behaviour

the interface is started as active-backup

Steps to reproduce

Image

Additional Information

{
        "kernel": "6.6.83",
        "hostname": "APBureau4",
        "system": "ARMv8 Processor rev 0",
        "model": "Bananapi BPI-R4",
        "board_name": "bananapi,bpi-r4",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "firmware_url": "https://downloads.openwrt.org/",
                "revision": "r0+29008-0aaabffdea",
                "target": "mediatek/filogic",
                "description": "OpenWrt SNAPSHOT r0+29008-0aaabffdea",
                "builddate": "1742051600"
        }
}

What browsers do you see the problem on?

No response

Relevant log output

@systemcrash
Copy link
Contributor

Since active-backup is the default, perhaps it is elided, with the assumption that netifd also chooses that.

Please try to add the explicit config line to /etc/config/networks

policy 'active-backup'

resulting in:

config device
        option type 'bonding'
        option name 'bondjp'
        list ports 'lan1'
        list ports 'sfp-lan'
        option primary 'sfp-lan'
        option multicast_router '2'
        option multicast_fast_leave '1'
        option promisc '1'
        policy 'active-backup'

and reload that interface or restart networking. Let us know your results.

@systemcrash
Copy link
Contributor

Any ideas from @hitech95 ?

@jpsollie
Copy link
Author

policy active-backup didn't do what we expected it would do ... do I need to forward this bug to the main repository?

@hitech95
Copy link
Contributor

Any ideas from @hitech95 ?

I'll take a look later today.
Thi might be a bug in both luci and netifd.

policy active-backup didn't do what we expected it would do ... do I need to forward this bug to the main repository?

Can you better explain the expected result so I can later run a test on your config?
What was the configuration with luci-proto-bonding?

@jpsollie
Copy link
Author

the expected result would be:
cat /proc/net/bond/bondjp shows "Bonding Mode: Active-backup"
Attached I'll add my /etc/config/networks with luci-proto-bonding

network.txt

@systemcrash
Copy link
Contributor

At a glance it seems the variable simply needs renaming to bonding_policy. @jpsollie please try:

config device
        option type 'bonding'
        option name 'bondjp'
        list ports 'lan1'
        list ports 'sfp-lan'
        option primary 'sfp-lan'
        option multicast_router '2'
        option multicast_fast_leave '1'
        option promisc '1'
        bonding_policy 'active-backup'

@jpsollie
Copy link
Author

At a glance it seems the variable simply needs renaming to bonding_policy. @jpsollie please try:

config device
        option type 'bonding'
        option name 'bondjp'
        list ports 'lan1'
        list ports 'sfp-lan'
        option primary 'sfp-lan'
        option multicast_router '2'
        option multicast_fast_leave '1'
        option promisc '1'
        bonding_policy 'active-backup'

nope, didn't work, still round-robin

@systemcrash
Copy link
Contributor

OK.

https://github.com/openwrt/netifd/blob/ea01ed41f3212ecbe000422f3c122a01b93fe874/bonding.c#L86-L112

Source says policy.

Might it be worth testing to see whether the machinery is in place and manually setting bonding itself works with various modes?:

ip link add bond0 type bond
ip link set bond0 down
ip link set bond0 type bond mode <mode>
ip link set lan1 down
ip link set lan1 master bond0
ip link set sfp-lan down
ip link set sfp-lan master bond0
ip link set bond0 up

@hitech95
Copy link
Contributor

I confirm tha the node is called 'policy' yesterday I've missed that.

@jpsollie
Copy link
Author

OK.

https://github.com/openwrt/netifd/blob/ea01ed41f3212ecbe000422f3c122a01b93fe874/bonding.c#L86-L112

Source says policy.

Might it be worth testing to see whether the machinery is in place and manually setting bonding itself works with various modes?:

ip link add bond0 type bond
ip link set bond0 down
ip link set bond0 type bond mode <mode>
ip link set lan1 down
ip link set lan1 master bond0
ip link set sfp-lan down
ip link set sfp-lan master bond0
ip link set bond0 up

ok, I put your commands in a shell script:

#!/bin/bash
ip link add bond0 type bond
ip link set bond0 down
ip link set bond0 type bond mode active-backup
ip link set lan1 down
ip link set lan1 master bond0
ip link set sfp-lan down
ip link set sfp-lan master bond0
ip link set bond0 up

and executed it, here's what I got:

root@APBureau4:~# ip link del bondjp
root@APBureau4:~# sh /tmp/shellscript.sh
root@APBureau4:~# cat /proc/net/b
bnep      bonding/
root@APBureau4:~# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v6.6.83

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: lan1
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: lan1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: ba:96:7a:2e:1b:71
Slave queue ID: 0

Slave Interface: sfp-lan
MII Status: up
Speed: 2500 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: ba:96:7a:2e:1b:72
Slave queue ID: 0
root@APBureau4:~#

so I guess that's what it should be

@systemcrash
Copy link
Contributor

It looks like the system can do it correctly. Not necessarily netifd. But when you used the proto handler @jpsollie , link bonding also worked?

@jpsollie
Copy link
Author

I assume it did (don't take my word for it): I never had problems with active-backup before, and the policy was set to active-backup on the client PC's networkmanager ...

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

No branches or pull requests

3 participants