summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6adc660)
- Adject cli_loop args for libcli 1.8.0
- Allow for backward compatabity in C_PING packets
- Don't send RADIUS stop messages from sessionshutdown when called from
sessionkill.
// vim: sw=4 ts=8
char const *cvs_name = "$Name: $";
// 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>
#include <stdio.h>
#include <stdarg.h>
memset(&debug_flags, 0, sizeof(debug_flags));
debug_flags.critical = 1;
memset(&debug_flags, 0, sizeof(debug_flags));
debug_flags.critical = 1;
- {
- char prompt[1005];
- snprintf(prompt, 1005, "l2tpns> ");
- cli_loop(cli, sockfd, prompt);
- }
close(sockfd);
log(3, 0, 0, 0, "Closed CLI connection\n");
close(sockfd);
log(3, 0, 0, 0, "Closed CLI connection\n");
// L2TPNS Clustering Stuff
// 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>
#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.
//
// 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)
+ // 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?
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;
// 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;
peers[i].peer = peer;
peers[i].basetime = basetime;
peers[i].timestamp = TIME;
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;
if (i == num_peers)
++num_peers;
switch (type) {
case C_PING: // Update the peers table.
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);
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
// 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>
#include <arpa/inet.h>
#include <assert.h>
return; // not a live session
}
return; // not a live session
}
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
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
+ session[s].die = now();
sessionshutdown(s, reason); // close radius/routes, etc.
if (session[s].radius)
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);
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) {
// 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) )
-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>
#include <stdio.h>
#include <string.h>
sessionshutdown(s, "Remote end closed connection.");
tunnelsend(b, l + (q - b), t); // send it
}
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)
{
}
else if (*p == EchoReq)
{
-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>
#include <time.h>
#include <stdio.h>
|| !session[radius[i].session].opened
|| session[radius[i].session].die
|| session[radius[i].session].tunnel == 0)
|| !session[radius[i].session].opened
|| session[radius[i].session].die
|| session[radius[i].session].tunnel == 0)
+ radiusclear(i, radius[i].session);