AnsweredAssumed Answered

Slow FTP-TCP connection on indirect routes - MSS always 536 Bytes

Question asked by CorderBollie on Oct 3, 2014
Latest reply on Oct 16, 2014 by Radek Sestak


I'm running MQX 4.1.1 and a FTP server is running on a MQX device behind a router. The devices IP address is The router has a public IP address and port forwards FTP requests to the MQX device.

When a connection is established from outside the local network the FTP servers accepts the connection but advertises a window size of 512 Bytes whereas the maximum segement size (MSS) is 536 Bytes. In my opinion the window size should be equal to or a multiple of MSS. However this is not critical.


The problem I have is that when the FTP server opens the active connection to the connected client it always advertises a MSS of 536 Bytes although the ENET interface is setup for a MTU of 1500 bytes.


I tracked down the problem to the function IP_MTU (called form tcp.c->TCP_Process_packet) that determines the correct MTU size depending on the route type of the connection.

I seems like there are three types (DIRECT, INDIRECT, VIRTUAL) however if the route type is indirect the method always returns the default MTU of 576 Bytes.

In my case the route type is INDIRECT but IP_MTU does not handle that case, instead returns a MTU of 576 Bytes.


In tcp.c (TCP_Process_packet) the return value is evaluated (see code below)


if ( tcb->remote_host == INADDR_ANY ) {

  tcb->remote_host = source;

  tcb->rcvmss = IP_MTU(tcb->local_host, source)

  - (uint_16) (IP_HEADSIZE + TCP_HEADSIZE);

  if (tcb->sndmss > tcb->rcvmss) {

  tcb->sndmss = tcb->rcvmss;


  tcb->sndmax = tcb->sndmss;

  } /* Endif */


Here tcb->sndmss (which is 1400 bytes) is greater than the reported tcb->rcvmss (536 bytes) and this results in advertising a window size of 536 Bytes and MSS of 536 bytes. This slows down the transfer rate.


Is this behaviour correct or should IP_MTU return the ethernet interfaces MTU of 1500 even if the route type is INDIRECT?