throttle outgoing LASTSEEN packets to at most one per second for a given seq#
-* Sat Dec 18 2004 Brendan O'Dea <bod@optusnet.com.au> 2.1.0
+* Mon Dec 20 2004 Brendan O'Dea <bod@optusnet.com.au> 2.1.0
- Add IPv6 support from Jonathan McDowell (work in progress).
- Add IPv6 support from Jonathan McDowell (work in progress).
+- Sanity check that cluster_send_session is not called from a child
+ process.
+- Throttle outgoing LASTSEEN packets to at most one per second for a
+ given seq#.
* Fri Dec 17 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.13
- Better cluster master collision resolution: keep a counter of state
* Fri Dec 17 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.13
- Better cluster master collision resolution: keep a counter of state
// L2TPNS Clustering Stuff
// L2TPNS Clustering Stuff
-char const *cvs_id_cluster = "$Id: cluster.c,v 1.26 2004/12/16 23:40:31 bodea Exp $";
+char const *cvs_id_cluster = "$Id: cluster.c,v 1.27 2004/12/20 07:23:42 bodea Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
-int cluster_sockfd = 0; // The filedescriptor for the cluster communications port.
+int cluster_sockfd = 0; // The filedescriptor for the cluster communications port.
in_addr_t my_address = 0; // The network address of my ethernet port.
static int walk_session_number = 0; // The next session to send when doing the slow table walk.
static int walk_tunnel_number = 0; // The next tunnel to send when doing the slow table walk.
in_addr_t my_address = 0; // The network address of my ethernet port.
static int walk_session_number = 0; // The next session to send when doing the slow table walk.
static int walk_tunnel_number = 0; // The next tunnel to send when doing the slow table walk.
+int forked = 0; // Sanity check: CLI must not diddle with heartbeat table
#define MAX_HEART_SIZE (8192) // Maximum size of heartbeat packet. Must be less than max IP packet size :)
#define MAX_CHANGES (MAX_HEART_SIZE/(sizeof(sessiont) + sizeof(int) ) - 2) // Assumes a session is the biggest type!
#define MAX_HEART_SIZE (8192) // Maximum size of heartbeat packet. Must be less than max IP packet size :)
#define MAX_CHANGES (MAX_HEART_SIZE/(sizeof(sessiont) + sizeof(int) ) - 2) // Assumes a session is the biggest type!
+ if (forked) {
+ LOG(0, sid, 0, "cluster_send_session called from child process!"\n");
+ return -1;
+ }
+
return type_changed(C_CSESSION, sid);
}
return type_changed(C_CSESSION, sid);
}
config->cluster_last_hb = TIME; // Reset to ensure that we don't become master!!
if (config->cluster_seq_number != h->seq) { // Out of sequence heartbeat!
config->cluster_last_hb = TIME; // Reset to ensure that we don't become master!!
if (config->cluster_seq_number != h->seq) { // Out of sequence heartbeat!
- LOG(1, 0, 0, "HB: Got seq# %d but was expecting %d. asking for resend.\n", h->seq, config->cluster_seq_number);
+ static int lastseen_seq = 0;
+ static time_t lastseen_time = 0;
+
+ // limit to once per second for a particular seq#
+ int ask = (config->cluster_seq_number != lastseen_seq || time_now != lastseen_time);
- peer_send_message(addr, C_LASTSEEN, config->cluster_seq_number, NULL, 0);
+ LOG(1, 0, 0, "HB: Got seq# %d but was expecting %d. %s.\n",
+ h->seq, config->cluster_seq_number,
+ ask ? "Asking for resend" : "Ignoring");
+
+ if (ask)
+ {
+ lastseen_seq = config->cluster_seq_number;
+ lastseen_time = time_now;
+ peer_send_message(addr, C_LASTSEEN, config->cluster_seq_number, NULL, 0);
+ }
config->cluster_last_hb = TIME; // Reset to ensure that we don't become master!!
config->cluster_last_hb = TIME; // Reset to ensure that we don't become master!!
%attr(644,root,root) /usr/share/man/man[58]/*
%changelog
%attr(644,root,root) /usr/share/man/man[58]/*
%changelog
-* Sat Dec 18 2004 Brendan O'Dea <bod@optusnet.com.au> 2.1.0-1
+* Mon Dec 20 2004 Brendan O'Dea <bod@optusnet.com.au> 2.1.0-1
- 2.1.0 release, see /usr/share/doc/l2tpns-2.1.0/Changes
- 2.1.0 release, see /usr/share/doc/l2tpns-2.1.0/Changes
/* Misc util functions */
/* Misc util functions */
-char const *cvs_id_util = "$Id: util.c,v 1.8 2004/12/16 08:49:53 bodea Exp $";
+char const *cvs_id_util = "$Id: util.c,v 1.9 2004/12/20 07:23:53 bodea Exp $";
#include <unistd.h>
#include <errno.h>
#include <unistd.h>
#include <errno.h>
extern int udpfd, controlfd, tunfd, snoopfd, ifrfd, cluster_sockfd;
extern int *radfds;
extern int udpfd, controlfd, tunfd, snoopfd, ifrfd, cluster_sockfd;
extern int *radfds;
if (config->scheduler_fifo)
{
struct sched_param params = {0};
if (config->scheduler_fifo)
{
struct sched_param params = {0};