HomeDefectsLIN1019-10729
Fixed

LIN1019-10729 : SFTP connection error with IPv6

Created: Dec 27, 2023    Updated: Dec 11, 2024
Resolved Date: Jan 14, 2024
Found In Version: 10.19.45.2
Fix Version: 10.19.45.31
Severity: Standard
Applicable for: Wind River Linux LTS 19
Component/s: Userspace

Description

An issue when using the "<user>@[<IPv6_address>]" syntax for using SFTP with an IPv6 address. 
SFTP shows the following error:

=== user1@host1 ~ #   {*}sftp user2@\{*}{*}[2021:aaaa::4]{*}
ssh: Could not resolve hostname [2021:aaaa::4]: Name or service not known
Connection closed

With a different syntax, when user is specified as an option, sftp works correctly:

=== user1@host1 ~ # *sftp -oUser=user2* \{*}[2021:aaaa::4]{*}
Password: 
Connected to 2021:aaaa::4.
sftp>

At the same time, the SCP utility works correctly with both syntaxes:

=== user1@host1 ~ # {*}scp test1.txt user2@\{*}{*}[2021:aaaa::4]:/tmp/{*}
Password: 
test1.txt               100%    0     0.0KB/s   00:00

=== user1@host1 ~ # *scp -oUser=user2 test1.txt \[2021:aaaa::4]:/tmp/*
Password: 
test1.txt               100%    0     0.0KB/s   00:00

I have reproduced this on an LTS18 intel-x86-64 build to which I've added the SFTP client package as such:
_IMAGE_INSTALL_append += "openssh-sftp"_

On my side, when trying to connect from an LTS18 RCPL29 host to an Ubuntu host, SFTP returns the same error.

 *# sftp felix@\[<Ubuntu_IPv6_address>]*
ssh: Could not resolve hostname [<Ubuntu_IPv6_address>]: Name or service not known
Connection closed

However, when using the ssh syntax, with -oUser, this works as expected: 
 *# sftp -oUser=felix \[<Ubuntu_IPv6_address>]*
Password: 
Connected to <Ubuntu_IPv6_address>.
sftp>

I've also noticed that when manually specifying the directory as below, sftp also works as expected:

 *# sftp felix@\[<Ubuntu_IPv6_address>]:/home/felix*
Password: 
Connected to <Ubuntu_IPv6_address>.
sftp>

Steps to Reproduce

# create a project with intel-x86-64 BSP and "openssh-sftp" package
 # boot the project and enable the network.
 # try to connect to another host via sftp, using the standard syntax, i.e. 
# sftp user@&#92;[<host2_IPv6_address>]