freebsd-dev/sys/netinet/libalias
Hans Petter Selasky 9febbc4541 Fix for natd(8) sending wrong sequence number after TCP retransmission,
terminating a TCP connection.

If a TCP packet must be retransmitted and the data length has changed in the
retransmitted packet, due to the internal workings of TCP, typically when ACK
packets are lost, then there is a 30% chance that the logic in GetDeltaSeqOut()
will find the correct length, which is the last length received.

This can be explained as follows:

If a "227 Entering Passive Mode" packet must be retransmittet and the length
changes from 51 to 50 bytes, for example, then we have three cases for the
list scan in GetDeltaSeqOut(), depending on how many prior packets were
received modulus N_LINK_TCP_DATA=3:

  case 1:  index 0:   original packet        51
           index 1:   retransmitted packet   50
           index 2:   not relevant

  case 2:  index 0:   not relevant
           index 1:   original packet        51
           index 2:   retransmitted packet   50

  case 3:  index 0:   retransmitted packet   50
           index 1:   not relevant
           index 2:   original packet        51

This patch simply changes the searching order for TCP packets, always starting
at the last received packet instead of any received packet, in
GetDeltaAckIn() and GetDeltaSeqOut().

Else no functional changes.

Discussed with:	rscheff@
Submitted by:	Andreas Longwitz <longwitz@incore.de>
PR:		230755
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-02-22 17:13:58 +01:00
..
alias_db.c Fix for natd(8) sending wrong sequence number after TCP retransmission, 2021-02-22 17:13:58 +01:00
alias_dummy.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_ftp.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_irc.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_local.h Allow setting alias port ranges in libalias and ipfw. This will allow a system 2021-02-02 13:24:17 -08:00
alias_mod.c libalias: Fix remaining compiler warnings 2021-01-19 21:23:24 +00:00
alias_mod.h
alias_nbt.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_pptp.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_proxy.c libalias: Fix -Wcast-align compiler warnings 2021-01-19 21:23:24 +00:00
alias_sctp.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_sctp.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_skinny.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_smedia.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias_util.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
alias.c libalias: Fix remaining compiler warnings 2021-01-19 21:23:24 +00:00
alias.h Allow setting alias port ranges in libalias and ipfw. This will allow a system 2021-02-02 13:24:17 -08:00
HISTORY
libalias.3 libalias: Fix -Wcast-align compiler warnings 2021-01-19 21:23:24 +00:00