[conntrack-tools] ftfw: reset window and flush the resend queue during helloing

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Thu Sep 25 17:15:27 CEST 2008


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=conntrack-tools.git;a=commit;h=99a80b3fe6af95ca711c2d37737408c3703a6184
commit 99a80b3fe6af95ca711c2d37737408c3703a6184
Author:     Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Thu Sep 25 17:10:42 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Sep 25 17:10:42 2008 +0200

    ftfw: reset window and flush the resend queue during helloing
    
    This fixes two bugs when a hello message is received:
    
    * We can create malformed nack messages during the helloing.
    We have to reset the acknowlegdment window, otherwise we may
    create malformed nack messages.
    * We have to empty the resend list/queue when a hello message is
    received, otherwise the entries get stuck to the resend queue
    once the sequence number wraps around.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 30216bf35c8cfe078ede4c4ad7f43544b469b7d3
Author:     Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Thu Sep 25 17:06:12 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Sep 25 17:06:12 2008 +0200

    ftfw: fix race condition in the helloing routine
    
    This patch fixes a race condition that can prevent one node from sending
    the initial hello message required to reset the sequence tracking.
    
                   node A                   node B
                      |                        |
            start     |                        |
            hello msg |----------------------->|
            stop      |                        |
            start     |                        |
                      |<-----------------------| hello-back msg
    
    In the picture above, the node A never sends the hello messages. Thus,
    the node B drops the next messages as they are in the before boundary.
    This patch adds a new state to the the helloing state-machine to fix
    this problem.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 3863f882469117afd6a2ad7ce25711b619f43b27
Author:     Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Thu Sep 25 17:05:50 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Sep 25 17:05:50 2008 +0200

    ftfw: fix race that triggers a double insertion into tx_list
    
    This patch fixes a race condition that can trigger a double
    insertion to the tx_list. This happens if we receive two resync
    request very close or resync just after a nack or vice-versa.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
       via  99a80b3fe6af95ca711c2d37737408c3703a6184 (commit)
       via  30216bf35c8cfe078ede4c4ad7f43544b469b7d3 (commit)
       via  3863f882469117afd6a2ad7ce25711b619f43b27 (commit)
      from  666ceb1e2cd71f844f5794a556c46b114764bca6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 99a80b3fe6af95ca711c2d37737408c3703a6184
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Thu Sep 25 17:10:42 2008 +0200

    ftfw: reset window and flush the resend queue during helloing
    
    This fixes two bugs when a hello message is received:
    
    * We can create malformed nack messages during the helloing.
    We have to reset the acknowlegdment window, otherwise we may
    create malformed nack messages.
    * We have to empty the resend list/queue when a hello message is
    received, otherwise the entries get stuck to the resend queue
    once the sequence number wraps around.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 30216bf35c8cfe078ede4c4ad7f43544b469b7d3
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Thu Sep 25 17:06:12 2008 +0200

    ftfw: fix race condition in the helloing routine
    
    This patch fixes a race condition that can prevent one node from sending
    the initial hello message required to reset the sequence tracking.
    
                   node A                   node B
                      |                        |
            start     |                        |
            hello msg |----------------------->|
            stop      |                        |
            start     |                        |
                      |<-----------------------| hello-back msg
    
    In the picture above, the node A never sends the hello messages. Thus,
    the node B drops the next messages as they are in the before boundary.
    This patch adds a new state to the the helloing state-machine to fix
    this problem.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

commit 3863f882469117afd6a2ad7ce25711b619f43b27
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Thu Sep 25 17:05:50 2008 +0200

    ftfw: fix race that triggers a double insertion into tx_list
    
    This patch fixes a race condition that can trigger a double
    insertion to the tx_list. This happens if we receive two resync
    request very close or resync just after a nack or vice-versa.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

-----------------------------------------------------------------------

 include/network.h |    6 ----
 src/sync-ftfw.c   |   77 +++++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 60 insertions(+), 23 deletions(-)
This patch fixes a race condition that can trigger a double
insertion to the tx_list. This happens if we receive two resync
request very close or resync just after a nack or vice-versa.

Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c
index 4c1b536..8dd5554 100644
--- a/src/sync-ftfw.c
+++ b/src/sync-ftfw.c
@@ -196,6 +196,10 @@ static int do_cache_to_tx(void *data1, void *data2)
 	struct us_conntrack *u = data2;
 	struct cache_ftfw *cn = cache_get_extra(STATE_SYNC(internal), u);
 
+	/* repeated request for resync? */
+	if (!list_empty(&cn->tx_list))
+		return 0;
+
 	/* add to tx list */
 	list_add_tail(&cn->tx_list, &tx_list);
 	tx_list_len++;
@@ -264,8 +268,11 @@ static void rs_list_to_tx(struct cache *c, unsigned int from, unsigned int to)
 			dp("resending nack'ed (oldseq=%u)\n", cn->seq);
 			list_del_init(&cn->rs_list);
 			rs_list_len--;
-			list_add_tail(&cn->tx_list, &tx_list);
-			tx_list_len++;
+			/* we received a request for resync before this nack? */
+			if (list_empty(&cn->tx_list)) {
+				list_add_tail(&cn->tx_list, &tx_list);
+				tx_list_len++;
+			}
 			write_evfd(STATE_SYNC(evfd));
 		}
 	} 



More information about the netfilter-cvslog mailing list