Add grouping session functionality for load balancing and failover
[l2tpns.git] / cluster.c
index 78de01b..4b85f67 100644 (file)
--- a/cluster.c
+++ b/cluster.c
@@ -16,6 +16,7 @@
 #include <malloc.h>
 #include <errno.h>
 #include <libcli.h>
+#include <linux/rtnetlink.h>
 
 #include "l2tpns.h"
 #include "cluster.h"
@@ -709,6 +710,7 @@ void cluster_check_master(void)
                increment_counter(&session[i].cout, &session[i].cout_wrap, sess_local[i].cout);
                session[i].cin_delta += sess_local[i].cin;
                session[i].cout_delta += sess_local[i].cout;
+               session[i].coutgrp_delta += sess_local[i].cout;
 
                session[i].pin += sess_local[i].pin;
                session[i].pout += sess_local[i].pout;
@@ -1263,6 +1265,7 @@ static int cluster_handle_bytes(uint8_t *data, int size)
 
                session[b->sid].cin_delta += b->cin;
                session[b->sid].cout_delta += b->cout;
+               session[b->sid].coutgrp_delta += b->cout;
 
                if (b->cin)
                        session[b->sid].last_packet = session[b->sid].last_data = time_now;