// vim: sw=4 ts=8
char const *cvs_name = "$Name: $";
-char const *cvs_id_cli = "$Id: cli.c,v 1.9 2004/07/08 16:54:35 bodea Exp $";
+char const *cvs_id_cli = "$Id: cli.c,v 1.10 2004/07/11 07:57:33 bodea Exp $";
#include <stdio.h>
#include <stdarg.h>
memset(&debug_flags, 0, sizeof(debug_flags));
debug_flags.critical = 1;
- {
- char prompt[1005];
- snprintf(prompt, 1005, "l2tpns> ");
- cli_loop(cli, sockfd, prompt);
- }
+ cli_loop(cli, sockfd);
close(sockfd);
log(3, 0, 0, 0, "Closed CLI connection\n");
// L2TPNS Clustering Stuff
-char const *cvs_id_cluster = "$Id: cluster.c,v 1.8 2004/07/08 16:54:35 bodea Exp $";
+char const *cvs_id_cluster = "$Id: cluster.c,v 1.9 2004/07/11 07:57:35 bodea Exp $";
#include <stdio.h>
#include <sys/file.h>
// We've heard from another peer! Add it to the list
// that we select from at election time.
//
-int cluster_add_peer(u32 peer, time_t basetime, pingt *p)
+int cluster_add_peer(u32 peer, time_t basetime, pingt *pp, int size)
{
int i;
u32 clusterid;
+ pingt p;
+
- clusterid = p->addr;
+ // Allow for backward compatability.
+ // Just the ping packet into a new structure to allow
+ // for the possibility that we might have received
+ // more or fewer elements than we were expecting.
+ if (size > sizeof(p))
+ size = sizeof(p);
+
+ memset( (void*) &p, 0, sizeof(p) );
+ memcpy( (void*) &p, (void*) pp, size);
+
+
+ clusterid = p.addr;
if (clusterid != config->bind_address)
{
// Is this for us?
// This peer already exists. Just update the timestamp.
peers[i].basetime = basetime;
peers[i].timestamp = TIME;
- peers[i].uptodate = !p->undef;
+ peers[i].uptodate = !p.undef;
break;
}
peers[i].peer = peer;
peers[i].basetime = basetime;
peers[i].timestamp = TIME;
- peers[i].uptodate = !p->undef;
+ peers[i].uptodate = !p.undef;
if (i == num_peers)
++num_peers;
switch (type) {
case C_PING: // Update the peers table.
- return cluster_add_peer(addr, more, (pingt*)p);
+ return cluster_add_peer(addr, more, (pingt*)p, s);
case C_LASTSEEN: // Catch up a slave (slave missed a packet).
return cluster_catchup_slave(more, addr);
// 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.12 2004/07/08 16:54:35 bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.13 2004/07/11 07:57:35 bodea Exp $";
#include <arpa/inet.h>
#include <assert.h>
return; // not a live session
}
- if (!session[s].die)
+ if (!dead)
log(2, 0, s, session[s].tunnel, "Shutting down session %d: %s\n", s, reason);
session[s].die = now() + 150; // Clean up in 15 seconds
CSTAT(call_sessionkill);
+ session[s].die = now();
sessionshutdown(s, reason); // close radius/routes, etc.
if (session[s].radius)
- radiusclear(session[s].radius, 0); // cant send clean accounting data, session is killed
+ radiusclear(session[s].radius, s); // cant send clean accounting data, session is killed
log(2, 0, s, session[s].tunnel, "Kill session %d (%s): %s\n", s, session[s].user, reason);
// Is this a duplicate of the first packet? (SCCRQ)
//
for ( i = 1; i <= config->cluster_highest_tunnelid ; ++i) {
- if (tunnel[t].state != TUNNELOPENING ||
- tunnel[t].ip != ntohl(*(ipt *) & addr->sin_addr) ||
- tunnel[t].port != ntohs(addr->sin_port) )
+ if (tunnel[i].state != TUNNELOPENING ||
+ tunnel[i].ip != ntohl(*(ipt *) & addr->sin_addr) ||
+ tunnel[i].port != ntohs(addr->sin_port) )
continue;
t = i;
break;
// L2TPNS PPP Stuff
-char const *cvs_id_ppp = "$Id: ppp.c,v 1.7 2004/07/08 16:54:35 bodea Exp $";
+char const *cvs_id_ppp = "$Id: ppp.c,v 1.8 2004/07/11 07:57:35 bodea Exp $";
#include <stdio.h>
#include <string.h>
sessionshutdown(s, "Remote end closed connection.");
tunnelsend(b, l + (q - b), t); // send it
}
- else if (*p == TerminateReq)
+ else if (*p == TerminateAck)
{
- sessionshutdown(s, "Remote end closed connection.");
+ sessionshutdown(s, "Connection closed.");
}
else if (*p == EchoReq)
{
// L2TPNS Radius Stuff
-char const *cvs_id_radius = "$Id: radius.c,v 1.7 2004/07/07 09:09:53 bodea Exp $";
+char const *cvs_id_radius = "$Id: radius.c,v 1.8 2004/07/11 07:57:35 bodea Exp $";
#include <time.h>
#include <stdio.h>
|| !session[radius[i].session].opened
|| session[radius[i].session].die
|| session[radius[i].session].tunnel == 0)
- radiusclear(i, 0);
+ radiusclear(i, radius[i].session);
}
}