History: mip_tcp

This page describes all changes made to the mip_tcp package, TCP, since its release.


6.47 (2021-05-05, 14:30):

  • Fixed compiler warnings.

6.46 (2021-05-04, 19:00):

  • Introduced tcp_get_connection_info() API to return TCP connection's state and both local and remote IP addresses and port numbers.

6.45 (2021-04-16, 12:45):

  • Improved send buffer limitation to include transmit wait queue. Previously only packets waiting for ACK were included in the check if the limit was reached; this caused incorrect behavior when the window size of the remote peer was reached before the limit. In such cases the limitation did not work.

6.44 (2021-03-05, 14:00):

  • IP buffer allocation allowed when the peer sent a FIN request, to be able to send possible, outstanding data.

6.43 (2021-02-16, 15:10):

  • Added mechanism to limit number of buffers waiting for acknowledgment in the transmit queue.
  • Introduced tcp_set_option() API function.

6.42 (2020-10-22, 08:28):

  • Corrected closing connection in CLOSE_WAIT state (FIN without ACK was previously sent).

6.41 (2020-10-22, 11:30):

  • Compilation warning removed (added missing enum in switch() state).

6.40 (2020-10-06, 12:30):

  • Added CONFIG_GENERATE_ISN configuration option to invoke a PSP call to allow user generated initial sequence number.

6.39 (2020-06-23, 13:20):

  • Added new error code to filtering function, which allows the module to silently drop a received connection request from the call-back function registered with tcp_open_ext() or tcp_port_set_filter() called when a SYN is received. With this error code it is possible to indicate that the received frame should be ignored instead of responding with an RST.

6.38 (2020-06-04, 9:10):

  • IP buffers were not released if in TIME-WAIT state a TCP datagram in sequence was received without data in it. This issue could slowly consume all IP buffers, stopping the correct operation of the whole TCP/IP stack.

6.37 (2020-05-20, 22:31):

  • MISRA-C:2012: violations eliminated (MISRA-C:2004 revoked).
  • tcp_open_ext() API added to be able to define whether to accept IPv4 and/or IPv6 connections and to request a callback function that can be used to accept or reject a client connection request.
  • tcp_port_set_filter() API added to achieve the same as with the tcp_open_ext() for  an already opened connection. 

6.36 (2020-02-12, 08:45):

  • Fixed removal of closed connection from port pending queue. Previously, if there were multiple connections, the closing connection was not removed if it was in middle of the queue, which lead to infinite loop in tcp_accept().

6.35 (2019-12-05, 17:18):

  • Compilation warning removed

6.34 (2019-11-25, 15:58):

  • MISRA-C:2004: violations eliminated.

6.33r2 (2019-11-25, 12:30):

  • AutoSAR test report added to the package.

6.33 (2019-09-06, 12:00):

  • If a TCP frame received in sequence overlapped with a full out-of-sequence TCP frame received earlier then the TCP/IP stack could stop working correctly (IP buffer was present in two different queues).

6.32 (2019-05-30, 09:00):

  • NULL pointer access could happen if the registered callback function was called by the TCP module just after removing it (due to close or interface drop).

6.31 (2019-03-11, 09:00):

  • Corrected checking of maximum value for received sequence number.

6.30 (2019-02-13, 16:55):

  • MISRA-C:2004: violations eliminated.

6.29 (2019-01-21, 11:30):

  • Overlapped messages are now merged to existing data (previously, old data was dropped).
  • Corrected sending of ACK for incorrect packets. (Previously ACK was send for ACK that was smaller than current sequence number).

6.28 (2019-01-16, 12:45):

  • Added data handling in final ACK of three way handshake.

6.27 (2018-12-14, 12:00):

  • MISRA-C:2004: violations eliminated.

6.26 (2018-10-17, 17:59):

  • Incoming TCP packets might previously be incorrectly treated as invalid. This forced the sending node to resend the packets unnecessarily, causing performance issues.

6.25 (2018-09-19, 12:41):

  • Added IP aliasing support for IPv4.

6.24r2 (2018-08-29, 18:09):

  • Document HTML link added to the documentation folder.
  • History and document files renamed to the package name.

6.24 (2018-07-27, 13:15):

  • Corrected Sequence number/ acknowledge number checking for incoming packets to conform with RFC 792.
  • Corrected Reset handling: reset is valid if sequence number is correct, or if state is SYN-SENT and acknowledge number is correct.

6.23 (2018-07-10, 08:45):

  • Added sending of Keepalive ACK, when keepalive packet received without data.
  • Corrected window length calculation (previously an overflow could occur).
  • Corrected insertion of out of sequence packets (previously only first packet from RX acknowledge wait queue was inserted).

6.22 (2018-05-16, 08:11):

  • Valid SEQ number sent with RST packet when out-of-sequence ACK was received in LISTEN state.
  • Sending RST when out-of-sequence ACK was received in SYN-SENT state.

6.21 (2018-03-19, 8:35):

  • Corrected ACK/SEQ number check in FIN-WAIT-1/FIN-WAIT-2 state.
  • Changes related to MISRA static analysis.

6.20 (2018-03-19, 14:30):

  • Corrected ACK number check when receiving RST+ACK packet.

6.19 (2018-03-06, 14:00):

  • Changed tce_unack_len to uint32_t to enable it to handle maximum unacknowledged length of 0xFFFFu.

6.18 (2018-03-05, 13:00):

  • Added generation of IP_NTF_TX_RDY to tcp_tx_ready_ntf() (in some situations this function waited until timeout, because IP_NTF_TX_RDY was not generated).
  • Added extra sending of Window expand window when last send window size will be lower than 2*unacknowledged data length.
  • Corrected SEQ and ACK numbers when simultaneous close.
  • Corrected RST handling in SYN-RECEIVED state.
  • RST is now issued when TCP packet is received after LAST-ACK becomes CLOSED state.
  • SEQ number in ACK packet is now correct when TCP packet is received in TIME-WAIT state.
  • TCP DATA packet is dropped when received in SYN-SENT state (no ACK is sent).
  • TCP DATA packet is dropped when received in CLOSE-WAIT state (no ACK is sent).

