ssh2 icon indicating copy to clipboard operation
ssh2 copied to clipboard

ssh2 doesn't work for ipv6 host address

Open devdil opened this issue 10 years ago • 32 comments

I was trying to connect to a ipv6 address from my host. It failed with error: ERROR: connect EINVAL

devdil avatar Oct 29 '16 10:10 devdil

Do you have a network interface with a valid IPv6 address?

mscdex avatar Oct 29 '16 10:10 mscdex

Also, if you pass the IPv6 address string to require('net').isIP() in a repl, what is the result?

mscdex avatar Oct 29 '16 10:10 mscdex

yeah it does have a valid network interface with valid ipv6 address, the ipv6 referred here is the host i m trying to connect to I also tried address%eth0 as the host string but didn't work.

On Sat, Oct 29, 2016 at 4:06 PM, Brian White [email protected] wrote:

Also, if you pass the IPv6 address string to require('net').isIP() in a repl, what is the result?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mscdex/ssh2/issues/487#issuecomment-257084201, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3NezSHtsxpwSTXgQEBVVevygJG7cYnks5q4yHCgaJpZM4KkE2s .

devdil avatar Oct 29 '16 16:10 devdil

What result do you get when calling isIP() on the address?

mscdex avatar Oct 29 '16 17:10 mscdex

returns 6 . Is this library tested for ipv6 as well?

On Sat, Oct 29, 2016 at 10:58 PM, Brian White [email protected] wrote:

What result do you get when calling isIP() on the address?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mscdex/ssh2/issues/487#issuecomment-257104385, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3Ne_HbdqhFNlPzMxG5O7qZ_HvGy1C5ks5q44I1gaJpZM4KkE2s .

devdil avatar Oct 30 '16 08:10 devdil

IPv6 support should be transparent, so there should be no reason to test it specifically.

What version of node is this?

Does connecting to the IPv6 address with the OpenSSH client work?

mscdex avatar Oct 30 '16 16:10 mscdex

yeah connecting via open ssh works

On Sun, Oct 30, 2016 at 10:22 PM, Brian White [email protected] wrote:

It should be transparent.

What version of node is this?

Does connecting to the IPv6 address with the OpenSSH client work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mscdex/ssh2/issues/487#issuecomment-257162757, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3NezVZsObjUwnxMpUVtzXy89feS9GWks5q5MtKgaJpZM4KkE2s .

devdil avatar Oct 30 '16 17:10 devdil

Node.js version?

mscdex avatar Oct 30 '16 17:10 mscdex

node verison is : 6.7.0

On Sun, Oct 30, 2016 at 11:15 PM, Brian White [email protected] wrote:

Node.js version?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mscdex/ssh2/issues/487#issuecomment-257166019, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3Ne5lPqqePGc2TOH4xdqNLhliZ9sxoks5q5NfUgaJpZM4KkE2s .

devdil avatar Oct 30 '16 18:10 devdil

Is the IPv6 address you're trying to connect to a link-local address (starts with fe80::)?

mscdex avatar Oct 30 '16 18:10 mscdex

correct its a link local address

On Mon, Oct 31, 2016 at 12:01 AM, Brian White [email protected] wrote:

Is the IPv6 address you're trying to connect to a link-local address (starts with fe80::)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mscdex/ssh2/issues/487#issuecomment-257169073, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3Ne1P-QLxp0pFOnOu0zzHkXtoJhuEvks5q5OJygaJpZM4KkE2s .

devdil avatar Oct 30 '16 18:10 devdil

For link-local addresses you will probably need to append the interface name, like: fe80::2acf:daff:fedd:342a%eth0

mscdex avatar Oct 30 '16 18:10 mscdex

tried that too, reports same error

On Mon, Oct 31, 2016 at 12:17 AM, Brian White [email protected] wrote:

For link-local addresses you will probably need to append the interface name, like: fe80::2acf:daff:fedd:342a%eth0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mscdex/ssh2/issues/487#issuecomment-257170046, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3NezuGl29vZqYFx5boa7IjG3LxsDYEks5q5OZJgaJpZM4KkE2s .

devdil avatar Oct 30 '16 19:10 devdil

is it tested for ipv6 as well?

On Mon, Oct 31, 2016 at 12:40 AM, Diljit Pr [email protected] wrote:

tried that too, reports same error

On Mon, Oct 31, 2016 at 12:17 AM, Brian White [email protected] wrote:

For link-local addresses you will probably need to append the interface name, like: fe80::2acf:daff:fedd:342a%eth0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mscdex/ssh2/issues/487#issuecomment-257170046, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3NezuGl29vZqYFx5boa7IjG3LxsDYEks5q5OZJgaJpZM4KkE2s .

devdil avatar Oct 30 '16 19:10 devdil

As previously stated there are no explicit IPv6 tests because node handles that, not ssh2.

FWIW I just tried this locally and it worked for me when I appended to the end of the link-local IPv6 address a % followed by the network interface name (eno1 in my case) the connection should be routed through.

mscdex avatar Oct 30 '16 19:10 mscdex

did you pass this string (ipv6%interface)as a hostname?

On Mon, Oct 31, 2016 at 12:58 AM, Brian White [email protected] wrote:

As previously stated there are no explicit IPv6 tests because node handles that, not ssh2.

FWIW I just tried this locally and it worked for me when I appended a % and then the network interface name the connection should be routed through to the end of the IPv6 address.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mscdex/ssh2/issues/487#issuecomment-257172802, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3Ne1Hx7Sq_OAUtwJOb9DdE5OQRZc1mks5q5O_TgaJpZM4KkE2s .

devdil avatar Oct 30 '16 19:10 devdil

Yes, like the example link-local address I mentioned earlier. Your network interface name may be different though.

mscdex avatar Oct 30 '16 19:10 mscdex

could you paste the code snipped you used just now?

devdil avatar Oct 30 '16 19:10 devdil

There is nothing special about the code, you can use any of the examples in the readme. The only change from those examples is the host config value, which is the IPv6 address followed by % and the network interface name the connection should go through.

mscdex avatar Oct 30 '16 19:10 mscdex

If adding that extra part after the IPv6 address does not work for you, and you are sure you have the correct network interface name, then you might need to post an issue to the node.js issue tracker.

mscdex avatar Oct 30 '16 19:10 mscdex