6
24
Fork
You've already forked ifstate
13

feature/ecmp-route-support #196

Open
goeranh wants to merge 8 commits from goeranh/ifstate:feature/ecmp-route-support into main
pull from: goeranh/ifstate:feature/ecmp-route-support
merge into: routerkit:main
routerkit:main
routerkit:move-paths-into-module
routerkit:feature-libifstate-rs
routerkit:ifstate-2.4
routerkit:pages
routerkit:ifstate-2.1
routerkit:ifstate-2.3
routerkit:ifstate-2.0
routerkit:ifstate-2.2
routerkit:ifstate-1.x
Member
Copy link

tested with the following config:

interfaces:
 eth0:
 addresses:
 - 192.168.122.123/24
 link:
 state: up
 kind: physical
 address: 52:54:00:07:47:c5
 identify:
 perm_address: 52:54:00:07:47:c5
 parent_dev_name: virtio0
 parent_dev_bus_name: virtio
routing:
 routes:
 - to: 0.0.0.0/0
 nexthops:
 - dev: eth0
 via: 192.168.122.1
 weight: 2
 - dev: eth0
 via: 192.168.122.2
 weight: 1
 rules: []

this closes #195

tested with the following config: ``` interfaces: eth0: addresses: - 192.168.122.123/24 link: state: up kind: physical address: 52:54:00:07:47:c5 identify: perm_address: 52:54:00:07:47:c5 parent_dev_name: virtio0 parent_dev_bus_name: virtio routing: routes: - to: 0.0.0.0/0 nexthops: - dev: eth0 via: 192.168.122.1 weight: 2 - dev: eth0 via: 192.168.122.2 weight: 1 rules: [] ``` this closes #195
liske added this to the 2.5.0 milestone 2026年06月26日 15:45:36 +02:00
liske left a comment
Copy link

You need to do a large rebase due to #193 got merged.

You need to do a large rebase due to #193 got merged.
@ -18,0 +22,4 @@
has_mp1 = 'multipath' in r1
has_mp2 = 'multipath' in r2
if has_mp1 or has_mp2:
Owner
Copy link

The expression should be negated to make the code better readable (less indentation).

The expression should be negated to make the code better readable (less indentation).
@ -18,0 +26,4 @@
# If caller is doing a key-only match (multipath not in fields),
# basic cmp_fields is enough — a single-path route is a valid
# "same route entry" for a multipath route (will be replaced).
if 'multipath' not in fields:
Owner
Copy link

This check should be move just after the cmp_fields call.

This check should be move just after the `cmp_fields` call.
@ -18,0 +36,4 @@
# Compare nexthops order-independently
mp1 = sorted(r1['multipath'],
key=lambda x: (x.get('gateway', x.get('via', {}).get('addr', '')),
x.get('oif', 0)))
Owner
Copy link

This looks weird, could you explain what this should do?

This looks weird, could you explain what this should do?
Author
Member
Copy link

this sorts all the nexthops of a route so they can be checked for equality more reliably to avoid readding the same ecmp route when the kernel netlink attributes are not in the same order - the lambds function is the sorting criteria

this sorts all the nexthops of a route so they can be checked for equality more reliably to avoid readding the same ecmp route when the kernel netlink attributes are not in the same order - the lambds function is the sorting criteria
Owner
Copy link

But why are gateway and via are mixed up? IMHO all routes are normalized before comparing routes.

But why are `gateway` and `via` are mixed up? IMHO all routes are normalized before comparing routes.
Some checks failed
pull request build test / build (pull_request) Successful in 1m23s
pull request pages test / mike (pull_request) Has been cancelled
This pull request has changes conflicting with the target branch.
  • libifstate/routing/__init__.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/ecmp-route-support:goeranh-feature/ecmp-route-support
git switch goeranh-feature/ecmp-route-support
Sign in to join this conversation.
No reviewers
Labels
Clear labels
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
more info
Further details are required, the problem may not yet be reproducible, yet
question
Further information is requested
TBD
To be discussed
wontfix
This will not be worked on
AI slop
Burning out
bug
Something is not working
contribution welcome
Contributions are very welcome, get started here
duplicate
This issue or pull request already exists
enhancement
New feature
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
invalid
Something is wrong
question
More information is needed
upstream
Related to an upstream repository, already reported there
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
routerkit/ifstate!196
Reference in a new issue
routerkit/ifstate
No description provided.
Delete branch "goeranh/ifstate:feature/ecmp-route-support"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?