6.17 (2018-02-26, 11:04):

  • TCP_KEEPALIVE_IDLE_TIMEOUT set to high (>65535) values caused TCP keep-alive malfunction and compiler warnings.

6.16 (2018-01-19, 15:00):

  • Corrected window size calculation for fragmented packets.

6.15 (2018-01-16, 15:45):

  • Corrected error during handling of data during FIN-WAIT-1, FIN-WAIT-2. This error caused IP buffer to be sent twice.

6.14 (2017-12-21, 12:30):

Checking of acknowledgment and sequence number in states FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, and LAST-ACK.

  • State LAST-ACK now transits to CLOSED after receiving a correct acknowledgment.
  • State FIN-WAIT-1 now sends correct sequence in acknowledgment to received FIN (simultaneous connection close).
  • ESTABLISHED state acknowledges packets with acknowledgment set to outside of receiving window.
  • Now responds to data received during FIN-WAIT-1, FIN-WAIT-2 with an RST message.

6.13 (2017-11-23, 12:02):

  • Checks acknowledgment and sequence number of RST packets and drops if invalid.
  • Checks acknowledgment and sequence number of ACK packets and replies with correct numbers in ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, and CLOSING states.
  • Now sends RST if receives an invalid ACK in SYN-RCVD state.

6.12 (2017-10-27, 11:24):

  • Added support for enabling TCP keep-alive mechanism on individual connections.

6.11 (2017-08-15, 11:48):

  • New API function tcp_get_local_mss_window() added to get local MSS and Receive windows size on a connection.

6.10 (2017-06-14, 07:11):

  • TCP connection can be accepted when it is already in CLOSE WAIT state and there is received data.


  • Half open connections with SYNC bit are now rejected.
  • Send Reset function now correctly handles packets with TCP options.


  • Added detection of half-open connections.


  • Corrected destination IP address of re-transmitted packets.
  • Corrected tcp_connect(): created connection is aborted if connection timeouts.
  • Cleared VC++ compilation warnings about potentially uninitialized variables.


  • Corrected compilation warnings related to tcp_handle_rx_pkt().


  • Local address is now taken from incoming connection for IPv6.
  • ip_route_get_ip_addr() is called only once for IPv6 connection to prevent changing of local address during connection.


  • compilation warnings eliminated.


  • TCP header options NOP and EOL handling implemented.


  • warnings eliminated.


  • IP address type is changed in tcp_connect() function.
  • updated to work with IP base major version 6.


 - tcp_connect() function parameters changed, local port can be defined.

 - updated to work with IP base major version 5.


 - Checksum calculation and verification can be switched separately for protocols.

 - Sending of RST flagged packets was fixed.


 - output parameter added to tcp_rx_ready() which reports the amount of unread bytes of a connection.


 - required package version checks added.


 - tcp_get_buf() function parameters changed.

 - never send more than MTU size packet to a remote node (to make sure TCP packets do not need to be fragmented).

 - retry sending a missed TCP control datagram, instead of waiting forever for a buffer if it's not immediately available. This fix is required because all timer related operations could block in case a buffer was not available.


 - added TCP_LOCAL_PORT_COUNT to the configuration file. This way initiated connections will rotate the port number between TCP_LOCAL_PORT_BASE and TCP_LOCAL_PORT_BASE + TCP_LOCAL_PORT_COUNT - 1. The original implementation used fixed port numbers from TCP_LOCAL_PORT_BASE using the connection index.

 - tcp_set_ip_opt() function introduced.

 - abort connection from tcp_disconnect if called when connection establishment is in progress.

 - corrected IP_MTU_SIZE buffer size request for tcp_get_buf().


 - added the option to set MSS, window size and max. unacknowledged length for every interface.

 - set IP TTL for sent TCP packets.


 - introduced HCC_UNUSED_ARG for unused arguments.

 - timeouts rounded up to higher values.


 - updated to work with the new routing module.


 - comments fixed.


 - TCP will not send RST datagram in case a connection can't be accepted because port is not opened, or max. number of connections on the port is reached or the system ran out of free connections.


 - Further TCP packets could be sent even if remote window size shrank to zero.


 - added mutex lock/unlock to ip_tcp_delete() where required as mutex lock/unlock was removed from ip_stack_delete().


 - The system could lockup if in RESET state a datagram was received for that connection.

 - Packet re-transmission was not executed anymore if sending the packet failed once (this could mean that if ETH cable was unplugged during transmission, packet sending was never retried).


 - tcp_connection_state() can return IP_DISCONNECT_WAIT.


 - multi-interface compliant.


 - duplicated ACK packets occurred if smaller than TCP_MAX_UNACK_LEN packet was received and a packet was sent before TCP_RX_UNACK_TIMEOUT.


 - converted to use IP buffer notification if buffer is not available when a control datagram needs to be sent.

 - IP buffer release fixed at unexpected connection close/reset.

 - First RX notification could have been lost after tcp_accept().

 - If an opened connection was closed before tcp_accept() could obtain the connection then it was corrupted. This only happened with OS.


 - lockup could occur if connection close/reset arrived before the sent package was acknowledged.


 - Zero Window Probe added.

 - don't abort connection if send failed, keep retrying.

 - general retries added for initializing and closing connection.

 - start, stop and delete added.


 - comments changed, beautified.


 - TCP options obtained incorrectly at tcp_connect() from the SYN+ACK reply.


 - Initial release.