// L2TPNS Clustering Stuff
-char const *cvs_id_cluster = "$Id: cluster.c,v 1.28 2004/12/22 05:30:58 bodea Exp $";
+char const *cvs_id_cluster = "$Id: cluster.c,v 1.29 2005/01/13 07:57:35 bodea Exp $";
#include <stdio.h>
#include <stdlib.h>
if ( walk_session_number > config->cluster_highest_sessionid)
walk_session_number = 1;
- if (!sess_count[walk_session_number].cin && !sess_count[walk_session_number].cout)
+ if (!sess_local[walk_session_number].cin && !sess_local[walk_session_number].cout)
continue; // Unused. Skip it.
b[c].sid = walk_session_number;
- b[c].in = sess_count[walk_session_number].cin;
- b[c].out = sess_count[walk_session_number].cout;
+ b[c].in = sess_local[walk_session_number].cin;
+ b[c].out = sess_local[walk_session_number].cout;
if (++c > MAX_B_RECS) // Send a max of 400 elements in a packet.
break;
// Reset counters.
- sess_count[walk_session_number].cin = sess_count[walk_session_number].cout = 0;
+ sess_local[walk_session_number].cin = sess_local[walk_session_number].cout = 0;
}
if (!c) // Didn't find any that changes. Get out of here!
session[i].last_packet = time_now;
// Accumulate un-sent byte counters.
- session[i].cin += sess_count[i].cin;
- session[i].cout += sess_count[i].cout;
- session[i].total_cin += sess_count[i].cin;
- session[i].total_cout += sess_count[i].cout;
+ session[i].cin += sess_local[i].cin;
+ session[i].cout += sess_local[i].cout;
+ session[i].total_cin += sess_local[i].cin;
+ session[i].total_cout += sess_local[i].cout;
- sess_count[i].cin = sess_count[i].cout = 0;
+ sess_local[i].cin = sess_local[i].cout = 0;
session[i].radius = 0; // Reset authentication as the radius blocks aren't up to date.
// 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.77 2005/01/10 07:45:03 bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.78 2005/01/13 07:57:36 bodea Exp $";
#include <arpa/inet.h>
#include <assert.h>
tunnelt *tunnel = NULL; // Array of tunnel structures.
sessiont *session = NULL; // Array of session structures.
-sessioncountt *sess_count = NULL; // Array of partial per-session traffic counters.
+sessionlocalt *sess_local = NULL; // Array of local per-session counters.
radiust *radius = NULL; // Array of radius structures.
ippoolt *ip_address_pool = NULL; // Array of dynamic IP addresses.
ip_filtert *ip_filters = NULL; // Array of named filters.
// DoS prevention: enforce a maximum number of packets per 0.1s for a session
if (config->max_packets > 0)
{
- if (sess_count[s].last_packet_out == TIME)
+ if (sess_local[s].last_packet_out == TIME)
{
int max = config->max_packets;
if (!config->cluster_iam_master && sp->throttle_out && sp->throttle_out < max)
max = sp->throttle_out;
- if (++sess_count[s].packets_out > max)
+ if (++sess_local[s].packets_out > max)
{
- sess_count[s].packets_dropped++;
+ sess_local[s].packets_dropped++;
return;
}
}
else
{
- if (sess_count[s].packets_dropped)
+ if (sess_local[s].packets_dropped)
{
- INC_STAT(tun_rx_dropped, sess_count[s].packets_dropped);
- LOG(2, s, t, "Possible DoS attack on %s (%s); dropped %u packets.\n",
- fmtaddr(ip, 0), sp->user, sess_count[s].packets_dropped);
+ INC_STAT(tun_rx_dropped, sess_local[s].packets_dropped);
+ LOG(3, s, t, "Dropped %u/%u packets to %s for %suser %s\n",
+ sess_local[s].packets_out, sess_local[s].packets_dropped,
+ fmtaddr(ip, 0), sp->throttle_out ? "throttled " : "",
+ sp->user);
}
- sess_count[s].last_packet_out = TIME;
- sess_count[s].packets_out = 1;
- sess_count[s].packets_dropped = 0;
+ sess_local[s].last_packet_out = TIME;
+ sess_local[s].packets_out = 1;
+ sess_local[s].packets_dropped = 0;
}
}
sp->total_cout += len; // byte count
sp->pout++;
udp_tx += len;
- sess_count[s].cout += len; // To send to master..
+ sess_local[s].cout += len; // To send to master..
}
//
sp->total_cout += len; // byte count
sp->pout++;
udp_tx += len;
- sess_count[s].cout += len; // To send to master..
+ sess_local[s].cout += len; // To send to master..
}
// add an AVP (16 bit)
exit(1);
}
- if (!(sess_count = shared_malloc(sizeof(sessioncountt) * MAXSESSION)))
+ if (!(sess_local = shared_malloc(sizeof(sessionlocalt) * MAXSESSION)))
{
- LOG(0, 0, 0, "Error doing malloc for sessions_count: %s\n", strerror(errno));
+ LOG(0, 0, 0, "Error doing malloc for sess_local: %s\n", strerror(errno));
exit(1);
}
// L2TPNS Global Stuff
-// $Id: l2tpns.h,v 1.52 2005/01/10 07:17:37 bodea Exp $
+// $Id: l2tpns.h,v 1.53 2005/01/13 07:57:39 bodea Exp $
#ifndef __L2TPNS_H__
#define __L2TPNS_H__
clockt last_packet_out;
uint32_t packets_out;
uint32_t packets_dropped;
-} sessioncountt;
+} sessionlocalt;
#define SESSIONPFC 1 // PFC negotiated flags
#define SESSIONACFC 2 // ACFC negotiated flags
extern tunnelt *tunnel;
extern sessiont *session;
-extern sessioncountt *sess_count;
+extern sessionlocalt *sess_local;
extern ippoolt *ip_address_pool;
#define sessionfree (session[0].next)
// L2TPNS PPP Stuff
-char const *cvs_id_ppp = "$Id: ppp.c,v 1.40 2005/01/05 13:50:30 bodea Exp $";
+char const *cvs_id_ppp = "$Id: ppp.c,v 1.41 2005/01/13 07:57:39 bodea Exp $";
#include <stdio.h>
#include <string.h>
session[s].cin += l - 4;
session[s].total_cin += l - 4;
- sess_count[s].cin += l - 4;
+ sess_local[s].cin += l - 4;
session[s].pin++;
eth_tx += l - 4;
// Increment packet counters
session[s].cin += len - 4;
session[s].total_cin += len - 4;
- sess_count[s].cin += len - 4;
+ sess_local[s].cin += len - 4;
session[s].pin++;
eth_tx += len - 4;