projects
/
l2tpns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix heartt pad
[l2tpns.git]
/
cluster.c
diff --git
a/cluster.c
b/cluster.c
index
abe2a63
..
015268a
100644
(file)
--- a/
cluster.c
+++ b/
cluster.c
@@
-1,6
+1,6
@@
// L2TPNS Clustering Stuff
// L2TPNS Clustering Stuff
-char const *cvs_id_cluster = "$Id: cluster.c,v 1.5
1 2006/04/27 09:53:49
bodea Exp $";
+char const *cvs_id_cluster = "$Id: cluster.c,v 1.5
4 2006/12/04 20:50:02
bodea Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
@@
-654,7
+654,7
@@
void cluster_check_master(void)
}
// Reset idle timeouts..
}
// 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;
// Reset die relative to our uptime rather than the old master's
if (session[i].die) session[i].die = TIME;
@@
-1214,7
+1214,9
@@
static int cluster_handle_bytes(uint8_t *data, int size)
session[b->sid].cout_delta += b->cout;
if (b->cin)
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;
size -= sizeof(*b);
++b;
@@
-1451,7
+1453,11
@@
static int cluster_process_heartbeat(uint8_t *data, int size, int more, uint8_t
return -1; // Ignore it??
}
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;
if (s < sizeof(*h))
goto shortpacket;
@@
-1768,7
+1774,7
@@
int processcluster(uint8_t *data, int size, in_addr_t addr)
case C_FORWARD_DAE: // Forwarded DAE packet. pass off to processdae.
if (!config->cluster_iam_master)
{
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;
type == C_FORWARD_DAE ? "_DAE" : "", fmtaddr(addr, 0));
return -1;