Skip to content

Conversation

@maxime-leroy
Copy link
Collaborator

small fixes for grcli add/del route ops

@maxime-leroy maxime-leroy mentioned this pull request May 28, 2025
@maxime-leroy maxime-leroy changed the title Fix ip routes ops fix ip routes add/del ops May 28, 2025
@rjarry rjarry force-pushed the fix_ip_routes_ops branch from 3cd2b00 to a9eef71 Compare May 28, 2025 16:18
Previously, adding a route that already existed would silently succeed if
exist_ok was true, even when the nexthop was different.

This behavior is incorrect, as the user expects either the same route with
the same nexthop to exist, or an error to be returned.

This patch ensures that an error is returned when a route exists with a
different nexthop, regardless of the exist_ok flag.

Signed-off-by: Maxime Leroy <[email protected]>
Previously, attempting to delete a route whose nexthop is directly
connected (i.e., not a gateway) would fail with -EBUSY. For example:
 add  ip address 6.6.7.7/24 iface p4
 add ip route 83.0.0.0/24 via 6.6.7.7
 del ip route 83.0.0.0/24
 error: command failed: Device or resource busy

This behavior stems from route4/6_del, which checks whether the nexthop is
a gateway before allowing deletion. If not, it assumes the nexthop is still
in use and blocks the operation.

However, there is no functional reason to prevent deletion in this
case. The underlying rib4/6_del logic ensures that a nexthop is only fully
removed when its reference count drops to zero—preserving it as long as
it's still needed by a connected route.

Signed-off-by: Maxime Leroy <[email protected]>
@rjarry rjarry force-pushed the fix_ip_routes_ops branch from a9eef71 to a7f7eaa Compare May 28, 2025 18:00
@rjarry rjarry merged commit f268e86 into DPDK:main May 28, 2025
7 of 8 checks passed
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.

2 participants