X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/3ef237977d8e9596f8a22fabed7384b39a7aead5..4b259db0af5f85f423dd75292434bc65832078ea:/l2tpns.c?ds=sidebyside diff --git a/l2tpns.c b/l2tpns.c index c3443bd..51aec99 100644 --- 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 -char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.13 2004/07/11 07:57:35 bodea Exp $"; +char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.15 2004/07/12 15:16:27 bodea Exp $"; #include #include @@ -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("lock_pages", lock_pages, BOOL), 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 *)) -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. -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; @@ -2836,6 +2837,7 @@ void dump_acct_info() int main(int argc, char *argv[]) { int o; + int optdebug = 0; _program_name = strdup(argv[0]); @@ -2852,7 +2854,7 @@ int main(int argc, char *argv[]) if (fork()) exit(0); break; case 'v': - config->debug++; + optdebug++; break; case 'h': snprintf(hostname, sizeof(hostname), "%s", optarg); @@ -2880,6 +2882,9 @@ int main(int argc, char *argv[]) initiptables(); initplugins(); initdata(); + + config->debug = optdebug; + init_tbf(); init_cli(hostname); read_config_file(); @@ -2955,6 +2960,15 @@ int main(int argc, char *argv[]) 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