fix command line args
This commit is contained in:
parent
f6f9bebeaa
commit
5386106aa5
2 changed files with 12 additions and 10 deletions
18
l2tpns.c
18
l2tpns.c
|
|
@ -4,7 +4,7 @@
|
||||||
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
|
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
|
||||||
// vim: sw=8 ts=8
|
// vim: sw=8 ts=8
|
||||||
|
|
||||||
char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.30 2004/10/05 02:50:03 fred_nerk Exp $";
|
char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.31 2004/10/25 15:07:51 bodea Exp $";
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
@ -2458,7 +2458,7 @@ void mainloop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init data structures
|
// Init data structures
|
||||||
void initdata(void)
|
void initdata(int optdebug, char *optconfig)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
@ -2475,7 +2475,8 @@ void initdata(void)
|
||||||
}
|
}
|
||||||
memset(config, 0, sizeof(struct configt));
|
memset(config, 0, sizeof(struct configt));
|
||||||
time(&config->start_time);
|
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)))
|
if (!(tunnel = shared_malloc(sizeof(tunnelt) * MAXTUNNEL)))
|
||||||
{
|
{
|
||||||
log(0, 0, 0, 0, "Error doing malloc for tunnels: %s\n", strerror(errno));
|
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 o;
|
||||||
int optdebug = 0;
|
int optdebug = 0;
|
||||||
|
char *optconfig = CONFIGFILE;
|
||||||
|
|
||||||
_program_name = strdup(argv[0]);
|
_program_name = strdup(argv[0]);
|
||||||
|
|
||||||
time(&basetime); // start clock
|
time(&basetime); // start clock
|
||||||
|
|
||||||
// scan args
|
// scan args
|
||||||
while ((o = getopt(argc, argv, "vc:h:a:")) >= 0)
|
while ((o = getopt(argc, argv, "dvc:h:")) >= 0)
|
||||||
{
|
{
|
||||||
switch (o)
|
switch (o)
|
||||||
{
|
{
|
||||||
|
|
@ -2924,10 +2926,12 @@ int main(int argc, char *argv[])
|
||||||
case 'v':
|
case 'v':
|
||||||
optdebug++;
|
optdebug++;
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
|
optconfig = optarg;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
snprintf(hostname, sizeof(hostname), "%s", optarg);
|
snprintf(hostname, sizeof(hostname), "%s", optarg);
|
||||||
break;
|
break;
|
||||||
case '?':
|
|
||||||
default:
|
default:
|
||||||
printf("Args are:\n"
|
printf("Args are:\n"
|
||||||
"\t-d\tDetach from terminal\n"
|
"\t-d\tDetach from terminal\n"
|
||||||
|
|
@ -2949,9 +2953,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
initiptables();
|
initiptables();
|
||||||
initplugins();
|
initplugins();
|
||||||
initdata();
|
initdata(optdebug, optconfig);
|
||||||
|
|
||||||
config->debug = optdebug;
|
|
||||||
|
|
||||||
init_tbf();
|
init_tbf();
|
||||||
init_cli();
|
init_cli();
|
||||||
|
|
|
||||||
4
l2tpns.h
4
l2tpns.h
|
|
@ -1,5 +1,5 @@
|
||||||
// L2TPNS Global Stuff
|
// L2TPNS Global Stuff
|
||||||
// $Id: l2tpns.h,v 1.20 2004/10/04 23:34:54 fred_nerk Exp $
|
// $Id: l2tpns.h,v 1.21 2004/10/25 15:07:52 bodea Exp $
|
||||||
|
|
||||||
#ifndef __L2TPNS_H__
|
#ifndef __L2TPNS_H__
|
||||||
#define __L2TPNS_H__
|
#define __L2TPNS_H__
|
||||||
|
|
@ -503,7 +503,7 @@ clockt backoff(u8 try);
|
||||||
void routeset(sessionidt, ipt ip, ipt mask, ipt gw, u8 add);
|
void routeset(sessionidt, ipt ip, ipt mask, ipt gw, u8 add);
|
||||||
void inittun(void);
|
void inittun(void);
|
||||||
void initudp(void);
|
void initudp(void);
|
||||||
void initdata(void);
|
void initdata(int optdebug, const char *optconfig);
|
||||||
void initippool();
|
void initippool();
|
||||||
sessionidt sessionbyip(ipt ip);
|
sessionidt sessionbyip(ipt ip);
|
||||||
sessionidt sessionbyuser(char *username);
|
sessionidt sessionbyuser(char *username);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue