Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

ftp session problem

Altera_Forum
Honored Contributor II
2,638 Views

Thanks in advance. 

 

I've got a custom embedded uClinux NIOS system with a compact flash (I use ext3). The system records *.bin files and we extract them via ftp using "mget." After a few files I get 

 

425 Can't open passive connection: Cannot assign requested address. 

Passive mode refused. Turning off passive mode. 

 

I have used the 2c35 evaluation board to recreate the problem AND do ftp with debug on. I higlighted the output problem with "italics" 

It appears that the CLIENT gets confused and tries to open the port 

using IT'S ip address. I did some googling and am basically don't have  

any good ideas how I can prevent this problem. 

 

Any solutions, things to try, ... WOULD BE GREATLY APPRECITED. 

 

 

****************************************** 

FTP Session Linux client to Evaluation Board (same FTP server). With 

DEBUG VERBOSE (-dv) enabled (NOTE: apwr is set in my Network stuff so 

I don't have to type 129.131.7.220 all the time). Also the IP address of the Linux 

machine I was running the client upon was 129.131.7.14. 

TRIED WITH WINDOW ftp client and same story ... 

**************************************************************************** 

[janet@localhost ~]$ ftp -dv apwr 

Connected to AARGMpwr. 

220- Welcome to the uClinux ftpd! 

220 uClinux FTP server (GNU inetutils 1.4.1) ready. 

ftp: setsockopt: Bad file descriptor 

---> AUTH GSSAPI 

500 'AUTH GSSAPI': command not understood. 

---> AUTH KERBEROS_V4 

500 'AUTH KERBEROS_V4': command not understood. 

KERBEROS_V4 rejected as an authentication type 

Name (apwr:janet): ftp 

---> USER ftp 

331 Guest login ok, type your name as password. 

Password: 

---> PASS XXXX 

230 Guest login ok, access restrictions apply. 

cmds.c:276: verbose=2 debug=1 overbose=2 

---> SYST 

215 UNIX Type: L8 Version: uClinux 2.6.30 

Remote system type is UNIX. 

Using binary mode to transfer files. 

ftp> ls 

ftp: setsockopt (ignored): Permission denied 

---> PASV 

227 Entering Passive Mode (129,131,7,220,160,219) 

---> LIST 

150 Opening ASCII mode data connection for '/bin/ls'. 

226 Transfer complete. 

ftp> passive 

Passive mode off. 

ftp> passive 

Passive mode on. 

ftp> mget *.bin 

ftp: setsockopt (ignored): Permission denied 

---> PASV 

---> NLST *.bin 

mget PWR_01-01-00-00.01.18.bin? y 

---> TYPE I 

200 Type set to I. 

ftp: setsockopt (ignored): Permission denied 

---> PASV 

227 Entering Passive Mode (129,131,7,220,184,190) 

---> RETR PWR_01-01-00-00.01.18.bin 

150 Opening BINARY mode data connection for 'PWR_01-01-00-00.01.18.bin' (43657216 bytes). 

226 Transfer complete. 

43657216 bytes received in 47 seconds (9.1e+02 Kbytes/s) 

mget PWR_01-01-00-00.02.40.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> PASV 

227 Entering Passive Mode (129,131,7,220,176,103) 

---> RETR PWR_01-01-00-00.02.40.bin 

150 Opening BINARY mode data connection for 'PWR_01-01-00-00.02.40.bin' (1232896 bytes). 

226 Transfer complete. 

1232896 bytes received in 1.4 seconds (8.4e+02 Kbytes/s) 

mget PWR_01-01-00-00.02.41.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> PASV 

227 Entering Passive Mode (129,131,7,220,219,122) 

---> RETR PWR_01-01-00-00.02.41.bin 

150 Opening BINARY mode data connection for 'PWR_01-01-00-00.02.41.bin' (10937344 bytes). 

226 Transfer complete. 

11175936 bytes received in 15 seconds (7.3e+02 Kbytes/s) 

mget PWR_01-01-00-00.03.18.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> PASV 

227 Entering Passive Mode (129,131,7,220,179,173) 

---> RETR PWR_01-01-00-00.03.18.bin 

150 Opening BINARY mode data connection for 'PWR_01-01-00-00.03.18.bin' (4663296 bytes). 

226 Transfer complete. 

4663296 bytes received in 5.1 seconds (8.9e+02 Kbytes/s) 

mget PWR_01-01-00-00.06.23.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> PASV 

227 Entering Passive Mode (129,131,7,220,229,249) 

---> RETR PWR_01-01-00-00.06.23.bin 

150 Opening BINARY mode data connection for 'PWR_01-01-00-00.06.23.bin' (23447552 bytes). 

226 Transfer complete. 

23447552 bytes received in 25 seconds (9e+02 Kbytes/s) 

mget PWR_07-14-11-17.20.13.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> PASV 

425 Can't open passive connection: Cannot assign requested address. 

Passive mode refused. Turning off passive mode. 

ftp: setsockopt (ignored): Permission denied 

---> port 129,131,7,14,220,164 

500 Illegal PORT Command 

ftp: bind: Address already in use 

mget PWR_07-14-11-21.02.42.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> port 129,131,7,14,207,36 

500 Illegal PORT Command 

mget PWR_07-14-11-21.03.25.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> port 129,131,7,14,229,98 

500 Illegal PORT Command 

mget PWR_07-15-11-15.22.29.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> port 129,131,7,14,164,234 

500 Illegal PORT Command 

mget PWR_07-15-11-16.02.54.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> port 129,131,7,14,172,37 

500 Illegal PORT Command 

mget PWR_07-15-11-16.14.25.bin? y 

ftp: setsockopt (ignored): Permission denied 

---> port 129,131,7,14,186,147 

500 Illegal PORT Command 

mget PWR_07-15-11-16.21.58.bin? n  

mget PWR_07-15-11-22.35.36.bin? n 

ftp> quit 

---> QUIT 

221 Goodbye. 

[janet@localhost ~]$
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,271 Views

I don't know exactly what you did to get these messages 

---> AUTH GSSAPI 500 'AUTH GSSAPI': command not understood. ---> AUTH KERBEROS_V4 500 'AUTH KERBEROS_V4': command not understood. KERBEROS_V4 rejected as an authentication type  

but they probably has something do with this problem. 

And there is also the problem that you didn't login with the right acount. 

You just used the "guest" account which is not able to your commands. 

So try to use the "root"-account from you uClinux board when logging in.
0 Kudos
Altera_Forum
Honored Contributor II
1,271 Views

Urmel (and anyone else), 

 

What you have commented upon has nothing to do with my problem. When you use NIOS2 with uClinux you typically use GUEST ftp login. 

 

"ftp" with no password and you can only work in "/home/ftp" defined in "passwd" So I changed the "passwd" file to point to my compact flash. 

 

so i am logged on properly and i can transfer files for awhile. 

 

MORE INFORMATION -- 

I added a user in "passwd" and loggeed on to FTP as a user so that the FTP transactions WERE NOT as a GUEST and I still get the same problem. 

 

Thanks in advance.
0 Kudos
Altera_Forum
Honored Contributor II
1,271 Views

FIXED THIS ISSUE -- 

 

Problem is a bug in the uClinux ftpd.c code.  

 

I found a blog from 2003  

http://blog.gmane.org/gmane.linux.uclinux.devel/month=20061101/page=36 

 

Code here just in case this link is flakey 

************************** 

Subject: [BUG] ftpd 

Newsgroups: gmane.comp.gnu.inetutils.bugs 

Date: Fri, 29 Aug 2003 21:28:31 +0900 

 

Hello 

 

I found a bug. 

if "nm ftpd | sort -n" show: 

1001cba8 b bufs.135 

1001ce78 b ctrl_addr 

1001ce88 b data_source 

then ctrl_addr will be destroyed, and ftp client 

will get message like this: 

425 Can't create data socket (56.0.0.135,0): Cannot assign requested 

address. 

 

diff -u ftpd.c_org ftpd.c 

--- ftpd.c_org Wed Jun 26 12:15:05 2002 

+++ ftpd.c Fri Aug 29 21:15:41 2003 

@@ -192,7 +192,7 @@ 

static char bufs[NUM_SIMUL_OFF_TO_STRS][80]; 

static char (*next_buf)[80] = bufs; 

 

- if (next_buf > (bufs+NUM_SIMUL_OFF_TO_STRS)) 

+ if (next_buf >= (bufs+NUM_SIMUL_OFF_TO_STRS)) 

next_buf = bufs; 

 

if (sizeof (off) > sizeof (long)) 

------------------------------------------------------------ 

 

When I introduced this change in my ftpc.c the problem is resolved. 

 

Anyone have any further comments on this and/or the above mentioned bug 

report? 

 

Thanks. 

 

/Martin 

********************* 

 

Basically, a fix for this problem was submitted way back then and is not in the current "ftpd.c" file (in uClinux-dist/user/ftpd directory). I made the fix, tested it and it works great. I can now mget with no problems. 

 

Hope this helps someone else.
0 Kudos
Reply