Fix panic for dual-stack network as path endpoint in print-path#56
Merged
Drachionix merged 1 commit intohknutzen:masterfrom Mar 18, 2026
Merged
Fix panic for dual-stack network as path endpoint in print-path#56Drachionix merged 1 commit intohknutzen:masterfrom
Drachionix merged 1 commit intohknutzen:masterfrom
Conversation
Drachionix
requested changes
Mar 11, 2026
| } | ||
| // If one side is a dual-stack (combined46) network, pick the part | ||
| // that matches the IP version of the other side. | ||
| if i == 1 { |
Collaborator
There was a problem hiding this comment.
Why is this inside of the loop over params? I think it should be placed after it so we don't need to check for the second iteration.
Comment on lines
+85
to
+89
| if l[0].isCombined46() && l[0].isIPv6() != l[1].isIPv6() { | ||
| l[0] = l[0].combined46 | ||
| } | ||
| if l[1].isCombined46() && l[1].isIPv6() != l[0].isIPv6() { | ||
| l[1] = l[1].combined46 |
Collaborator
There was a problem hiding this comment.
Those lines are almost the same and should be simplified.
Drachionix
approved these changes
Mar 18, 2026
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.
When a dual-stack network is given as endpoint, expandGroup returns both IPv4 and IPv6 halves. The code always picked elements[0] (IPv4), causing a nil pointer panic when the other endpoint was IPv6-only. Fix: after both endpoints are known, swap to the matching IP version via combined46.