Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
No feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
ValentaTomas
force-pushed
the
main
branch
2 times, most recently
from
July 25, 2026 22:53
5aad415 to
d71980e
Compare
…orms getDefaultGateway identified the IPv4 default route with route.Dst.String() == "0.0.0.0/0". The kernel reports that route in one of two ways depending on kernel/netlink version: with Dst == nil (RTA_DST omitted) or with an explicit 0.0.0.0/0 Dst. The string check only matched the second form and silently missed the first. Match on the zero-length prefix via a new isDefaultRoute helper so both forms work, keeping the IPv4-only scope via route.Family (which is populated even when Dst is nil). Note: route.Dst.String() is nil-safe (net.IPNet.String() returns "<nil>" for a nil receiver), so the old code never panicked on the nil form; it just failed to find the gateway, which at package init (var defaultGateway = utils.Must(getDefaultGateway(ctx))) would panic the orchestrator on startup. Checking only Dst == nil would move that failure to hosts whose kernel sends 0.0.0.0/0 instead; the zero-prefix check covers both. Add a table-driven test over both default-route forms, a non-default prefix, and the IPv6 default; no root required.
AdaAibaby
force-pushed
the
fix/orchestrator-network-nil-route-dst
branch
from
November 10, 2026 08:25
a2304dc to
fbb12be
Compare
AdaAibaby
force-pushed
the
fix/orchestrator-network-nil-route-dst
branch
from
November 25, 2026 14:03
fbb12be to
6742058
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getDefaultGatewayidentified the IPv4 default route withroute.Dst.String() == "0.0.0.0/0". The kernel reports the default route in one of two ways depending on kernel/netlink version:Dst == nil—RTA_DSTomitted from the netlink message, or0.0.0.0/0Dst—RTA_DSTsent withDst_len == 0.The string check only matched the second form and silently missed the first.
Fix
Match on the zero-length prefix via a new
isDefaultRoutehelper, so both forms work. The IPv4-only scope is preserved viaroute.Family(which netlink populates even whenDstis nil).On the "nil panic"
route.Dst.String()is actually nil-safe —net.IPNet.String()returns"<nil>"for a nil receiver, so the original code never panicked on the nil form; it just failed to find the gateway. Because the gateway is resolved at package init (var defaultGateway = utils.Must(getDefaultGateway(ctx))), that miss would panic the orchestrator on startup.Checking only
Dst == nil(instead of the string) would move that same startup failure to hosts whose kernel does send0.0.0.0/0— verified on a host running kernel 6.8 / util-linux 2.39.3, where the default route comes back with a non-nil0.0.0.0/0Dst. The zero-prefix check covers both forms and avoids the panic on either kind of host.Verification
Truth table over the three predicates (old string check,
Dst == nil, and this fix):== "0.0.0.0/0"Dst == nilDst == nilDst == 0.0.0.0/0Dst == ::/0(v6)10.0.0.0/8Added a table-driven test (
host_default_route_test.go) covering both default-route forms, a non-default prefix, and the IPv6 default. No root required./cc @ryan-sana @jakubno @dobrac @ValentaTomas Looking forward to your code review.