DCCP protocol discussions
 help / color / mirror / Atom feed
* Re: [PATCH 2/5]: Fix Reset/Sync-Flood Bug
@ 2007-09-22 19:55 Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-09-22 19:55 UTC (permalink / raw)
  To: dccp

Em Wed, Jun 20, 2007 at 10:55:39AM +0100, Gerrit Renker escreveu:
> [DCCP]: Fix Reset/Sync-Flood Bug
> 
> This updates sequence number checking with regard to RFC 4340, 7.5.4.
> Missing in the code was an exception for sequence-invalid Reset packets, 
> which get a Sync acknowledging GSR, instead of (as usual) P.seqno.
> 
> This can lead to an oscillating ping-pong flood of Reset packets. 
> 
> In fact, it has been observed on the wire as follows:
> 
>  1. client establishes connection to server;
>  2. before server can write to client, client crashes without notifying
>     the server (NB: now no longer possible due to ABORT function);
>  3. server sends DCCP-Data packet (has no ackno);
>  4. client generates Reset "No Connection", seqno=0, increments seqno;
>  5. server replies with Sync, using ackno = P.seqno;
>  6. client generates Reset "No Connection" with seqno = ackno + 1;
>  7. goto (5).
> 
> The difference is that now in (5) the server uses GSR.  This causes the
> Reset sent by the client in (6) to become sequence-valid, so that in (7)
> the vicious circle is broken; the Reset is then enqueued and causes the
> socket to enter TIMEWAIT state.

Well spotted! I wonder if Step 6 in the RFC pseudocode changed from what
was in the draft I used... 8)

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH 2/5]: Fix Reset/Sync-Flood Bug
@ 2007-07-01  3:55 Ian McDonald
  0 siblings, 0 replies; 4+ messages in thread
From: Ian McDonald @ 2007-07-01  3:55 UTC (permalink / raw)
  To: dccp

On 6/20/07, Gerrit Renker <gerrit@erg.abdn.ac.uk> wrote:
> [DCCP]: Fix Reset/Sync-Flood Bug
>
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>

Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
-- 
Web: http://wand.net.nz/~iam4/
Blog: http://iansblog.jandi.co.nz
WAND Network Research Group

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 2/5]: Fix Reset/Sync-Flood Bug
@ 2007-06-20  9:55 Gerrit Renker
  0 siblings, 0 replies; 4+ messages in thread
From: Gerrit Renker @ 2007-06-20  9:55 UTC (permalink / raw)
  To: dccp

[DCCP]: Fix Reset/Sync-Flood Bug

This updates sequence number checking with regard to RFC 4340, 7.5.4.
Missing in the code was an exception for sequence-invalid Reset packets, 
which get a Sync acknowledging GSR, instead of (as usual) P.seqno.

This can lead to an oscillating ping-pong flood of Reset packets. 

In fact, it has been observed on the wire as follows:

 1. client establishes connection to server;
 2. before server can write to client, client crashes without notifying
    the server (NB: now no longer possible due to ABORT function);
 3. server sends DCCP-Data packet (has no ackno);
 4. client generates Reset "No Connection", seqno=0, increments seqno;
 5. server replies with Sync, using ackno = P.seqno;
 6. client generates Reset "No Connection" with seqno = ackno + 1;
 7. goto (5).

The difference is that now in (5) the server uses GSR.  This causes the
Reset sent by the client in (6) to become sequence-valid, so that in (7)
the vicious circle is broken; the Reset is then enqueued and causes the
socket to enter TIMEWAIT state.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/input.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -102,9 +102,6 @@ static int dccp_check_seqno(struct sock 
 	 *	  Update S.GSR, S.SWL, S.SWH
 	 *	  If P.type != Sync,
 	 *	     Update S.GAR
-	 *      Otherwise,
-	 *	  Send Sync packet acknowledging P.seqno
-	 *	  Drop packet and return
 	 */
 	lswl = dp->dccps_swl;
 	lawl = dp->dccps_awl;
@@ -135,6 +132,17 @@ static int dccp_check_seqno(struct sock 
 							      : "exists",
 			  (unsigned long long) lawl, (unsigned long long) ackno,
 			  (unsigned long long) dp->dccps_awh);
+		/*
+		 *   Step 6: Check sequence numbers
+		 *      Otherwise,
+		 *         If P.type = Reset,
+		 *            Send Sync packet acknowledging S.GSR
+		 *         Otherwise,
+		 *            Send Sync packet acknowledging P.seqno
+		 *      Drop packet and return
+		 */
+		if (dh->dccph_type = DCCP_PKT_RESET)
+			seqno = dp->dccps_gsr;
 		dccp_send_sync(sk, seqno, DCCP_PKT_SYNC);
 		return -1;
 	}

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 2/5]: Fix Reset/Sync-Flood Bug
@ 2007-04-09  9:58 Gerrit Renker
  0 siblings, 0 replies; 4+ messages in thread
From: Gerrit Renker @ 2007-04-09  9:58 UTC (permalink / raw)
  To: dccp

[DCCP]: Fix Reset/Sync-Flood Bug

This updates sequence number checking with regard to RFC 4340, 7.5.4.
Missing in the code was an exception for sequence-invalid Reset packets, 
which get a Sync acknowledging GSR, instead of (as usual) P.seqno.

This can lead to an oscillating ping-pong flood of Reset packets. 

In fact, it has been observed on the wire as follows:

 1. client establishes connection to server;
 2. before server can write to client, client crashes without notifying
    the server (NB: now no longer possible due to ABORT function);
 3. server sends DCCP-Data packet (has no ackno);
 4. client generates Reset "No Connection", seqno=0, increments seqno;
 5. server replies with Sync, using ackno = P.seqno;
 6. client generates Reset "No Connection" with seqno = ackno + 1;
 7. goto (5).

The difference is that now in (5) the server uses GSR. 
This causes the Reset sent by the client in (6) to become sequence-valid, 
so that in (7) the vicious circle is broken; the Reset is then enqueued 
and causes the socket to enter TIMEWAIT state.

Thanks to Eddie Kohler for help with this bug.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/input.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -129,9 +129,6 @@ static int dccp_check_seqno(struct sock 
 	 *	  Update S.GSR, S.SWL, S.SWH
 	 *	  If P.type != Sync,
 	 *	     Update S.GAR
-	 *      Otherwise,
-	 *	  Send Sync packet acknowledging P.seqno
-	 *	  Drop packet and return
 	 */
 	lswl = dp->dccps_swl;
 	lawl = dp->dccps_awl;
@@ -162,6 +159,17 @@ static int dccp_check_seqno(struct sock 
 							      : "exists",
 			  (unsigned long long) lawl, (unsigned long long) ackno,
 			  (unsigned long long) dp->dccps_awh);
+		/*
+		 *   Step 6: Check sequence numbers
+		 *      Otherwise,
+		 *         If P.type = Reset,
+		 *            Send Sync packet acknowledging S.GSR
+		 *         Otherwise,
+		 *            Send Sync packet acknowledging P.seqno
+		 *      Drop packet and return
+		 */
+		if (dh->dccph_type = DCCP_PKT_RESET)
+			seqno = dp->dccps_gsr;
 		dccp_send_sync(sk, seqno, DCCP_PKT_SYNC);
 		return -1;
 	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-22 19:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-22 19:55 [PATCH 2/5]: Fix Reset/Sync-Flood Bug Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2007-07-01  3:55 Ian McDonald
2007-06-20  9:55 Gerrit Renker
2007-04-09  9:58 Gerrit Renker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox