Fix get nexthop IP address for OVN mgmt interface - #4131
Conversation
|
🤖 Created branch: z_pr4131/yboaron/fix-ovn-gateway-network-address |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughOVN host-network route selection skips gateway-less network-address routes while retaining gateway-less host routes. Regression tests verify valid gateway selection and host-route handling during reconciliation. ChangesOVN gateway route selection
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to This localized fix rejects invalid network-address gateways and adds coverage for the behavior; no actionable merge-blocking risk remains beyond normal checks and review. Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/routeagent_driver/handlers/ovn/host_networking.go`:
- Around line 183-187: The route filtering in getNextHopOnK8sMgmtIntf must skip
masked network-address routes without rejecting valid /32 or /128 host routes;
update pkg/routeagent_driver/handlers/ovn/host_networking.go#L183-L187
accordingly. Add a Gw == nil host-route case in
pkg/routeagent_driver/handlers/ovn/handler_test.go#L822-L895 and verify its
Dst.IP is selected after a network-address route is skipped.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0b10259b-a5d4-4dfa-bc9f-10f20aff2dc4
📒 Files selected for processing (2)
pkg/routeagent_driver/handlers/ovn/handler_test.gopkg/routeagent_driver/handlers/ovn/host_networking.go
e456685 to
216fa46
Compare
The getNextHopOnK8sMgmtIntf() function would return Dst.IP when no explicit gateway was set on a route. However, Dst.IP is the network address (the base of the CIDR), not a valid host IP. Fix: Added validation to skip routes where Dst.IP equals the network address (IP & Mask == IP), but allow host routes (/32 or /128) where Dst.IP is a valid host address. Tests: Added test cases to verify: 1. Network addresses are rejected when route order changes 2. Host routes (/32 or /128) with Gw=nil are accepted Addresses CodeRabbit review comment about preserving /32 and /128 routes. Fixes: submariner-io#4121 Signed-off-by: Yossi Boaron <yboaron@redhat.com>
216fa46 to
4f5ccce
Compare
|
cc @tpantelis |
|
🤖 Closed branches: [z_pr4131/yboaron/fix-ovn-gateway-network-address] |
The getNextHopOnK8sMgmtIntf() function would return Dst.IP when no explicit gateway was set on a route. However, Dst.IP is the network address (the base of the CIDR), not a valid host IP.
This PR adds validation to skip routes where Dst.IP equals the network address (IP & Mask == IP). This ensures only valid host IPs are used as gateways.
Also added test case to verify network addresses are rejected and only valid host addresses are used as gateways.
Fixes: #4121
Summary by CodeRabbit
Bug Fixes
Tests