summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorMichael Brown2006-12-28 00:44:05 +0100
committerMichael Brown2006-12-28 00:44:05 +0100
commitbe31970e36cb7fee49d81e8b0455cd3deac84390 (patch)
tree7c77c2128340a137e597cd51c76a86dae9977f15 /src/net
parentMerge changes from mcb-tcp-fixes branch. (diff)
downloadipxe-be31970e36cb7fee49d81e8b0455cd3deac84390.tar.gz
ipxe-be31970e36cb7fee49d81e8b0455cd3deac84390.tar.xz
ipxe-be31970e36cb7fee49d81e8b0455cd3deac84390.zip
Don't send a second FIN if we receive a FIN while in FIN_WAIT_2
Diffstat (limited to 'src/net')
-rw-r--r--src/net/tcp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c
index 9cb2cf7eb..1b5f76c07 100644
--- a/src/net/tcp.c
+++ b/src/net/tcp.c
@@ -573,13 +573,14 @@ static int tcp_rx_fin ( struct tcp_connection *conn, uint32_t seq ) {
if ( ( conn->rcv_ack - seq ) > 0 )
return 0;
- /* Mark FIN as received and send our own FIN */
- conn->tcp_state |= ( TCP_STATE_RCVD ( TCP_FIN ) |
- TCP_STATE_SENDING ( TCP_FIN ) );
-
- /* Acknowledge FIN */
+ /* Mark FIN as received and acknowledge it */
+ conn->tcp_state |= TCP_STATE_RCVD ( TCP_FIN );
conn->rcv_ack++;
+ /* If we haven't already sent our FIN, send a FIN */
+ if ( ! ( conn->tcp_state & TCP_STATE_ACKED ( TCP_FIN ) ) )
+ conn->tcp_state |= TCP_STATE_SENDING ( TCP_FIN );
+
/* Break association with application */
tcp_disassociate ( conn );