You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow specifying IPv4 or IPv6 _only_ on connect #770
User weylin on Freenode encountered an issue (via Fabric) where:
The hostname resolution is returning IPv6 before IPv4;
IPv6 address is technically connectable (no resolution, connection or timeout errors occur);
But network filtering prevents actual SSH-level connections from occurring (resulting in exceptions at the banner step).
It's possible this means the spot where we raise the banner error should be more rigorous about what's going on. But the requested change - and the one that's easier to implement and probably solves a whole host of edge cases like this one - was for tighter control over which address families are used when connecting.
(Side note: it's possible for users to work around this by passing in the IPv4 address explicitly instead of the hostname, e.g. using socket.gethostbyname(name) which tends to return IPv4 only. But it's probably still more elegant to implement a 'fix' by the below...)
Should probably not be hard to update Client._families_and_addresses (and connect, and Fabric's connect) so they take a kwarg or two specifying IPv4 only / IPv6 only, which then in _families_and_addresses causes the loop (or maybe the getaddrinfo call itself) to omit one family or the other.
Slightly related is #686, insofar as it's another probably easily changed/fixed issue in the same area.
Reacted by Sacha, Petr Vorel, Håvard Pedersen and Alexis Deruelle
Activity
fuzzy76 commentedon Apr 29, 2022
A good start would be to support the
AddressFamilydirective in ssh_config.