From 2112bbdb99a57704ec882ee0926a11c548501f0d Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 20 Feb 2009 20:24:00 +0100 Subject: 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 --- src/sync-mode.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/sync-mode.c') 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 @@ -35,6 +35,13 @@ #include #include +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) { @@ -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++; -- cgit v1.2.3