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#
This commit is contained in:
parent
54443c26c4
commit
8454a49d0c
4 changed files with 32 additions and 7 deletions
6
Changes
6
Changes
|
|
@ -1,5 +1,9 @@
|
||||||
* 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
|
* Fri Dec 17 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.13
|
||||||
- Better cluster master collision resolution: keep a counter of state
|
- Better cluster master collision resolution: keep a counter of state
|
||||||
|
|
|
||||||
23
cluster.c
23
cluster.c
|
|
@ -1,6 +1,6 @@
|
||||||
// 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 <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -43,6 +43,7 @@ int cluster_sockfd = 0; // The filedescriptor for the cluster communications po
|
||||||
in_addr_t my_address = 0; // The network address of my ethernet 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_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.
|
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_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_CHANGES (MAX_HEART_SIZE/(sizeof(sessiont) + sizeof(int) ) - 2) // Assumes a session is the biggest type!
|
||||||
|
|
@ -866,6 +867,11 @@ int cluster_send_session(int sid)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1177,9 +1183,22 @@ static int cluster_process_heartbeat(uint8_t *data, int size, int more, uint8_t
|
||||||
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!!
|
||||||
|
|
||||||
if (config->cluster_seq_number != h->seq) { // Out of sequence heartbeat!
|
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);
|
||||||
|
|
||||||
|
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);
|
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!!
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,5 +43,5 @@ rm -rf %{buildroot}
|
||||||
%attr(644,root,root) /usr/share/man/man[58]/*
|
%attr(644,root,root) /usr/share/man/man[58]/*
|
||||||
|
|
||||||
%changelog
|
%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
|
||||||
|
|
|
||||||
4
util.c
4
util.c
|
|
@ -1,6 +1,6 @@
|
||||||
/* 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 <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
@ -39,6 +39,7 @@ void *shared_malloc(unsigned int size)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int forked;
|
||||||
extern int udpfd, controlfd, tunfd, snoopfd, ifrfd, cluster_sockfd;
|
extern int udpfd, controlfd, tunfd, snoopfd, ifrfd, cluster_sockfd;
|
||||||
extern int *radfds;
|
extern int *radfds;
|
||||||
|
|
||||||
|
|
@ -50,6 +51,7 @@ pid_t fork_and_close()
|
||||||
if (pid)
|
if (pid)
|
||||||
return pid;
|
return pid;
|
||||||
|
|
||||||
|
forked++;
|
||||||
if (config->scheduler_fifo)
|
if (config->scheduler_fifo)
|
||||||
{
|
{
|
||||||
struct sched_param params = {0};
|
struct sched_param params = {0};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue