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
544a453a
Commit
544a453a
authored
Jun 14, 2013
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove "option" keyword -- options need no introduction.
parent
099f28c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
124 deletions
+107
-124
babeld.man
babeld.man
+5
-13
configuration.c
configuration.c
+102
-111
No files found.
babeld.man
View file @
544a453a
...
@@ -141,19 +141,11 @@ Specify a file to write our process id to. The default is
...
@@ -141,19 +141,11 @@ Specify a file to write our process id to. The default is
The list of interfaces on which the protocol should operate.
The list of interfaces on which the protocol should operate.
.SH CONFIGURATION FILE FORMAT
.SH CONFIGURATION FILE FORMAT
The configuration file is a sequence of lines each of which specifies
The configuration file is a sequence of lines each of which specifies
either an interface or a filtering rule. Blank lines are ignored. Comments
a global option, an interface specification or a filtering
are introduced with
an octothorp
rule. Comments are introduced by
an octothorp
.RB `` # ''
.RB `` # ''
and terminate at the end of the line.
and terminate at the end of the line.
.SS Global options
.SS Global options
Global options are set by a line with the following format:
.IP
.B option
.IR value ...
.PP
where each
.I value
can be one of the following:
.TP
.TP
.BI protocol-group " group"
.BI protocol-group " group"
This specifies the link-local multicast address to be used by the
This specifies the link-local multicast address to be used by the
...
@@ -264,8 +256,8 @@ where
...
@@ -264,8 +256,8 @@ where
.I name
.I name
is the name of the interface (something like
is the name of the interface (something like
.BR eth0 ).
.BR eth0 ).
The default value
s for all interfaces can be changed by
The default value
of an interface parameter can be specified changed
a line of the form
by
a line of the form
.IP
.IP
.B default
.B default
.RI [ parameter ...]
.RI [ parameter ...]
...
@@ -273,7 +265,7 @@ a line of the form
...
@@ -273,7 +265,7 @@ a line of the form
Each
Each
.I parameter
.I parameter
specifies a parameter of the given interface. It
can be one of:
can be one of:
.TP
.TP
.BR wired " {" true | false | auto }
.BR wired " {" true | false | auto }
This specifies whether to enable optimisations specific to wired interfaces.
This specifies whether to enable optimisations specific to wired interfaces.
...
...
configuration.c
View file @
544a453a
...
@@ -567,127 +567,120 @@ add_ifconf(struct interface_conf *if_conf, struct interface_conf **if_confs)
...
@@ -567,127 +567,120 @@ add_ifconf(struct interface_conf *if_conf, struct interface_conf **if_confs)
}
}
static
int
static
int
parse_option
(
int
c
,
gnc_t
gnc
,
void
*
closure
)
parse_option
(
int
c
,
gnc_t
gnc
,
void
*
closure
,
char
*
token
)
{
{
char
*
token
;
if
(
strcmp
(
token
,
"protocol-port"
)
==
0
||
strcmp
(
token
,
"kernel-priority"
)
==
0
||
while
(
1
)
{
strcmp
(
token
,
"allow-duplicates"
)
==
0
||
c
=
skip_whitespace
(
c
,
gnc
,
closure
);
strcmp
(
token
,
"local-port"
)
==
0
||
if
(
c
<
0
||
c
==
'\n'
||
c
==
'#'
)
{
strcmp
(
token
,
"export-table"
)
==
0
||
c
=
skip_to_eol
(
c
,
gnc
,
closure
);
strcmp
(
token
,
"import-table"
)
==
0
)
{
break
;
int
v
;
}
c
=
getint
(
c
,
&
v
,
gnc
,
closure
);
c
=
getword
(
c
,
&
token
,
gnc
,
closure
);
if
(
c
<
-
1
||
v
<=
0
||
v
>=
0xFFFF
)
if
(
c
<
-
1
)
goto
error
;
goto
error
;
if
(
strcmp
(
token
,
"protocol-port"
)
==
0
||
if
(
strcmp
(
token
,
"protocol-port"
)
==
0
)
strcmp
(
token
,
"kernel-priority"
)
==
0
||
protocol_port
=
v
;
strcmp
(
token
,
"allow-duplicates"
)
==
0
||
else
if
(
strcmp
(
token
,
"kernel-priority"
)
==
0
)
strcmp
(
token
,
"local-port"
)
==
0
||
kernel_metric
=
v
;
strcmp
(
token
,
"export-table"
)
==
0
||
else
if
(
strcmp
(
token
,
"allow_duplicates"
)
==
0
)
strcmp
(
token
,
"import-table"
)
==
0
)
{
allow_duplicates
=
v
;
int
v
;
c
=
getint
(
c
,
&
v
,
gnc
,
closure
);
if
(
c
<
-
1
||
v
<=
0
||
v
>=
0xFFFF
)
goto
error
;
if
(
strcmp
(
token
,
"protocol-port"
)
==
0
)
protocol_port
=
v
;
else
if
(
strcmp
(
token
,
"kernel-priority"
)
==
0
)
kernel_metric
=
v
;
else
if
(
strcmp
(
token
,
"allow_duplicates"
)
==
0
)
allow_duplicates
=
v
;
#ifndef NO_LOCAL_INTERFACE
#ifndef NO_LOCAL_INTERFACE
else
if
(
strcmp
(
token
,
"local-port"
)
==
0
)
else
if
(
strcmp
(
token
,
"local-port"
)
==
0
)
local_server_port
=
v
;
local_server_port
=
v
;
#endif
#endif
else
if
(
strcmp
(
token
,
"export-table"
)
==
0
)
else
if
(
strcmp
(
token
,
"export-table"
)
==
0
)
export_table
=
v
;
export_table
=
v
;
else
if
(
strcmp
(
token
,
"import-table"
)
==
0
)
else
if
(
strcmp
(
token
,
"import-table"
)
==
0
)
import_table
=
v
;
import_table
=
v
;
else
else
abort
();
abort
();
}
else
if
(
strcmp
(
token
,
"keep-unfeasible"
)
==
0
||
}
else
if
(
strcmp
(
token
,
"keep-unfeasible"
)
==
0
||
strcmp
(
token
,
"link-detect"
)
==
0
||
strcmp
(
token
,
"link-detect"
)
==
0
||
strcmp
(
token
,
"daemonise"
)
==
0
)
{
strcmp
(
token
,
"daemonise"
)
==
0
)
{
int
b
;
int
b
;
c
=
getbool
(
c
,
&
b
,
gnc
,
closure
);
c
=
getbool
(
c
,
&
b
,
gnc
,
closure
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
goto
error
;
goto
error
;
b
=
(
b
==
CONFIG_YES
);
b
=
(
b
==
CONFIG_YES
);
if
(
strcmp
(
token
,
"keep-unfeasible"
)
==
0
)
if
(
strcmp
(
token
,
"keep-unfeasible"
)
==
0
)
keep_unfeasible
=
b
;
keep_unfeasible
=
b
;
else
if
(
strcmp
(
token
,
"link-detect"
)
==
0
)
else
if
(
strcmp
(
token
,
"link-detect"
)
==
0
)
link_detect
=
b
;
link_detect
=
b
;
else
if
(
strcmp
(
token
,
"daemonise"
)
==
0
)
else
if
(
strcmp
(
token
,
"daemonise"
)
==
0
)
do_daemonise
=
b
;
do_daemonise
=
b
;
else
else
abort
();
abort
();
}
else
if
(
strcmp
(
token
,
"protocol-group"
)
==
0
)
{
}
else
if
(
strcmp
(
token
,
"protocol-group"
)
==
0
)
{
unsigned
char
*
group
=
NULL
;
unsigned
char
*
group
=
NULL
;
c
=
getip
(
c
,
&
group
,
NULL
,
gnc
,
closure
);
c
=
getip
(
c
,
&
group
,
NULL
,
gnc
,
closure
);
if
(
c
<
-
1
)
goto
error
;
memcpy
(
protocol_group
,
group
,
16
);
free
(
group
);
}
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
;
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
);
if
(
d
<
0
)
goto
error
;
debug
=
d
;
}
else
if
(
strcmp
(
token
,
"diversity"
)
==
0
)
{
int
d
;
c
=
skip_whitespace
(
c
,
gnc
,
closure
);
if
(
c
>=
'0'
&&
c
<=
'9'
)
{
c
=
getint
(
c
,
&
d
,
gnc
,
closure
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
goto
error
;
goto
error
;
memcpy
(
protocol_group
,
group
,
16
);
}
else
{
free
(
group
);
int
b
;
}
else
if
(
strcmp
(
token
,
"state-file"
)
==
0
||
c
=
getbool
(
c
,
&
b
,
gnc
,
closure
);
strcmp
(
token
,
"log-file"
)
==
0
||
strcmp
(
token
,
"pid-file"
)
==
0
)
{
char
*
file
;
c
=
getstring
(
c
,
&
file
,
gnc
,
closure
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
goto
error
;
goto
error
;
if
(
strcmp
(
token
,
"state-file"
)
==
0
)
d
=
(
b
==
CONFIG_YES
)
?
3
:
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
);
if
(
d
<
0
)
goto
error
;
debug
=
d
;
}
else
if
(
strcmp
(
token
,
"diversity"
)
==
0
)
{
int
d
;
c
=
skip_whitespace
(
c
,
gnc
,
closure
);
if
(
c
>=
'0'
&&
c
<=
'9'
)
{
c
=
getint
(
c
,
&
d
,
gnc
,
closure
);
if
(
c
<
-
1
)
goto
error
;
}
else
{
int
b
;
c
=
getbool
(
c
,
&
b
,
gnc
,
closure
);
if
(
c
<
-
1
)
goto
error
;
d
=
(
b
==
CONFIG_YES
)
?
3
:
0
;
}
diversity_kind
=
d
;
}
else
if
(
strcmp
(
token
,
"diversity-factor"
)
==
0
)
{
int
f
;
c
=
getint
(
c
,
&
f
,
gnc
,
closure
);
if
(
c
<
-
1
||
f
<
0
||
f
>
256
)
goto
error
;
diversity_factor
=
f
;
}
else
if
(
strcmp
(
token
,
"smoothing-half-life"
)
==
0
)
{
int
h
;
c
=
getint
(
c
,
&
h
,
gnc
,
closure
);
if
(
c
<
-
1
||
h
<
0
)
goto
error
;
change_smoothing_half_life
(
h
);
}
else
{
goto
error
;
}
}
free
(
token
);
diversity_kind
=
d
;
}
else
if
(
strcmp
(
token
,
"diversity-factor"
)
==
0
)
{
int
f
;
c
=
getint
(
c
,
&
f
,
gnc
,
closure
);
if
(
c
<
-
1
||
f
<
0
||
f
>
256
)
goto
error
;
diversity_factor
=
f
;
}
else
if
(
strcmp
(
token
,
"smoothing-half-life"
)
==
0
)
{
int
h
;
c
=
getint
(
c
,
&
h
,
gnc
,
closure
);
if
(
c
<
-
1
||
h
<
0
)
goto
error
;
change_smoothing_half_life
(
h
);
}
else
{
goto
error
;
}
c
=
skip_whitespace
(
c
,
gnc
,
closure
);
if
(
c
<
0
||
c
==
'\n'
||
c
==
'#'
)
{
c
=
skip_to_eol
(
c
,
gnc
,
closure
);
return
1
;
}
}
return
1
;
/* Fall through */
error:
error:
return
-
1
;
return
-
1
;
}
}
static
int
static
int
...
@@ -748,13 +741,11 @@ parse_config(gnc_t gnc, void *closure)
...
@@ -748,13 +741,11 @@ parse_config(gnc_t gnc, void *closure)
if_conf
,
default_interface_conf
);
if_conf
,
default_interface_conf
);
free
(
if_conf
);
free
(
if_conf
);
}
}
}
else
if
(
strcmp
(
token
,
"option"
)
==
0
)
{
}
else
{
int
rc
;
int
rc
;
rc
=
parse_option
(
c
,
gnc
,
closure
);
rc
=
parse_option
(
c
,
gnc
,
closure
,
token
);
if
(
rc
<
0
)
if
(
rc
<
0
)
return
-
1
;
return
-
1
;
}
else
{
return
-
1
;
}
}
free
(
token
);
free
(
token
);
}
}
...
...
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