// L2TPNS Clustering Stuff
-char const *cvs_id_cluster = "$Id: cluster.c,v 1.51 2006/04/27 09:53:49 bodea Exp $";
+char const *cvs_id_cluster = "$Id: cluster.c,v 1.55 2009/12/08 14:49:28 bodea Exp $";
#include <stdio.h>
#include <stdlib.h>
x.ver = 1;
x.addr = config->bind_address;
- x.undef = config->cluster_undefined_sessions + config->cluster_undefined_tunnels;
+ x.undef = config->cluster_undefined_sessions + config->cluster_undefined_tunnels + config->cluster_undefined_bundles;
x.basetime = basetime;
add_type(&p, C_PING, basetime, (uint8_t *) &x, sizeof(x));
}
// Reset idle timeouts..
- session[i].last_packet = time_now;
+ session[i].last_packet = session[i].last_data = time_now;
// Reset die relative to our uptime rather than the old master's
if (session[i].die) session[i].die = TIME;
if (bcount >= config->cluster_highest_bundleid)
break;
- hb_add_type(&p, C_CTUNNEL, walk_bundle_number);
- walk_tunnel_number = (1+walk_bundle_number)%(config->cluster_highest_bundleid+1); // +1 avoids divide by zero.
-
+ hb_add_type(&p, C_CBUNDLE, walk_bundle_number);
+ walk_bundle_number = (1+walk_bundle_number)%(config->cluster_highest_bundleid+1); // +1 avoids divide by zero.
++bcount;
}
session[b->sid].cout_delta += b->cout;
if (b->cin)
- session[b->sid].last_packet = time_now; // Reset idle timer!
+ session[b->sid].last_packet = session[b->sid].last_data = time_now;
+ else if (b->cout)
+ session[b->sid].last_data = time_now;
size -= sizeof(*b);
++b;
return -1; // Ignore it??
}
- // Ok. It's a heartbeat packet from a cluster master!
+ if (size > sizeof(past_hearts[0].data)) {
+ LOG(0, 0, 0, "Received an oversize heartbeat from %s (%d)!\n", fmtaddr(addr, 0), size);
+ return -1;
+ }
+
if (s < sizeof(*h))
goto shortpacket;
case C_FORWARD_DAE: // Forwarded DAE packet. pass off to processdae.
if (!config->cluster_iam_master)
{
- LOG(0, 0, 0, "I'm not the master, but I got a C_FORWARD_%s from %s?\n",
+ LOG(0, 0, 0, "I'm not the master, but I got a C_FORWARD%s from %s?\n",
type == C_FORWARD_DAE ? "_DAE" : "", fmtaddr(addr, 0));
return -1;