summaryrefslogtreecommitdiff
path: root/src/sync-mode.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-02-20 20:24:00 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-02-20 20:24:00 +0100
commit2112bbdb99a57704ec882ee0926a11c548501f0d (patch)
tree2388f8b69f50d7bee282ae1dd811f58d7c43a701 /src/sync-mode.c
parent1c8002a2de8cfc2ff9d624099d5154bcd77e2f37 (diff)
downloadconntrack-tools-2112bbdb99a57704ec882ee0926a11c548501f0d.tar.gz
conntrack-tools-2112bbdb99a57704ec882ee0926a11c548501f0d.zip
sync-mode: change current link if message is correct
This patch makes conntrackd change the current dedicated link if the message is correct, ie. neither malformed nor out-of-sync. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/sync-mode.c')
-rw-r--r--src/sync-mode.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/sync-mode.c b/src/sync-mode.c
index 866b313..02a5a46 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -36,6 +36,13 @@
#include <net/if.h>
static void
+mcast_change_current_link(int if_idx)
+{
+ if (if_idx != mcast_get_current_ifidx(STATE_SYNC(mcast_client)))
+ mcast_set_current_link(STATE_SYNC(mcast_client), if_idx);
+}
+
+static void
do_mcast_handler_step(int if_idx, struct nethdr *net, size_t remain)
{
char __ct[nfct_maxsize()];
@@ -49,14 +56,14 @@ do_mcast_handler_step(int if_idx, struct nethdr *net, size_t remain)
return;
}
- if (if_idx != mcast_get_current_ifidx(STATE_SYNC(mcast_client)))
- mcast_set_current_link(STATE_SYNC(mcast_client), if_idx);
-
switch (STATE_SYNC(sync)->recv(net)) {
case MSG_DATA:
+ mcast_change_current_link(if_idx);
break;
case MSG_DROP:
+ return;
case MSG_CTL:
+ mcast_change_current_link(if_idx);
return;
case MSG_BAD:
STATE_SYNC(error).msg_rcv_malformed++;