[tyndur-devel] [PATCH] tcpip: Kein FIN ohne ACK
Kevin Wolf ·
! tcpip: Wenn ein FIN-Paket gesendet wird, das nicht gleichzeitig auch ACK gesetzt hat, wird das FIN ignoriert. Signed-off-by: Kevin Wolf <kevin at tyndur.org> --- src/modules/tcpip/tcp.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/tcpip/tcp.c b/src/modules/tcpip/tcp.c index 92378dc..0cc2aec 100644 --- a/src/modules/tcpip/tcp.c +++ b/src/modules/tcpip/tcp.c @@ -176,9 +176,10 @@ static void tcp_send_reset(struct tcp_connection* conn) tcp_send_packet(conn, NULL, 0, TCPF_RST); } -static void tcp_send_fin(struct tcp_connection* conn, bool ack) +static void tcp_send_fin(struct tcp_connection* conn) { - tcp_send_packet(conn, NULL, 0, TCPF_FIN | (ack ? TCPF_ACK : 0)); + // Ein FIN ist nur gueltig, wenn auch ein ACK gesendet wird + tcp_send_packet(conn, NULL, 0, TCPF_FIN | TCPF_ACK); conn->seq++; } @@ -278,7 +279,7 @@ void tcp_close_connection(struct tcp_connection* conn) } else { DEBUG_MSG("tcp_send_fin_ack"); conn->status = TCPS_WAIT_FOR_FIN_ACK; - tcp_send_fin(conn, FALSE); + tcp_send_fin(conn); } timeout = get_tick_count() + 9 * 1000000; @@ -531,7 +532,7 @@ void tcp_receive(dword source_ip, void* data, dword data_size) conn->status = TCPS_WAIT_FOR_LAST_ACK; conn->ack++; DEBUG_MSG("Sende FIN ACK."); - tcp_send_fin(conn, TRUE); + tcp_send_fin(conn); } -- 1.6.0.2
Antworten
- [tyndur-devel] [PATCH] tcpip: Kein FIN ohne ACK · Max Reitz