# ftp server upload file via webcam problem



## motorcek (Jun 14, 2011)

Hello fellow FreeBSD users. 

I have run into a strange problem regarding my FTP server. I tried this on 8.2-STABLE and 7.4-RELEASE (clean install). The kernel on both was GENERIC. 

8.2 was added with pf and ALTQ firewall support/QoS. The setup goes without any problems, and the server is running and listening on a port. I have tried pure-ftpd and proftpd and had the same problem with both. 

If I try to connect to it from the Windows cmd prompt and upload a file, the transmission is OK. The problem is when I point the webcam to connect to the server's IP address and upload a jpg snapshot every 3 seconds. I have also disabled pf (since I thought it was somehow "in the way"), tried an additional IP address (alias) on the network interface. And also tried on two different computers (with different NICs).

When the webcam connects I get the following output from tcpdump:

```
[size="2"]2011-05-28 19:57:15.459824 IP 192.168.0.50.4910 > 192.168.0.1.ftp: Flags [S], seq 2784003893, win 5840, options [mss 1460,sackOK,TS val 15431197 ecr 0,nop,wscale 0], length 0
2011-05-28 19:57:15.459971 IP 192.168.0.1.ftp > 192.168.0.50.4910: Flags [S.], seq 3804901862, ack 2784003894, win 65535, options [mss 1460,nop,wscale 3,sackOK,TS val 1500563249 ecr 15431197], length 0
2011-05-28 19:57:15.460898 IP 192.168.0.50.4910 > 192.168.0.1.ftp: Flags [.], ack 1, win 5840, options [nop,nop,TS val 15431197 ecr 1493172224], length 0
2011-05-28 19:57:15.460932 IP 192.168.0.1.ftp > 192.168.0.50.4910: Flags [R], seq 3804901863, win 0, length 0[/size]
```

Since I also have the third server which I attempt to upgrade (currently running 6.3-RELEASE-p5, with pure-ftpd) and this one works as it is supposed. Tcpdump output:

```
[size="2"]2011-05-30 20:53:56.364738 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: S 4023175117:4023175117(0) win 5840 <mss 1460,sackOK,timestamp 234146 0,nop,wscale 0>
2011-05-30 20:53:56.364768 IP 192.168.0.3.ftp > 192.168.0.50.sae-urn: S 4289846947:4289846947(0) ack 4023175118 win 65535 <mss 1460,nop,wscale 1,nop,nop,timestamp 2823939058 234146,sackOK,eol>
2011-05-30 20:53:56.365770 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: . ack 1 win 5840 <nop,nop,timestamp 234146 2818572288>
2011-05-30 20:53:56.367130 IP 192.168.0.3.ftp > 192.168.0.50.sae-urn: P 1:315(314) ack 1 win 33304 <nop,nop,timestamp 2823939060 234146>
2011-05-30 20:53:56.368176 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: . ack 315 win 6432 <nop,nop,timestamp 234146 2823939060>
2011-05-30 20:53:56.392853 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: P 1:16(15) ack 315 win 6432 <nop,nop,timestamp 234149 2823939060>
2011-05-30 20:53:56.392959 IP 192.168.0.3.ftp > 192.168.0.50.sae-urn: P 315:356(41) ack 16 win 33304 <nop,nop,timestamp 2823939086 234149>
2011-05-30 20:53:56.397480 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: P 16:32(16) ack 356 win 6432 <nop,nop,timestamp 234149 2823939086>
2011-05-30 20:53:56.404746 IP 192.168.0.3.ftp > 192.168.0.50.sae-urn: P 356:451(95) ack 32 win 33304 <nop,nop,timestamp 2823939098 234149>
2011-05-30 20:53:56.451929 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: P 32:39(7) ack 451 win 6432 <nop,nop,timestamp 234155 2823939098>
2011-05-30 20:53:56.452012 IP 192.168.0.3.ftp > 192.168.0.50.sae-urn: P 451:483(32) ack 39 win 33304 <nop,nop,timestamp 2823939145 234155>
2011-05-30 20:53:56.456353 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: P 39:47(8) ack 483 win 6432 <nop,nop,timestamp 234155 2823939145>
2011-05-30 20:53:56.456393 IP 192.168.0.3.ftp > 192.168.0.50.sae-urn: P 483:513(30) ack 47 win 33304 <nop,nop,timestamp 2823939149 234155>
2011-05-30 20:53:56.464301 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: P 47:53(6) ack 513 win 6432 <nop,nop,timestamp 234156 2823939149>
2011-05-30 20:53:56.464445 IP 192.168.0.3.ftp > 192.168.0.50.sae-urn: P 513:562(49) ack 53 win 33304 <nop,nop,timestamp 2823939157 234156>
2011-05-30 20:53:56.469833 IP 192.168.0.50.4501 > 192.168.0.3.49355: S 4010196316:4010196316(0) win 5840 <mss 1460,sackOK,timestamp 234156 0,nop,wscale 0>
2011-05-30 20:53:56.469859 IP 192.168.0.3.49355 > 192.168.0.50.4501: S 3591992723:3591992723(0) ack 4010196317 win 65535 <mss 1460,nop,wscale 1,nop,nop,timestamp 2823939163 234156,sackOK,eol>
2011-05-30 20:53:56.470943 IP 192.168.0.50.4501 > 192.168.0.3.49355: . ack 1 win 5840 <nop,nop,timestamp 234157 2818572288>
2011-05-30 20:53:56.472126 IP 192.168.0.50.sae-urn > 192.168.0.3.ftp: P 53:88(35) ack 562 win 6432 <nop,nop,timestamp 234157 2823939157>[/size]
```

I tried to search the forum, but found nothing regarding this problem (or just not entering the right string into search engine). Am I missing something obvious here, or is the packet from webcam somehow "weird" and gets dropped by FreeBSD?

Thank you very much for your answers.


----------



## mix_room (Jun 15, 2011)

Take a look at the logs of the ftp-server. The interesting things should be in there, if you are not logging, then start doing that.


----------



## motorcek (Jun 15, 2011)

Thank you for your answer mix_room. I have looked up the config files of both pure-ftpd and proftpd, and set them for debug. If I upload a file from command line then all is OK and logged. But when the webcam attemtps to connect there is no logfile whatsoever (but the packets are arriving according to tcpdump. I believe that the packet is somehow dropped by the kernel. This does not make much sense since tcpdump prints out (the code above) every time, and when interrupted via ctrl+c:

```
^C
4 packets captured
4 packets received by filter
0 packets dropped by kernel
```

Maybe some sysctl variable(s) that needs fine-tuning? Is this even the right thread for this type of questions?


----------



## motorcek (Oct 14, 2011)

Update on this: Tried installing 6.4-RELEASE in virtual box and now the FTP works, I presume that FreeBSD 7 upwards handles TCP packet somewhat differently??


----------

