// L2TPNS Global Stuff
-// $Id: l2tpns.h,v 1.47 2004/12/16 08:49:53 bodea Exp $
+// $Id: l2tpns.h,v 1.49.2.3 2005/01/13 07:58:54 bodea Exp $
#ifndef __L2TPNS_H__
#define __L2TPNS_H__
#include <sys/types.h>
#include <libcli.h>
-#define VERSION "2.0.13"
+#define VERSION "2.0.15"
// Limits
#define MAXTUNNEL 500 // could be up to 65535
typedef struct
{
+ // byte counters
uint32_t cin;
uint32_t cout;
-} sessioncountt;
+
+ // DoS prevention
+ clockt last_packet_out;
+ uint32_t packets_out;
+ uint32_t packets_dropped;
+} sessionlocalt;
#define SESSIONPFC 1 // PFC negotiated flags
#define SESSIONACFC 2 // ACFC negotiated flags
struct Tstats
{
- time_t start_time;
- time_t last_reset;
-
- unsigned long tun_rx_packets;
- unsigned long tun_tx_packets;
- unsigned long tun_rx_bytes;
- unsigned long tun_tx_bytes;
- unsigned long tun_rx_errors;
- unsigned long tun_tx_errors;
-
- unsigned long tunnel_rx_packets;
- unsigned long tunnel_tx_packets;
- unsigned long tunnel_rx_bytes;
- unsigned long tunnel_tx_bytes;
- unsigned long tunnel_rx_errors;
- unsigned long tunnel_tx_errors;
-
- unsigned long tunnel_retries;
- unsigned long radius_retries;
-
- unsigned long arp_sent;
-
- unsigned long packets_snooped;
-
- unsigned long tunnel_created;
- unsigned long session_created;
- unsigned long tunnel_timeout;
- unsigned long session_timeout;
- unsigned long radius_timeout;
- unsigned long radius_overflow;
- unsigned long tunnel_overflow;
- unsigned long session_overflow;
-
- unsigned long ip_allocated;
- unsigned long ip_freed;
-
- unsigned long c_forwarded;
- unsigned long recv_forward;
+ time_t start_time;
+ time_t last_reset;
+
+ uint32_t tun_rx_packets;
+ uint32_t tun_tx_packets;
+ uint32_t tun_rx_bytes;
+ uint32_t tun_tx_bytes;
+ uint32_t tun_rx_errors;
+ uint32_t tun_tx_errors;
+ uint32_t tun_rx_dropped;
+
+ uint32_t tunnel_rx_packets;
+ uint32_t tunnel_tx_packets;
+ uint32_t tunnel_rx_bytes;
+ uint32_t tunnel_tx_bytes;
+ uint32_t tunnel_rx_errors;
+ uint32_t tunnel_tx_errors;
+
+ uint32_t tunnel_retries;
+ uint32_t radius_retries;
+
+ uint32_t arp_sent;
+
+ uint32_t packets_snooped;
+
+ uint32_t tunnel_created;
+ uint32_t session_created;
+ uint32_t tunnel_timeout;
+ uint32_t session_timeout;
+ uint32_t radius_timeout;
+ uint32_t radius_overflow;
+ uint32_t tunnel_overflow;
+ uint32_t session_overflow;
+
+ uint32_t ip_allocated;
+ uint32_t ip_freed;
+
+ uint32_t c_forwarded;
+ uint32_t recv_forward;
+
+ uint32_t select_called;
+ uint32_t multi_read_used;
+ uint32_t multi_read_exceeded;
+
#ifdef STATISTICS
- unsigned long call_processtun;
- unsigned long call_processipout;
- unsigned long call_processudp;
- unsigned long call_sessionbyip;
- unsigned long call_sessionbyuser;
- unsigned long call_sendarp;
- unsigned long call_sendipcp;
- unsigned long call_tunnelsend;
- unsigned long call_sessionkill;
- unsigned long call_sessionshutdown;
- unsigned long call_tunnelkill;
- unsigned long call_tunnelshutdown;
- unsigned long call_assign_ip_address;
- unsigned long call_free_ip_address;
- unsigned long call_dump_acct_info;
- unsigned long call_sessionsetup;
- unsigned long call_processpap;
- unsigned long call_processchap;
- unsigned long call_processlcp;
- unsigned long call_processipcp;
- unsigned long call_processipin;
- unsigned long call_processccp;
- unsigned long call_sendchap;
- unsigned long call_processrad;
- unsigned long call_radiussend;
- unsigned long call_radiusretry;
+ uint32_t call_processtun;
+ uint32_t call_processipout;
+ uint32_t call_processudp;
+ uint32_t call_sessionbyip;
+ uint32_t call_sessionbyuser;
+ uint32_t call_sendarp;
+ uint32_t call_sendipcp;
+ uint32_t call_tunnelsend;
+ uint32_t call_sessionkill;
+ uint32_t call_sessionshutdown;
+ uint32_t call_tunnelkill;
+ uint32_t call_tunnelshutdown;
+ uint32_t call_assign_ip_address;
+ uint32_t call_free_ip_address;
+ uint32_t call_dump_acct_info;
+ uint32_t call_sessionsetup;
+ uint32_t call_processpap;
+ uint32_t call_processchap;
+ uint32_t call_processlcp;
+ uint32_t call_processipcp;
+ uint32_t call_processipin;
+ uint32_t call_processccp;
+ uint32_t call_sendchap;
+ uint32_t call_processrad;
+ uint32_t call_radiussend;
+ uint32_t call_radiusretry;
#endif
};
int next_tbf; // Next HTB id available to use
int scheduler_fifo; // If the system has multiple CPUs, use FIFO scheduling policy for this process.
int lock_pages; // Lock pages into memory.
- int icmp_rate; // Max number of ICMP unreachable per second to send>
+ int icmp_rate; // Max number of ICMP unreachable per second to send
+ int max_packets; // DoS prevention: per session limit of packets/0.1s
in_addr_t cluster_address; // Multicast address of cluster.
// Send to this address to have everyone hear.
extern tunnelt *tunnel;
extern sessiont *session;
-extern sessioncountt *sess_count;
+extern sessionlocalt *sess_local;
extern ippoolt *ip_address_pool;
#define sessionfree (session[0].next)