Filter default gateway routes by address family in dual-stack config#191
Open
maxpain wants to merge 1 commit intocloudbase:masterfrom
Open
Filter default gateway routes by address family in dual-stack config#191maxpain wants to merge 1 commit intocloudbase:masterfrom
maxpain wants to merge 1 commit intocloudbase:masterfrom
Conversation
When a network adapter has both IPv4 and IPv6 addresses with separate default gateways, _process_networks picks the first route with prefixlen == 0 regardless of address family. This causes IPv6 addresses to receive the IPv4 gateway (e.g., 169.254.0.1 instead of fe80::1), and the IPv6 default route is never configured. Filter the default gateway route candidates by matching the route's address family (0.0.0.0/0 vs ::/0) against the network address being configured. Signed-off-by: Max Makarov <maxpain@linux.com>
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.
Summary
When a network adapter has both IPv4 and IPv6 addresses with separate default gateways in network-config v2,
_process_networkspicks the first route withprefixlen == 0regardless of address family. This causes IPv6 addresses to receive the IPv4 gateway.For example, with this config:
Before: both addresses get gateway
169.254.0.1— IPv6 default route is never configured.After: IPv4 address gets
169.254.0.1, IPv6 address getsfe80::1.Fix
Filter default gateway route candidates by matching the route's address family (
0.0.0.0/0for IPv4,::/0for IPv6) against the network address being configured.Testing
test_execute_network_details_v2_dual_stack_gatewayscovering dual-stack gateway selection_test_execute_network_details_v2to account for correct address family filtering