// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
// vim: sw=8 ts=8
-char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.73.2.6 2005/04/01 06:37:19 bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.73.2.10 2005/05/23 13:48:29 bodea Exp $";
#include <arpa/inet.h>
#include <assert.h>
CONFIG("cluster_interface", cluster_interface, STRING),
CONFIG("cluster_hb_interval", cluster_hb_interval, INT),
CONFIG("cluster_hb_timeout", cluster_hb_timeout, INT),
+ CONFIG("cluster_master_min_adv", cluster_master_min_adv, INT),
{ NULL, 0, 0, 0 },
};
if (!(r = radiusnew(s)))
{
LOG(1, s, session[s].tunnel, "No free RADIUS sessions for Stop message\n");
- STAT(radius_overflow);
}
else
{
if (!r)
r = radiusnew(s);
+ if (!r)
+ {
+ sessionshutdown(s, "No free RADIUS sessions for IPCP");
+ return;
+ }
+
if (radius[r].state != RADIUSIPCP)
{
radius[r].state = RADIUSIPCP;
if (!q) return;
*q = ConfigReq;
- q[1] = r << RADIUS_SHIFT; // ID, dont care, we only send one type of request
+ q[1] = r >> RADIUS_SHIFT; // ID, dont care, we only send one type of request
*(uint16_t *) (q + 2) = htons(10);
q[4] = 3;
q[5] = 6;
session[s].flags &= ~SF_IPCP_ACKED; // Clear flag.
}
+static void sessionclear(sessionidt s)
+{
+ memset(&session[s], 0, sizeof(session[s]));
+ memset(&sess_local[s], 0, sizeof(sess_local[s]));
+ memset(&cli_session_actions[s], 0, sizeof(cli_session_actions[s]));
+
+ session[s].tunnel = T_FREE; // Mark it as free.
+ session[s].next = sessionfree;
+ sessionfree = s;
+}
+
// kill a session now
void sessionkill(sessionidt s, char *reason)
{
radiusclear(session[s].radius, s); // cant send clean accounting data, session is killed
LOG(2, s, session[s].tunnel, "Kill session %d (%s): %s\n", s, session[s].user, reason);
-
- memset(&session[s], 0, sizeof(session[s]));
- session[s].tunnel = T_FREE; // Mark it as free.
- session[s].next = sessionfree;
- sessionfree = s;
- cli_session_actions[s].action = 0;
+ sessionclear(s);
cluster_send_session(s);
}
if (!sessionfree)
{
STAT(session_overflow);
- LOG(1, 0, t, "No free sessions");
+ LOG(1, 0, t, "No free sessions\n");
return;
}
else
if (!(r = radiusnew(s)))
{
LOG(1, s, t, "No free RADIUS sessions for ICRQ\n");
- sessionkill(s, "no free RADIUS sesions");
+ sessionclear(s);
return;
}
config->debug = optdebug;
config->num_tbfs = MAXTBFS;
config->rl_rate = 28; // 28kbps
+ config->cluster_master_min_adv = 1;
if (!(tunnel = shared_malloc(sizeof(tunnelt) * MAXTUNNEL)))
{
if (!config->numradiusservers)
LOG(0, 0, 0, "No RADIUS servers defined!\n");
- config->num_radfds = 2 << RADIUS_SHIFT;
+ config->num_radfds = 1 << RADIUS_SHIFT;
// Update plugins
for (i = 0; i < MAXPLUGINS; i++)