Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
854f7ff6
Commit
854f7ff6
authored
Feb 14, 2016
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only allow some config directives at runtime.
Many of the directives don't make sense after startup.
parent
280d1cd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
configuration.c
configuration.c
+29
-2
No files found.
configuration.c
View file @
854f7ff6
...
@@ -46,6 +46,10 @@ struct filter *redistribute_filters = NULL;
...
@@ -46,6 +46,10 @@ struct filter *redistribute_filters = NULL;
struct
filter
*
install_filters
=
NULL
;
struct
filter
*
install_filters
=
NULL
;
struct
interface_conf
*
default_interface_conf
=
NULL
;
struct
interface_conf
*
default_interface_conf
=
NULL
;
struct
interface_conf
*
interface_confs
=
NULL
;
struct
interface_conf
*
interface_confs
=
NULL
;
/* This indicates whether initial configuration is done. See
finalize_config below. */
int
config_finalised
=
0
;
int
config_finalised
=
0
;
/* This file implements a recursive descent parser with one character
/* This file implements a recursive descent parser with one character
...
@@ -709,6 +713,19 @@ flush_ifconf(struct interface_conf *if_conf)
...
@@ -709,6 +713,19 @@ flush_ifconf(struct interface_conf *if_conf)
static
int
static
int
parse_option
(
int
c
,
gnc_t
gnc
,
void
*
closure
,
char
*
token
)
parse_option
(
int
c
,
gnc_t
gnc
,
void
*
closure
,
char
*
token
)
{
{
/* These are the only options that are allowed at runtime, either
because they require no special setup or because there is special
case code for them. */
if
(
config_finalised
)
{
if
(
strcmp
(
token
,
"keep-unfeasible"
)
!=
0
&&
strcmp
(
token
,
"link-detect"
)
!=
0
&&
strcmp
(
token
,
"log-file"
)
!=
0
&&
strcmp
(
token
,
"diversity"
)
!=
0
&&
strcmp
(
token
,
"diversity-factor"
)
!=
0
&&
strcmp
(
token
,
"smoothing-half-life"
)
!=
0
)
goto
error
;
}
if
(
strcmp
(
token
,
"protocol-port"
)
==
0
||
if
(
strcmp
(
token
,
"protocol-port"
)
==
0
||
strcmp
(
token
,
"kernel-priority"
)
==
0
||
strcmp
(
token
,
"kernel-priority"
)
==
0
||
strcmp
(
token
,
"allow-duplicates"
)
==
0
||
strcmp
(
token
,
"allow-duplicates"
)
==
0
||
...
@@ -789,9 +806,11 @@ parse_option(int c, gnc_t gnc, void *closure, char *token)
...
@@ -789,9 +806,11 @@ parse_option(int c, gnc_t gnc, void *closure, char *token)
goto
error
;
goto
error
;
if
(
strcmp
(
token
,
"state-file"
)
==
0
)
if
(
strcmp
(
token
,
"state-file"
)
==
0
)
state_file
=
file
;
state_file
=
file
;
else
if
(
strcmp
(
token
,
"log-file"
)
==
0
)
else
if
(
strcmp
(
token
,
"log-file"
)
==
0
)
{
logfile
=
file
;
logfile
=
file
;
else
if
(
strcmp
(
token
,
"pid-file"
)
==
0
)
if
(
config_finalised
)
reopen_logfile
();
}
else
if
(
strcmp
(
token
,
"pid-file"
)
==
0
)
pidfile
=
file
;
pidfile
=
file
;
else
if
(
strcmp
(
token
,
"local-path"
)
==
0
)
{
else
if
(
strcmp
(
token
,
"local-path"
)
==
0
)
{
local_server_port
=
-
1
;
local_server_port
=
-
1
;
...
@@ -917,24 +936,32 @@ parse_config_line(int c, gnc_t gnc, void *closure,
...
@@ -917,24 +936,32 @@ parse_config_line(int c, gnc_t gnc, void *closure,
goto
fail
;
goto
fail
;
}
else
if
(
strcmp
(
token
,
"in"
)
==
0
)
{
}
else
if
(
strcmp
(
token
,
"in"
)
==
0
)
{
struct
filter
*
filter
;
struct
filter
*
filter
;
if
(
config_finalised
)
goto
fail
;
c
=
parse_filter
(
c
,
gnc
,
closure
,
&
filter
);
c
=
parse_filter
(
c
,
gnc
,
closure
,
&
filter
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
goto
fail
;
goto
fail
;
add_filter
(
filter
,
&
input_filters
);
add_filter
(
filter
,
&
input_filters
);
}
else
if
(
strcmp
(
token
,
"out"
)
==
0
)
{
}
else
if
(
strcmp
(
token
,
"out"
)
==
0
)
{
struct
filter
*
filter
;
struct
filter
*
filter
;
if
(
config_finalised
)
goto
fail
;
c
=
parse_filter
(
c
,
gnc
,
closure
,
&
filter
);
c
=
parse_filter
(
c
,
gnc
,
closure
,
&
filter
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
goto
fail
;
goto
fail
;
add_filter
(
filter
,
&
output_filters
);
add_filter
(
filter
,
&
output_filters
);
}
else
if
(
strcmp
(
token
,
"redistribute"
)
==
0
)
{
}
else
if
(
strcmp
(
token
,
"redistribute"
)
==
0
)
{
struct
filter
*
filter
;
struct
filter
*
filter
;
if
(
config_finalised
)
goto
fail
;
c
=
parse_filter
(
c
,
gnc
,
closure
,
&
filter
);
c
=
parse_filter
(
c
,
gnc
,
closure
,
&
filter
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
goto
fail
;
goto
fail
;
add_filter
(
filter
,
&
redistribute_filters
);
add_filter
(
filter
,
&
redistribute_filters
);
}
else
if
(
strcmp
(
token
,
"install"
)
==
0
)
{
}
else
if
(
strcmp
(
token
,
"install"
)
==
0
)
{
struct
filter
*
filter
;
struct
filter
*
filter
;
if
(
config_finalised
)
goto
fail
;
c
=
parse_filter
(
c
,
gnc
,
closure
,
&
filter
);
c
=
parse_filter
(
c
,
gnc
,
closure
,
&
filter
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
goto
fail
;
goto
fail
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment