patch-1.3.54 linux/net/ipv4/tcp.c

Next file: linux/net/ipx/af_ipx.c
Previous file: linux/net/ipv4/ip_output.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.53/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c
@@ -180,7 +180,9 @@
  *		Alan Cox	:	Small hooks for enSKIP.
  *		Alexey Kuznetsov:	Path MTU discovery.
  *		Alan Cox	:	Support soft errors.
- *
+ *		Alan Cox	:	Fix MTU discovery pathalogical case
+ *					when the remote claims no mtu!
+ *		Marc Tamsky	:	TCP_CLOSE fix.
  *
  * To Fix:
  *		Fast path the code. Two things here - fix the window calculation
@@ -766,6 +768,7 @@
 		 */
 		 
 		ct++;
+		sk->retransmits++;
 		sk->prot->retransmits ++;
 		tcp_statistics.TcpRetransSegs++;
 		
@@ -950,8 +953,15 @@
 	struct sock *sk = (struct sock*)data;
 	int why = sk->ip_xmit_timeout;
 
+	/*
+	 *	We are reset. We will send no more retransmits.
+	 */
+	 
+	if(sk->zapped)
+		return;
+		
 	/* 
-	 * only process if socket is not in use
+	 *	Only process if socket is not in use
 	 */
 
 	cli();
@@ -969,7 +979,7 @@
 
 	/* Always see if we need to send an ack. */
 
-	if (sk->ack_backlog && !sk->zapped) 
+	if (sk->ack_backlog) 
 	{
 		sk->prot->read_wakeup (sk);
 		if (! sk->dead)
@@ -1105,7 +1115,8 @@
 			if (rt->rt_mtu > new_mtu)
 				rt->rt_mtu = new_mtu;
 
-		if (sk->mtu > new_mtu - sizeof(struct iphdr) - sizeof(struct tcphdr))
+		if (sk->mtu > new_mtu - sizeof(struct iphdr) - sizeof(struct tcphdr)
+			&& new_mtu > sizeof(struct iphdr)+sizeof(struct tcphdr))
 			sk->mtu = new_mtu - sizeof(struct iphdr) - sizeof(struct tcphdr);
 
 		return;
@@ -3877,8 +3888,9 @@
 		if (sk->rcv_ack_seq == sk->write_seq /*&& sk->acked_seq == sk->fin_seq*/) 
 		{
 			flag |= 1;
-			tcp_set_state(sk,TCP_CLOSE);
 			sk->shutdown = SHUTDOWN_MASK;
+			tcp_set_state(sk,TCP_CLOSE);
+			return 1;
 		}
 	}
 
@@ -4163,9 +4175,10 @@
 					tcp_reset(sk->saddr, sk->daddr, skb->h.th,
 						sk->prot, NULL, skb->dev, sk->ip_tos, sk->ip_ttl);
 					tcp_statistics.TcpEstabResets++;
-					tcp_set_state(sk,TCP_CLOSE);
 					sk->err = EPIPE;
+					sk->error_report(sk);
 					sk->shutdown = SHUTDOWN_MASK;
+					tcp_set_state(sk,TCP_CLOSE);
 					kfree_skb(skb, FREE_READ);
 					return 0;
 				}
@@ -5425,9 +5438,9 @@
 
 	sk->backoff++;
 	sk->rto = min(sk->rto << 1, 120*HZ);
-	reset_xmit_timer (sk, TIME_PROBE0, sk->rto);
 	sk->retransmits++;
 	sk->prot->retransmits ++;
+	reset_xmit_timer (sk, TIME_PROBE0, sk->rto);
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this