Bug 4016 - literal IPv6 addresses not supported in ssh protocol
Summary: literal IPv6 addresses not supported in ssh protocol
Status: CLOSED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.9
Hardware: All Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-13 09:43 UTC by David A. Madore
Modified: 2006-10-15 13:26 UTC (History)
0 users

See Also:


Attachments
Fix to avoid skipping the leading '[' (307 bytes, patch)
2006-09-17 20:17 UTC, Wayne Davison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David A. Madore 2006-08-13 09:43:53 UTC
It seems that literal IPv6 addresses are supported in rsync:// URI's (this was bug 1675, which is now fixed), but not in ssh.  For example, compare the following behavior of rsync and scp:

vega david ~ $ rsync -av '[fe80::213:d4ff:fee9:3951%eth1]:./empty' /tmp/
ssh: fe80::213:d4ff:fee9:3951%eth1]: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at io.c(463) [receiver=2.6.8]
vega david ~ $ scp -p '[fe80::213:d4ff:fee9:3951%eth1]:./empty' /tmp/
Password:
empty                                         100%    0     0.0KB/s   00:00
vega david ~ $ ssh fe80::213:d4ff:fee9:3951%eth1
Password:
Linux neptune 2.6.16-2-k7 #1 Sat Jul 15 23:05:41 UTC 2006 i686
<...>

Here I used link-local IPv6 addresses with a scope identifier just to emphasize (and also because you don't need real IPv6 connectivity or any kind of setup to test this), but it doesn't work any better with (non-scoped) global addresses:

vega david ~ $ rsync -av '[2001:7a8:7171:37:213:d4ff:fee9:3951]:./empty' /tmp/
ssh: 2001:7a8:7171:37:213:d4ff:fee9:3951]: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at io.c(463) [receiver=2.6.8]
vega david ~ $ scp -p '[2001:7a8:7171:37:213:d4ff:fee9:3951]:./empty' /tmp/
Password:
empty                                         100%    0     0.0KB/s   00:00

This is with rsync version 2.6.8, but I also tried with today's CVS.

I'd be really glad if this were fixed (especially for scoped ll addresses, as there's no way to register them in DNS, so they *must* be literal, and in some cases, when DHCP is out of order or something, ll IPv6 is the best kind of connection one can achieve!).

I emphasize that this is not a dup of bug 1675.

Happy hacking!
Comment 1 Wayne Davison 2006-09-17 20:17:39 UTC
Created attachment 2144 [details]
Fix to avoid skipping the leading '['

This patch gets rid of the code that skips the leading '[' before handing the hostname off to ssh.  I believe that this should work OK, but I can't test it at the moment (since I can't test IPv6 at the moment).  The other option would be to leave the leading '[' stripped and to add stripping of the trailing ']'.
Comment 2 Wayne Davison 2006-09-17 20:21:42 UTC
This fix was checked into CVS.
Comment 3 David A. Madore 2006-09-18 05:16:49 UTC
Unfortunately, ssh will not accept hostnames within brackets (I think it should be more liberal in what it accepts), so you need to strip both '[' and ']'.
Comment 4 David A. Madore 2006-09-18 05:21:43 UTC
(By the way, on most systems - Linux, FreeBSD, OpenBSD, etc. - you might be able to test IPv6, even without a global IPv6 address, just by loading the module at boot and using link-local addresses, or, if even that's not an option, using ::1 which is the IPv6 loopback.)
Comment 5 Wayne Davison 2006-09-30 01:14:38 UTC
I checked-in a fix for this last week.