[conntrack-tools] sync-mode: fix broken dedicated-link change in multichannel layer

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Fri Mar 20 19:40:30 CET 2009


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=conntrack-tools.git;a=commit;h=0114456525a8a805d0a53040b7170b7c7d7f7007
commit 0114456525a8a805d0a53040b7170b7c7d7f7007
Author:     Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Fri Mar 20 19:39:38 2009 +0100
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Fri Mar 20 19:39:38 2009 +0100

    sync-mode: fix broken dedicated-link change in multichannel layer
    
    This patch fixes a problem that was introduced while adding the
    multichannel support.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
       via  0114456525a8a805d0a53040b7170b7c7d7f7007 (commit)
      from  899785226af55b1c09b2b4d57345da2e07e5f729 (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 0114456525a8a805d0a53040b7170b7c7d7f7007
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Fri Mar 20 19:39:38 2009 +0100

    sync-mode: fix broken dedicated-link change in multichannel layer
    
    This patch fixes a problem that was introduced while adding the
    multichannel support.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

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

 include/channel.h  |    1 +
 src/multichannel.c |    6 ++++++
 src/sync-mode.c    |   17 +++++------------
 3 files changed, 12 insertions(+), 12 deletions(-)
This patch fixes a problem that was introduced while adding the
multichannel support.

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

diff --git a/include/channel.h b/include/channel.h
index 42534e0..1d3c48c 100644
--- a/include/channel.h
+++ b/include/channel.h
@@ -100,5 +100,6 @@ void multichannel_stats_extended(struct multichannel *m,
 int multichannel_get_ifindex(struct multichannel *m, int i);
 int multichannel_get_current_ifindex(struct multichannel *m);
 void multichannel_set_current_channel(struct multichannel *m, int i);
+void multichannel_change_current_channel(struct multichannel *m, int i);
 
 #endif /* _CHANNEL_H_ */
diff --git a/src/multichannel.c b/src/multichannel.c
index ab0f04c..de69d5c 100644
--- a/src/multichannel.c
+++ b/src/multichannel.c
@@ -108,3 +108,9 @@ void multichannel_set_current_channel(struct multichannel *m, int i)
 {
 	m->current = m->channel[i];
 }
+
+void multichannel_change_current_channel(struct multichannel *m, int i)
+{
+	if (m->current != m->channel[i])
+		m->current = m->channel[i];
+}
diff --git a/src/sync-mode.c b/src/sync-mode.c
index 776b4ab..298fcd2 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -36,14 +36,7 @@
 #include <net/if.h>
 
 static void
-mcast_change_current_link(int if_idx)
-{
-	if (if_idx != multichannel_get_current_ifindex(STATE_SYNC(channel)))
-		multichannel_set_current_channel(STATE_SYNC(channel), if_idx);
-}
-
-static void
-do_channel_handler_step(int if_idx, struct nethdr *net, size_t remain)
+do_channel_handler_step(int i, struct nethdr *net, size_t remain)
 {
 	char __ct[nfct_maxsize()];
 	struct nf_conntrack *ct = (struct nf_conntrack *)(void*) __ct;
@@ -58,10 +51,10 @@ do_channel_handler_step(int if_idx, struct nethdr *net, size_t remain)
 
 	switch (STATE_SYNC(sync)->recv(net)) {
 	case MSG_DATA:
-		mcast_change_current_link(if_idx);
+		multichannel_change_current_channel(STATE_SYNC(channel), i);
 		break;
 	case MSG_CTL:
-		mcast_change_current_link(if_idx);
+		multichannel_change_current_channel(STATE_SYNC(channel), i);
 		return;
 	case MSG_BAD:
 		STATE_SYNC(error).msg_rcv_malformed++;
@@ -123,7 +116,7 @@ retry:
 }
 
 /* handler for messages received */
-static void channel_handler(struct channel *m, int if_idx)
+static void channel_handler(struct channel *m, int i)
 {
 	ssize_t numbytes;
 	ssize_t remain;
@@ -168,7 +161,7 @@ static void channel_handler(struct channel *m, int if_idx)
 
 		HDR_NETWORK2HOST(net);
 
-		do_channel_handler_step(if_idx, net, remain);
+		do_channel_handler_step(i, net, remain);
 		ptr += net->len;
 		remain -= net->len;
 	}



More information about the netfilter-cvslog mailing list