miniupnpd: added DISABLE_CONFIG_FILE in options.h to disable miniupnpd.conf parsing
This commit is contained in:
parent
dcae1caf72
commit
0df9f7f62a
|
@ -1,4 +1,7 @@
|
|||
$Id: Changelog.txt,v 1.290 2012/06/23 23:34:41 nanard Exp $
|
||||
$Id: Changelog.txt,v 1.292 2012/06/29 19:26:07 nanard Exp $
|
||||
|
||||
2012/06/29:
|
||||
added DISABLE_CONFIG_FILE in options.h to disable miniupnpd.conf parsing
|
||||
|
||||
2012/06/28:
|
||||
Only activate -L option for PF and IPF
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh
|
||||
# $Id: genconfig.sh,v 1.56 2012/05/31 09:32:39 nanard Exp $
|
||||
# $Id: genconfig.sh,v 1.58 2012/06/29 19:29:55 nanard Exp $
|
||||
# miniupnp daemon
|
||||
# http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
|
||||
# (c) 2006-2012 Thomas Bernard
|
||||
|
@ -399,6 +399,10 @@ else
|
|||
fi
|
||||
echo "" >> ${CONFIGFILE}
|
||||
|
||||
echo "/* disable reading and parsing of config file (miniupnpd.conf) */" >> ${CONFIGFILE}
|
||||
echo "/*#define DISABLE_CONFIG_FILE*/" >> ${CONFIGFILE}
|
||||
echo "" >> ${CONFIGFILE}
|
||||
|
||||
echo "#endif" >> ${CONFIGFILE}
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: miniupnpd.c,v 1.161 2012/05/21 15:50:03 nanard Exp $ */
|
||||
/* $Id: miniupnpd.c,v 1.164 2012/06/29 19:33:37 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* (c) 2006-2012 Thomas Bernard
|
||||
|
@ -651,12 +651,14 @@ init(int argc, char * * argv, struct runtime_vars * v)
|
|||
int i;
|
||||
int pid;
|
||||
int debug_flag = 0;
|
||||
int options_flag = 0;
|
||||
int openlog_option;
|
||||
struct sigaction sa;
|
||||
/*const char * logfilename = 0;*/
|
||||
const char * presurl = 0;
|
||||
#ifndef DISABLE_CONFIG_FILE
|
||||
int options_flag = 0;
|
||||
const char * optionsfile = DEFAULT_CONFIG;
|
||||
#endif /* DISABLE_CONFIG_FILE */
|
||||
struct lan_addr_s * lan_addr;
|
||||
struct lan_addr_s * lan_addr2;
|
||||
|
||||
|
@ -666,6 +668,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
|
|||
if(0 == strcmp(argv[i], "-h"))
|
||||
goto print_usage;
|
||||
}
|
||||
#ifndef DISABLE_CONFIG_FILE
|
||||
/* first check if "-f" option is used */
|
||||
for(i=2; i<argc; i++)
|
||||
{
|
||||
|
@ -676,16 +679,17 @@ init(int argc, char * * argv, struct runtime_vars * v)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif /* DISABLE_CONFIG_FILE */
|
||||
|
||||
/* set initial values */
|
||||
SETFLAG(ENABLEUPNPMASK);
|
||||
SETFLAG(ENABLEUPNPMASK); /* UPnP is enabled by default */
|
||||
|
||||
LIST_INIT(&lan_addrs);
|
||||
v->port = -1;
|
||||
v->notify_interval = 30; /* seconds between SSDP announces */
|
||||
v->clean_ruleset_threshold = 20;
|
||||
v->clean_ruleset_interval = 0; /* interval between ruleset check. 0=disabled */
|
||||
|
||||
#ifndef DISABLE_CONFIG_FILE
|
||||
/* read options file first since
|
||||
* command line arguments have final say */
|
||||
if(readoptionsfile(optionsfile) < 0)
|
||||
|
@ -825,6 +829,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* DISABLE_CONFIG_FILE */
|
||||
|
||||
/* command line arguments processing */
|
||||
for(i=1; i<argc; i++)
|
||||
|
@ -1142,7 +1147,11 @@ init(int argc, char * * argv, struct runtime_vars * v)
|
|||
return 0;
|
||||
print_usage:
|
||||
fprintf(stderr, "Usage:\n\t"
|
||||
"%s [-f config_file] [-i ext_ifname] [-o ext_ip]\n"
|
||||
"%s "
|
||||
#ifndef DISABLE_CONFIG_FILE
|
||||
"[-f config_file] "
|
||||
#endif
|
||||
"[-i ext_ifname] [-o ext_ip]\n"
|
||||
#ifndef MULTIPLE_EXTERNAL_IP
|
||||
"\t\t[-a listening_ip]"
|
||||
#else
|
||||
|
@ -1858,7 +1867,9 @@ shutdown:
|
|||
#endif
|
||||
free(snotify);
|
||||
closelog();
|
||||
#ifndef DISABLE_CONFIG_FILE
|
||||
freeoptions();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: options.c,v 1.25 2012/04/30 13:38:21 nanard Exp $ */
|
||||
/* $Id: options.c,v 1.26 2012/06/29 19:26:09 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* author: Ryan Wagoner
|
||||
|
@ -11,10 +11,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <syslog.h>
|
||||
#include "config.h"
|
||||
#include "options.h"
|
||||
#include "upnppermissions.h"
|
||||
#include "upnpglobalvars.h"
|
||||
|
||||
#ifndef DISABLE_CONFIG_FILE
|
||||
struct option * ary_options = NULL;
|
||||
static char * string_repo = NULL;
|
||||
unsigned int num_options = 0;
|
||||
|
@ -248,3 +250,5 @@ freeoptions(void)
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* DISABLE_CONFIG_FILE */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: options.h,v 1.20 2012/04/30 13:38:21 nanard Exp $ */
|
||||
/* $Id: options.h,v 1.21 2012/06/29 19:26:09 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* author: Ryan Wagoner
|
||||
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef DISABLE_CONFIG_FILE
|
||||
/* enum of option available in the miniupnpd.conf */
|
||||
enum upnpconfigoptions {
|
||||
UPNP_INVALID = 0,
|
||||
|
@ -71,5 +72,7 @@ struct option
|
|||
extern struct option * ary_options;
|
||||
extern unsigned int num_options;
|
||||
|
||||
#endif
|
||||
#endif /* DISABLE_CONFIG_FILE */
|
||||
|
||||
#endif /* __OPTIONS_H__ */
|
||||
|
||||
|
|
Loading…
Reference in New Issue