wlb: T7977: Fix weight calculation for multiple interfaces - #4823
Conversation
|
👍 |
|
Provided example confusing What does |
|
@sever-sever the output was just what I had in my nftables at the time since I needed to make sure both equal weight and unequal weight configs work. What was in the output wasn’t really important, just that it existed after the change when 3 or more interfaces were configured. |
I considered doing that, but I worried it could be fragile. For instance, when you first configure WLB, it may not fail since the interfaces are not in an active state (the vmap would be empty at that point). So it may pass no matter what. It's only when the health-checks pass and the interfaces go into an active state would cause illegal nftables config. |
|
Smoke tests passed health checks, as I remember. We use vethpairs |
|
Yeah, but it's being done with a bunch of static sleep timers to overcome that fragility. I may have a better way for that, so it's not adding a bunch of time to the testing. |
|
@c-po @sever-sever I added a smoketest along with a helper function that waits for a condition to be met or reach a timeout. |
- Fixed issue in T7977 - Added smoketest for 3 or more interfaces in rule - Added wait_for function to utils/misc.py
169c6c4 to
559dd60
Compare
sarthurdev
left a comment
There was a problem hiding this comment.
Good catch and thanks for the fix. Tested locally.
Do you think it'd be beneficial to also verify the verdict map in a smoketest?
The accuracy of the vmaps appears to be checked in |
I was thinking more to extend it so it also covers instances of more than 2 interfaces. |
|
There's probably some value to that. A lot of users with multiple interfaces may just do this when they have 2 interfaces: But with 3 or more interfaces, they may have weights across multiple interfaces (or all of them), which makes the logic a little more rigid. It seems to be handled fine right now, but it could be good regression protection to have it covered in a smoketest. |
|
@sarthurdev Do you want me to extend the smoketest I added to validate the vmaps have the correct number of weight buckets? Or would it be added in a different PR? |
|
@l0crian1 please extend the smoketest and then we can merge it. |
|
@c-po Done! |
|
CI integration 👍 passed! Details
|
Change summary
When more than 2 interfaces were configured in a WLB rule, nftables would fail to load the config since there were duplicate keys in the vmap. This corrects that issue.
Types of changes
Related Task(s)
https://vyos.dev/T7977
Related PR(s)
How to test / Smoketest result
Configure 3 or more interfaces in a WLB rule:
Before:
Check for presence of nft chain:
Errors can be viewed in the log. You'll see errors like this:
After:
Check the nft chain. vmap keys are now correct:
Smoketest results:
Checklist: