Skip to content

ftp: Fix data connection to IPv6 link-local address

Ben Wolsieffer requested to merge benwolsieffer/gvfs:ftp-ipv6-link-local into master

With IPv6, the passive mode data connection address is constructed by taking the control socket address and replacing the port with the one specified in the EPSV response. In doing so, we lose the scope-id and flowinfo properties. The scope-id field in particular is required when connecting to a link local address, as it determines which link the address belongs to. Without it, the connection fails.

To fix this, manually construct the GInetSocketAddress instance, copying all the fields except the port from the old address.

I've never used GLib before, but it appears to be acceptable practice to directly call g_object_new() rather than relying on the convenience wrapper (g_inet_socket_address_new()). In any case, I don't see an alternative.

Merge request reports