X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/bf78c77b229b28a7f614c023e0f03bb317317e84..cb6bbd1db1d8ee44a33cee7e2a40ed290d83dc73:/l2tpns.c diff --git a/l2tpns.c b/l2tpns.c index 2b31b81..e3bb2a2 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.29 2004/09/23 03:59:09 fred_nerk Exp $"; +char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.31 2004/10/25 15:07:51 bodea Exp $"; #include #include @@ -2458,7 +2458,7 @@ void mainloop(void) } // Init data structures -void initdata(void) +void initdata(int optdebug, char *optconfig) { int i; char *p; @@ -2475,7 +2475,8 @@ void initdata(void) } memset(config, 0, sizeof(struct configt)); time(&config->start_time); - strncpy(config->config_file, CONFIGFILE, sizeof(config->config_file) - 1); + config->debug = optdebug; + strncpy(config->config_file, optconfig, strlen(optconfig)); if (!(tunnel = shared_malloc(sizeof(tunnelt) * MAXTUNNEL))) { log(0, 0, 0, 0, "Error doing malloc for tunnels: %s\n", strerror(errno)); @@ -2906,13 +2907,14 @@ int main(int argc, char *argv[]) { int o; int optdebug = 0; + char *optconfig = CONFIGFILE; _program_name = strdup(argv[0]); time(&basetime); // start clock // scan args - while ((o = getopt(argc, argv, "vc:h:a:")) >= 0) + while ((o = getopt(argc, argv, "dvc:h:")) >= 0) { switch (o) { @@ -2924,10 +2926,12 @@ int main(int argc, char *argv[]) case 'v': optdebug++; break; + case 'c': + optconfig = optarg; + break; case 'h': snprintf(hostname, sizeof(hostname), "%s", optarg); break; - case '?': default: printf("Args are:\n" "\t-d\tDetach from terminal\n" @@ -2949,9 +2953,7 @@ int main(int argc, char *argv[]) initiptables(); initplugins(); - initdata(); - - config->debug = optdebug; + initdata(optdebug, optconfig); init_tbf(); init_cli(); @@ -3526,7 +3528,6 @@ int sessionsetup(tunnelidt t, sessionidt s) CSTAT(call_sessionsetup); - log(3, session[s].ip, s, t, "Doing session setup for session\n"); if (!session[s].ip || session[s].ip == 0xFFFFFFFE) @@ -3536,7 +3537,11 @@ int sessionsetup(tunnelidt t, sessionidt s) log(3, 0, s, t, " No IP allocated. Assigned %s from pool\n", inet_toa(htonl(session[s].ip))); else + { log(0, 0, s, t, " No IP allocated. The IP address pool is FULL!\n"); + sessionshutdown(s, "No IP addresses available"); + return 0; + } }