Commit a084e5a8 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add even more options to configuration file.

This probably ensures that everything that can be done from the
command-line can be done from the configuration file.
parent f9900e91
......@@ -64,7 +64,9 @@ int default_wireless_hello_interval = -1;
int default_wired_hello_interval = -1;
int resend_delay = -1;
int do_daemonise = 0;
char *logfile = NULL, *pidfile = "/var/run/babeld.pid";
char *logfile = NULL,
*pidfile = "/var/run/babeld.pid",
*state_file = "/var/lib/babel-state";
unsigned char *receive_buffer = NULL;
int receive_buffer_size = 0;
......@@ -74,8 +76,6 @@ const unsigned char ones[16] =
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
char *state_file = "/var/lib/babel-state";
int protocol_port;
unsigned char protocol_group[16];
int protocol_socket = -1;
......
......@@ -85,6 +85,8 @@ extern int debug;
extern time_t reboot_time;
extern int default_wireless_hello_interval, default_wired_hello_interval;
extern int resend_delay;
extern int do_daemonise;
extern char *logfile, *pidfile, *state_file;
extern int link_detect;
extern int all_wireless;
......@@ -92,7 +94,6 @@ extern unsigned char myid[8];
extern const unsigned char zeroes[16], ones[16];
extern char *state_file;
extern int protocol_port, local_server_port;
extern unsigned char protocol_group[16];
extern int protocol_socket;
......
......@@ -181,13 +181,6 @@ This specifies whether to keep unfeasible (useless) routes, and is
equivalent to the command-line option
.BR \-u .
.TP
.BI state-file " filename"
This specifies the name of the file used for preserving long-term
information between invocations of the
.B babeld
daemon, and is equivalent to the command-line option
.BR \-S .
.TP
.BI debug " level"
This specifies the debugging level, and is equivalent to the command-line
option
......@@ -236,6 +229,30 @@ This specifies the half-life in seconds of the exponential decay used
for smoothing metrics for performing route selection, and is
equivalent to the command-line option
.BR \-M .
.TP
.BR deamonise " {" true | false }
This specifies whether to daemonize at startup, and is equivalent to
the command-line option
.BR \-D .
.TP
.TP
.BI state-file " filename"
This specifies the name of the file used for preserving long-term
information between invocations of the
.B babeld
daemon, and is equivalent to the command-line option
.BR \-S .
.TP
.BI log-file " filename"
This specifies the name of the file used to log random messages to,
and is equivalent to the command-line option
.BR \-L .
.TP
.BI pid-file " filename"
This specifies the name of the file to which
.B babeld
writes out its process id, and is equivalent to the command-line option
.BR \-I .
.SS Interface configuration
An interface is configured by a line with the following format:
.IP
......
......@@ -611,7 +611,8 @@ parse_option(int c, gnc_t gnc, void *closure)
else
abort();
} else if(strcmp(token, "keep-unfeasible") == 0 ||
strcmp(token, "link-detect") == 0) {
strcmp(token, "link-detect") == 0 ||
strcmp(token, "daemonise") == 0) {
int b;
c = getbool(c, &b, gnc, closure);
if(c < -1)
......@@ -621,6 +622,8 @@ parse_option(int c, gnc_t gnc, void *closure)
keep_unfeasible = b;
else if(strcmp(token, "link-detect") == 0)
link_detect = b;
else if(strcmp(token, "daemonise") == 0)
do_daemonise = b;
else
abort();
} else if(strcmp(token, "protocol-group") == 0) {
......@@ -630,12 +633,21 @@ parse_option(int c, gnc_t gnc, void *closure)
goto error;
memcpy(protocol_group, group, 16);
free(group);
} else if(strcmp(token, "state-file") == 0) {
} else if(strcmp(token, "state-file") == 0 ||
strcmp(token, "log-file") == 0 ||
strcmp(token, "pid-file") == 0) {
char *file;
c = getstring(c, &file, gnc, closure);
if(c < -1)
goto error;
state_file = file;
if(strcmp(token, "state-file") == 0)
state_file = file;
else if(strcmp(token, "log-file") == 0)
logfile = file;
else if(strcmp(token, "pid-file") == 0)
pidfile = file;
else
abort();
} else if(strcmp(token, "debug") == 0) {
int d;
c = getint(c, &d, gnc, closure);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment