projects
/
l2tpns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix for -v from Juergen Kammer
[l2tpns.git]
/
l2tpns.c
diff --git
a/l2tpns.c
b/l2tpns.c
index
cd550f7
..
51aec99
100644
(file)
--- a/
l2tpns.c
+++ b/
l2tpns.c
@@
-4,7
+4,7
@@
// 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.1
2 2004/07/08 16:54:35
bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.1
5 2004/07/12 15:16:27
bodea Exp $";
#include <arpa/inet.h>
#include <assert.h>
#include <arpa/inet.h>
#include <assert.h>
@@
-111,6
+111,7
@@
struct config_descriptt config_values[] = {
CONFIG("cleanup_interval", cleanup_interval, INT),
CONFIG("multi_read_count", multi_read_count, INT),
CONFIG("scheduler_fifo", scheduler_fifo, BOOL),
CONFIG("cleanup_interval", cleanup_interval, INT),
CONFIG("multi_read_count", multi_read_count, INT),
CONFIG("scheduler_fifo", scheduler_fifo, BOOL),
+ CONFIG("lock_pages", lock_pages, BOOL),
CONFIG("icmp_rate", icmp_rate, INT),
CONFIG("cluster_address", cluster_address, IP),
CONFIG("cluster_interface", cluster_interface, STRING),
CONFIG("icmp_rate", icmp_rate, INT),
CONFIG("cluster_address", cluster_address, IP),
CONFIG("cluster_interface", cluster_interface, STRING),
@@
-143,10
+144,10
@@
char *plugin_functions[] = {
#define max_plugin_functions (sizeof(plugin_functions) / sizeof(char *))
#define max_plugin_functions (sizeof(plugin_functions) / sizeof(char *))
-tunnelt *tunnel = NULL; // Array of tunnel structures.
-sessiont *session = NULL; // Array of session structures.
+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.
sessioncountt *sess_count = NULL; // Array of partial per-session traffic counters.
-radiust *radius = NULL; // Array of radius structures.
+radiust *radius = NULL;
// Array of radius structures.
ippoolt *ip_address_pool = NULL; // Array of dynamic IP addresses.
controlt *controlfree = 0;
struct Tstats *_statistics = NULL;
ippoolt *ip_address_pool = NULL; // Array of dynamic IP addresses.
controlt *controlfree = 0;
struct Tstats *_statistics = NULL;
@@
-1015,7
+1016,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);
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
@@
-1122,9
+1123,10
@@
void sessionkill(sessionidt s, char *reason)
CSTAT(call_sessionkill);
CSTAT(call_sessionkill);
+ 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);
@@
-1304,9
+1306,9
@@
void processudp(u8 * buf, int len, struct sockaddr_in *addr)
// 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) )
continue;
t = i;
break;
continue;
t = i;
break;
@@
-2835,6
+2837,7
@@
void dump_acct_info()
int main(int argc, char *argv[])
{
int o;
int main(int argc, char *argv[])
{
int o;
+ int optdebug = 0;
_program_name = strdup(argv[0]);
_program_name = strdup(argv[0]);
@@
-2851,7
+2854,7
@@
int main(int argc, char *argv[])
if (fork()) exit(0);
break;
case 'v':
if (fork()) exit(0);
break;
case 'v':
-
config->
debug++;
+
opt
debug++;
break;
case 'h':
snprintf(hostname, sizeof(hostname), "%s", optarg);
break;
case 'h':
snprintf(hostname, sizeof(hostname), "%s", optarg);
@@
-2879,6
+2882,9
@@
int main(int argc, char *argv[])
initiptables();
initplugins();
initdata();
initiptables();
initplugins();
initdata();
+
+ config->debug = optdebug;
+
init_tbf();
init_cli(hostname);
read_config_file();
init_tbf();
init_cli(hostname);
read_config_file();
@@
-2954,6
+2960,15
@@
int main(int argc, char *argv[])
signal(SIGQUIT, sigquit_handler);
signal(SIGCHLD, sigchild_handler);
signal(SIGQUIT, sigquit_handler);
signal(SIGCHLD, sigchild_handler);
+ // Prevent us from getting paged out
+ if (config->lock_pages)
+ {
+ if (!mlockall(MCL_CURRENT))
+ log(1, 0, 0, 0, "Locking pages into memory\n");
+ else
+ log(0, 0, 0, 0, "Can't lock pages: %s\n", strerror(errno));
+ }
+
alarm(1);
// Drop privileges here
alarm(1);
// Drop privileges here