Allow cli session changes to happen if the session is timing out

This commit is contained in:
David Parrish 2004-08-02 06:06:28 +00:00
parent f7a59cd6cc
commit 5779efc7ae
3 changed files with 112 additions and 112 deletions

View file

@ -1,6 +1,6 @@
// L2TPNS Clustering Stuff
char const *cvs_id_cluster = "$Id: cluster.c,v 1.9 2004-07-11 07:57:35 bodea Exp $";
char const *cvs_id_cluster = "$Id: cluster.c,v 1.10 2004-08-02 06:06:28 fred_nerk Exp $";
#include <stdio.h>
#include <sys/file.h>
@ -106,12 +106,13 @@ int cluster_init()
}
strcpy(ifr.ifr_name, config->cluster_interface);
if (ioctl(cluster_sockfd, SIOCGIFADDR, &ifr) < 0) {
if (ioctl(cluster_sockfd, SIOCGIFADDR, &ifr) < 0)
{
log(0, 0, 0, 0, "Failed to get interface address for (%s): %s\n", config->cluster_interface, strerror(errno));
return -1;
}
memcpy(&interface_addr, &ifr.ifr_addr, sizeof(interface_addr) );
memcpy(&interface_addr, &ifr.ifr_addr, sizeof(interface_addr));
my_address = interface_addr.sin_addr.s_addr;
// Join multicast group.
@ -122,12 +123,14 @@ int cluster_init()
opt = 0; // Turn off multicast loopback.
setsockopt(cluster_sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &opt, sizeof(opt));
if (setsockopt(cluster_sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
if (setsockopt(cluster_sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
{
log(0, 0, 0, 0, "Failed to setsockopt (join mcast group): %s\n", strerror(errno));
return -1;
}
if (setsockopt (cluster_sockfd, IPPROTO_IP, IP_MULTICAST_IF, &interface_addr, sizeof(interface_addr)) < 0) {
if (setsockopt (cluster_sockfd, IPPROTO_IP, IP_MULTICAST_IF, &interface_addr, sizeof(interface_addr)) < 0)
{
log(0, 0, 0, 0, "Failed to setsockopt (set mcast interface): %s\n", strerror(errno));
return -1;
}
@ -330,7 +333,8 @@ static void send_heartbeat(int seq, char * data, int size)
{
int i;
if (size > sizeof(past_hearts[0].data)) {
if (size > sizeof(past_hearts[0].data))
{
log(0,0,0,0, "Tried to heartbeat something larger than the maximum packet!\n");
kill(0, SIGTERM);
exit(1);
@ -917,7 +921,6 @@ int cluster_add_peer(u32 peer, time_t basetime, pingt *pp, int size)
u32 clusterid;
pingt p;
// Allow for backward compatability.
// Just the ping packet into a new structure to allow
// for the possibility that we might have received
@ -928,7 +931,6 @@ int cluster_add_peer(u32 peer, time_t basetime, pingt *pp, int size)
memset( (void*) &p, 0, sizeof(p) );
memcpy( (void*) &p, (void*) pp, size);
clusterid = p.addr;
if (clusterid != config->bind_address)
{

View file

@ -4,7 +4,7 @@
// 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.20 2004-08-02 05:40:21 fred_nerk Exp $";
char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.21 2004-08-02 06:06:28 fred_nerk Exp $";
#include <arpa/inet.h>
#include <assert.h>
@ -2079,7 +2079,6 @@ int regular_cleanups(void)
(int)(time_now - session[s].last_packet));
tunnelsend(b, 24, session[s].tunnel); // send it
if (++count >= MAX_ACTIONS) break;
continue;
}
// Check for actions requested from the CLI
@ -2131,7 +2130,6 @@ int regular_cleanups(void)
cluster_send_session(s);
if (++count >= MAX_ACTIONS) break;
continue;
}
}

4
ppp.c
View file

@ -1,6 +1,6 @@
// L2TPNS PPP Stuff
char const *cvs_id_ppp = "$Id: ppp.c,v 1.10 2004-08-02 05:40:21 fred_nerk Exp $";
char const *cvs_id_ppp = "$Id: ppp.c,v 1.11 2004-08-02 06:06:28 fred_nerk Exp $";
#include <stdio.h>
#include <string.h>
@ -614,7 +614,7 @@ void processipcp(tunnelidt t, sessionidt s, u8 * p, u16 l)
*(u32 *) (i + 2) = htonl(session[s].ip);
*p = ConfigNak;
log(4, session[s].ip, s, t, " No, a ConfigNak, client is requesting IP - sending %s\n",
inet_toa(session[s].ip));
inet_toa(htonl(session[s].ip)));
}
if (!(q = makeppp(b, sizeof(b), p, l, t, s, PPPIPCP)))
{