- TerminateAck fix from Yuri
- 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.
This commit is contained in:
parent
570d0d5385
commit
3ef237977d
5 changed files with 33 additions and 23 deletions
8
cli.c
8
cli.c
|
|
@ -2,7 +2,7 @@
|
||||||
// vim: sw=4 ts=8
|
// vim: sw=4 ts=8
|
||||||
|
|
||||||
char const *cvs_name = "$Name: $";
|
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 <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
@ -314,11 +314,7 @@ void cli_do(int sockfd)
|
||||||
memset(&debug_flags, 0, sizeof(debug_flags));
|
memset(&debug_flags, 0, sizeof(debug_flags));
|
||||||
debug_flags.critical = 1;
|
debug_flags.critical = 1;
|
||||||
|
|
||||||
{
|
cli_loop(cli, sockfd);
|
||||||
char prompt[1005];
|
|
||||||
snprintf(prompt, 1005, "l2tpns> ");
|
|
||||||
cli_loop(cli, sockfd, prompt);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
log(3, 0, 0, 0, "Closed CLI connection\n");
|
log(3, 0, 0, 0, "Closed CLI connection\n");
|
||||||
|
|
|
||||||
25
cluster.c
25
cluster.c
|
|
@ -1,6 +1,6 @@
|
||||||
// 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 <stdio.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
@ -911,12 +911,25 @@ int cluster_catchup_slave(int seq, u32 slave)
|
||||||
// We've heard from another peer! Add it to the list
|
// We've heard from another peer! Add it to the list
|
||||||
// that we select from at election time.
|
// 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;
|
int i;
|
||||||
u32 clusterid;
|
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)
|
if (clusterid != config->bind_address)
|
||||||
{
|
{
|
||||||
// Is this for us?
|
// Is this for us?
|
||||||
|
|
@ -932,7 +945,7 @@ int cluster_add_peer(u32 peer, time_t basetime, pingt *p)
|
||||||
// This peer already exists. Just update the timestamp.
|
// This peer already exists. Just update the timestamp.
|
||||||
peers[i].basetime = basetime;
|
peers[i].basetime = basetime;
|
||||||
peers[i].timestamp = TIME;
|
peers[i].timestamp = TIME;
|
||||||
peers[i].uptodate = !p->undef;
|
peers[i].uptodate = !p.undef;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -969,7 +982,7 @@ int cluster_add_peer(u32 peer, time_t basetime, pingt *p)
|
||||||
peers[i].peer = peer;
|
peers[i].peer = peer;
|
||||||
peers[i].basetime = basetime;
|
peers[i].basetime = basetime;
|
||||||
peers[i].timestamp = TIME;
|
peers[i].timestamp = TIME;
|
||||||
peers[i].uptodate = !p->undef;
|
peers[i].uptodate = !p.undef;
|
||||||
if (i == num_peers)
|
if (i == num_peers)
|
||||||
++num_peers;
|
++num_peers;
|
||||||
|
|
||||||
|
|
@ -1297,7 +1310,7 @@ int processcluster(char * data, int size, u32 addr)
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case C_PING: // Update the peers table.
|
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).
|
case C_LASTSEEN: // Catch up a slave (slave missed a packet).
|
||||||
return cluster_catchup_slave(more, addr);
|
return cluster_catchup_slave(more, addr);
|
||||||
|
|
|
||||||
13
l2tpns.c
13
l2tpns.c
|
|
@ -4,7 +4,7 @@
|
||||||
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
|
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
|
||||||
// vim: sw=8 ts=8
|
// 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 <arpa/inet.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
@ -1015,7 +1015,7 @@ void sessionshutdown(sessionidt s, char *reason)
|
||||||
return; // not a live session
|
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);
|
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() + 150; // Clean up in 15 seconds
|
||||||
|
|
@ -1122,9 +1122,10 @@ void sessionkill(sessionidt s, char *reason)
|
||||||
|
|
||||||
CSTAT(call_sessionkill);
|
CSTAT(call_sessionkill);
|
||||||
|
|
||||||
|
session[s].die = now();
|
||||||
sessionshutdown(s, reason); // close radius/routes, etc.
|
sessionshutdown(s, reason); // close radius/routes, etc.
|
||||||
if (session[s].radius)
|
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);
|
||||||
|
|
||||||
|
|
@ -1304,9 +1305,9 @@ void processudp(u8 * buf, int len, struct sockaddr_in *addr)
|
||||||
// Is this a duplicate of the first packet? (SCCRQ)
|
// Is this a duplicate of the first packet? (SCCRQ)
|
||||||
//
|
//
|
||||||
for ( i = 1; i <= config->cluster_highest_tunnelid ; ++i) {
|
for ( i = 1; i <= config->cluster_highest_tunnelid ; ++i) {
|
||||||
if (tunnel[t].state != TUNNELOPENING ||
|
if (tunnel[i].state != TUNNELOPENING ||
|
||||||
tunnel[t].ip != ntohl(*(ipt *) & addr->sin_addr) ||
|
tunnel[i].ip != ntohl(*(ipt *) & addr->sin_addr) ||
|
||||||
tunnel[t].port != ntohs(addr->sin_port) )
|
tunnel[i].port != ntohs(addr->sin_port) )
|
||||||
continue;
|
continue;
|
||||||
t = i;
|
t = i;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
6
ppp.c
6
ppp.c
|
|
@ -1,6 +1,6 @@
|
||||||
// L2TPNS PPP Stuff
|
// 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 <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -420,9 +420,9 @@ void processlcp(tunnelidt t, sessionidt s, u8 * p, u16 l)
|
||||||
sessionshutdown(s, "Remote end closed connection.");
|
sessionshutdown(s, "Remote end closed connection.");
|
||||||
tunnelsend(b, l + (q - b), t); // send it
|
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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
4
radius.c
4
radius.c
|
|
@ -1,6 +1,6 @@
|
||||||
// L2TPNS Radius Stuff
|
// 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 <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -664,6 +664,6 @@ void radius_clean()
|
||||||
|| !session[radius[i].session].opened
|
|| !session[radius[i].session].opened
|
||||||
|| session[radius[i].session].die
|
|| session[radius[i].session].die
|
||||||
|| session[radius[i].session].tunnel == 0)
|
|| session[radius[i].session].tunnel == 0)
|
||||||
radiusclear(i, 0);
|
radiusclear(i, radius[i].session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue