SC-14: IPv4/IPv6 dual-stack support - #14
Merged
Merged
Conversation
--ipv4/-4, --ipv6/-6, --address flags. tcpNetwork/resolveLocalAddr helpers threaded through the two real call sites needing them: daemon listener (cli/daemon.go) and daemon-client dial (cli/rsync_url.go). internal/daemon needed zero changes - it only operates on an already-built net.Listener/net.Conn handed to it. SSH transport: -4/-6 forwarded to the spawned ssh process, verified against real rsync's main.c - only when the resolved remote-shell basename is exactly 'ssh', matching the man page's guidance that other --rsh overrides need the flag passed manually. --address has two real, documented scopes (daemon listen address, client outbound source address) - never SSH, verified rather than assumed. Self-review caught a real typed-nil bug before shipping: assigning a possibly-nil *net.TCPAddr directly into net.Dialer.LocalAddr (a net.Addr interface field) would wrap a nil pointer in a non-nil interface, corrupting every dial when no --address was given. Fixed. --ipv4+--ipv6 together is an explicit error - real rsync's own popt silently lets whichever is parsed last win, an artifact of shared C storage, not a designed behavior worth replicating. Address validation is eager and uniform even for local syncs, a disclosed departure from real rsync's lazy/unchecked-if-unused behavior. Real loopback tests for 127.0.0.1 and ::1, a real address-family constraint proof (--ipv4 against an IPv6-only daemon fails with an actual dial tcp4 refused), SSH argv-forwarding tests including the non-ssh-shell case. IPv6 tests skip gracefully via requireIPv6Loopback. Manual smoke test confirmed a live IPv6-only daemon syncing correctly and --ipv4 genuinely failing against it. Clean on native Windows and cross-compiled Linux.
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.
--ipv4/-4, --ipv6/-6, --address flags. tcpNetwork/resolveLocalAddr helpers threaded through the two real call sites needing them: daemon listener (cli/daemon.go) and daemon-client dial (cli/rsync_url.go). internal/daemon needed zero changes - it only operates on an already-built net.Listener/net.Conn handed to it.
SSH transport: -4/-6 forwarded to the spawned ssh process, verified against real rsync's main.c - only when the resolved remote-shell basename is exactly 'ssh', matching the man page's guidance that other --rsh overrides need the flag passed manually. --address has two real, documented scopes (daemon listen address, client outbound source address) - never SSH, verified rather than assumed.
Self-review caught a real typed-nil bug before shipping: assigning a possibly-nil *net.TCPAddr directly into net.Dialer.LocalAddr (a net.Addr interface field) would wrap a nil pointer in a non-nil interface, corrupting every dial when no --address was given. Fixed.
--ipv4+--ipv6 together is an explicit error - real rsync's own popt silently lets whichever is parsed last win, an artifact of shared C storage, not a designed behavior worth replicating. Address validation is eager and uniform even for local syncs, a disclosed departure from real rsync's lazy/unchecked-if-unused behavior.
Real loopback tests for 127.0.0.1 and ::1, a real address-family constraint proof (--ipv4 against an IPv6-only daemon fails with an actual dial tcp4 refused), SSH argv-forwarding tests including the non-ssh-shell case. IPv6 tests skip gracefully via requireIPv6Loopback. Manual smoke test confirmed a live IPv6-only daemon syncing correctly and --ipv4 genuinely failing against it.
Clean on native Windows and cross-compiled Linux.