Commit 2be3f890 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add more options to the config file.

parent a56c7e8e
...@@ -92,7 +92,8 @@ extern unsigned char myid[8]; ...@@ -92,7 +92,8 @@ extern unsigned char myid[8];
extern const unsigned char zeroes[16], ones[16]; extern const unsigned char zeroes[16], ones[16];
extern int protocol_port; extern char *state_file;
extern int protocol_port, local_server_port;
extern unsigned char protocol_group[16]; extern unsigned char protocol_group[16];
extern int protocol_socket; extern int protocol_socket;
extern int kernel_socket; extern int kernel_socket;
......
...@@ -163,6 +163,42 @@ protocol, and is equivalent to the command-line option ...@@ -163,6 +163,42 @@ protocol, and is equivalent to the command-line option
.BI protocol-port " port" .BI protocol-port " port"
This specifies the UDP port number to be used by the protocol, and is equivalent to the command-line option This specifies the UDP port number to be used by the protocol, and is equivalent to the command-line option
.BR \-p . .BR \-p .
.TP
.BI kernel-priority " priority"
This specifies the priority value used when installing routes into the
kernel, and is equivalent to the command-line option
.BR \-k .
.TP
.BI allow-duplicates " priority"
This allows duplicating external routes when their kernel priority is
at least
.IR priority .
Do not use this option unless you know what you are doing, as it can
cause persistent route flapping.
.TP
.BR keep-unfeasible " {" true | false }
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
.BR \-d .
.TP
.BI local-port " port"
This specifies the TCP port on which
.B babeld
will listen for connections from a front-end, and is equivalent to the
command-line option
.BR \-g .
.SS Interface configuration .SS Interface configuration
An interface is configured by a line with the following format: An interface is configured by a line with the following format:
.IP .IP
......
...@@ -35,6 +35,7 @@ THE SOFTWARE. ...@@ -35,6 +35,7 @@ THE SOFTWARE.
#include "babeld.h" #include "babeld.h"
#include "util.h" #include "util.h"
#include "interface.h" #include "interface.h"
#include "route.h"
#include "configuration.h" #include "configuration.h"
struct filter *input_filters = NULL; struct filter *input_filters = NULL;
...@@ -594,6 +595,46 @@ parse_option(int c, gnc_t gnc, void *closure) ...@@ -594,6 +595,46 @@ parse_option(int c, gnc_t gnc, void *closure)
goto error; goto error;
memcpy(protocol_group, group, 16); memcpy(protocol_group, group, 16);
free(group); free(group);
} else if(strcmp(token, "kernel-priority") == 0) {
int m;
c = getint(c, &m, gnc, closure);
if(c < -1 || m < 0 || m > 0xFFFF)
goto error;
kernel_metric = m;
} else if(strcmp(token, "allow-duplicates") == 0) {
int a;
c = getint(c, &a, gnc, closure);
if(c < -1 || a < 0 || a > 0xFFFF)
goto error;
allow_duplicates = c;
} else if(strcmp(token, "keep-unfeasible") == 0) {
int u;
c = getbool(c, &u, gnc, closure);
if(c < -1)
goto error;
keep_unfeasible = (u == CONFIG_YES);
} else if(strcmp(token, "state-file") == 0) {
char *file;
c = getstring(c, &file, gnc, closure);
if(c < -1)
goto error;
state_file = file;
} else if(strcmp(token, "debug") == 0) {
int d;
c = getint(c, &d, gnc, closure);
if(d < 0)
goto error;
debug = d;
} else if(strcmp(token, "local-port") == 0) {
int p;
c = getint(c, &p, gnc, closure);
if(c < -1 || p < 0 || p > 0xFFFF)
goto error;
#ifdef NO_LOCAL_INTERFACE
fprintf(stderr, "Warning: no local interface in this version.\n");
#else
local_server_port = p;
#endif
} else { } else {
goto error; goto error;
} }
......
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