Bug 44025 - FTP download issue with IPv6
Summary: FTP download issue with IPv6
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries (show other bugs)
Version: XI 9.99 (iOS 10 previews)
Hardware: Macintosh Mac OS
: High normal
Target Milestone: (C9)
Assignee: Alexander Köplinger [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2016-09-06 15:01 UTC by Xavier Bailliet
Modified: 2017-02-02 09:04 UTC (History)
7 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Xavier Bailliet 2016-09-06 15:01:09 UTC
FTP download code does not work on NAT64 network (testing for Apple store).

I connect my iphone to my mac set as a NAT64 router, run the code below to test the app with IPv6 and I get this error:System.Net.WebException: Cannot open passive data connection.

code:

//Create A 2MB Cache Buffer
byte[] Buffer = new byte[2048];
int FileLenght = 0;

//Create An FTP Client Request
FtpWebRequest Request = (FtpWebRequest)WebRequest.Create(FTP);
Request.Method = WebRequestMethods.Ftp.DownloadFile;

//Use A Login Credential
//Request.Credentials = new NetworkCredential("USER", "PASS");

//Receive An Answer From Server
FtpWebResponse Response = (FtpWebResponse)Request.GetResponse();
Stream ResponseStream = Response.GetResponseStream();

//Write The File To The SDCARD
StreamWriter Output = new StreamWriter(Local, false);

//Store On Buffer And Write TO SDCARD
while ((FileLenght = ResponseStream.Read(Buffer, 0, Buffer.Length)) > 0)
{
	for (int i = 0; i < FileLenght; i++)
	{
		Output.Write((char)Buffer[i]);
	}
}

//Close File Stream Writer
Output.Close();

//Close Connection Request
Response.Close();

The error only happen with NAT64 network, I tested the NAT64 network with the same code on an android device and other apps on the market with success.
Comment 1 Vincent Dondain [MSFT] 2016-09-08 14:39:02 UTC
Hi, I could successfully reproduce this issue with the following versions of our products: https://gist.github.com/VincentDondain/4edea68e968b73cd3f7c6deb5b10e6d4

To do that I created this sample app: https://www.dropbox.com/s/ptgb09wpn7hdag3/Bug44025.zip?dl=0 (it's using a dummy ftp that you can access and tries to download a readme file).

To simulate a NAT64 network I used this guide (section "Test for IPv6 DNS64/NAT64 Compatibility Regularly") https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html

Here is the exception we're getting: https://gist.github.com/VincentDondain/32515f43df9894f3d6a5878ca5f89454 [on (FtpWebResponse)request.GetResponse ()]

Full build logs: https://gist.github.com/VincentDondain/910c49022d770cd1f00a337ef7a38f34
Comment 2 Xavier Bailliet 2016-09-09 09:16:22 UTC
Hi Vincent,

Because of this issue my app has been rejected by apple and I have my customer asking when the app will be released? Do we have an ETA for this bug fix? or failing that could you just let me know what are the next steps likely to be?

Thank you,

Xavier
Comment 3 Vincent Dondain [MSFT] 2016-09-26 16:03:44 UTC
Hey,

This is not a trivial issue in the BCL. I cannot give you any information with regard to when this will be fixed.

I'd recommend you use the native APIs in order to submit your app (NSUrlConnection and NSUrlDownload in the case of iOS).

Cheers.
Comment 4 Alexander Köplinger [MSFT] 2016-10-12 18:26:28 UTC
I implemented the BCL support in this PR: https://github.com/mono/mono/pull/3762
Comment 5 Alexander Köplinger [MSFT] 2016-10-13 18:37:01 UTC
Merged to mono master and mono-4.8.0-branch. Thanks!
Comment 6 Sebastien Pouliot 2016-10-13 19:38:32 UTC
QA: XI/XM won't have the fix available to confirm before https://github.com/xamarin/xamarin-macios/pull/991 is merged.
Comment 7 Sebastien Pouliot 2016-10-14 15:35:41 UTC
QA: https://github.com/xamarin/xamarin-macios/pull/991 did the bump so any package after 84e9975e41f48e2444d233eda64112377856276c can be used to test
Comment 8 Danish Akhtar 2017-02-02 09:04:54 UTC
Reproduce status:
I am also able to reproduce this issue, after following Comment 1, with X.iOS 10.0.0.3,  application throws System.Net.WebException. 

Here is the screencast for the same: https://www.screencast.com/t/WjKFWUkI

Verification Status:
I connect my iphone to my mac set as a NAT64 router and observed that application is launched and running successfully on iOS device with C9 X.iOS 10.4.0.105 & Master X.iOS 10.5.0.424 

Hence closing this issue.

Thanks!

Note You need to log in before you can comment on or make changes to this bug.