Skip to content

SC-14: IPv4/IPv6 dual-stack support - #14

Merged
iampryce merged 1 commit into
mainfrom
sc-14-ipv4-ipv6
Aug 2, 2026
Merged

SC-14: IPv4/IPv6 dual-stack support#14
iampryce merged 1 commit into
mainfrom
sc-14-ipv4-ipv6

Conversation

@iampryce

@iampryce iampryce commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

--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.

--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.
@iampryce
iampryce requested a review from jasonmiller-cc August 2, 2026 05:28
@iampryce
iampryce merged commit 3cf0cd4 into main Aug 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant