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
46dd09f4
Commit
46dd09f4
authored
May 28, 2013
by
Matthieu Boutier
Committed by
Juliusz Chroboczek
Jul 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add options to control the table and priority numbers.
parent
0673b965
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
10 deletions
+32
-10
babeld.man
babeld.man
+8
-0
configuration.c
configuration.c
+12
-0
kernel.c
kernel.c
+3
-0
kernel.h
kernel.h
+3
-0
kernel_netlink.c
kernel_netlink.c
+6
-10
No files found.
babeld.man
View file @
46dd09f4
...
...
@@ -253,6 +253,14 @@ 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 .
.TP
.BI first-table-number " table"
This specifies the index of the first routing table to use for
source-specific routes. The default is 10.
.TP
.BI first-rule-priority " priority"
This specifies smallest (highest) rule priority used with source-specific
routes. The default is 100.
.SS Interface configuration
An interface is configured by a line with the following format:
.IP
...
...
configuration.c
View file @
46dd09f4
...
...
@@ -713,6 +713,18 @@ parse_option(int c, gnc_t gnc, void *closure, char *token)
if
(
c
<
-
1
||
h
<
0
)
goto
error
;
change_smoothing_half_life
(
h
);
}
else
if
(
strcmp
(
token
,
"first-table-number"
)
==
0
)
{
int
n
;
c
=
getint
(
c
,
&
n
,
gnc
,
closure
);
if
(
c
<
-
1
||
n
<=
0
||
n
+
SRC_TABLE_NUM
>=
254
)
goto
error
;
src_table_idx
=
n
;
}
else
if
(
strcmp
(
token
,
"first-rule-priority"
)
==
0
)
{
int
n
;
c
=
getint
(
c
,
&
n
,
gnc
,
closure
);
if
(
c
<
-
1
||
n
<=
0
||
n
+
SRC_TABLE_NUM
>=
32765
)
goto
error
;
src_table_prio
=
n
;
}
else
{
goto
error
;
}
...
...
kernel.c
View file @
46dd09f4
...
...
@@ -32,6 +32,9 @@ THE SOFTWARE.
#include "kernel_socket.c"
#endif
int
src_table_idx
=
10
;
int
src_table_prio
=
100
;
/* Like gettimeofday, but returns monotonic time. If POSIX clocks are not
available, falls back to gettimeofday but enforces monotonicity. */
int
...
...
kernel.h
View file @
46dd09f4
...
...
@@ -51,6 +51,9 @@ struct kernel_route {
extern
int
export_table
,
import_tables
[
MAX_IMPORT_TABLES
],
import_table_count
;
int
add_import_table
(
int
table
);
#define SRC_TABLE_NUM 10
extern
int
src_table_idx
;
/* number of the first table */
extern
int
src_table_prio
;
/* first prio range */
int
kernel_setup
(
int
setup
);
int
kernel_setup_socket
(
int
setup
);
...
...
kernel_netlink.c
View file @
46dd09f4
...
...
@@ -1651,10 +1651,6 @@ flush_rule(int prio, int family)
/* Source specific functions and data structures */
#define SRC_TABLE_IDX 10
/* number of the first table */
#define SRC_TABLE_NUM 10
#define SRC_TABLE_PRIO 110
/* first prio range */
/* The table used for non-specific routes is "export_table", therefore, we can
take the convention of plen == 0 <=> empty table. */
struct
kernel_table
{
...
...
@@ -1708,7 +1704,7 @@ insert_table(const unsigned char *src, unsigned short src_plen, int idx)
for
(
table
=
0
;
table
<
SRC_TABLE_NUM
;
table
++
)
if
(
!
used_tables
[
table
])
break
;
table
+=
SRC_TABLE_IDX
;
table
+=
src_table_idx
;
/* Create the table's rule at the right place. Shift rules if necessary. */
if
(
kernel_tables
[
idx
].
plen
!=
0
)
{
...
...
@@ -1719,8 +1715,8 @@ insert_table(const unsigned char *src, unsigned short src_plen, int idx)
rc
=
change_table_priority
(
kernel_tables
[
i
].
src
,
kernel_tables
[
i
].
plen
,
kernel_tables
[
i
].
table
,
i
+
SRC_TABLE_PRIO
,
i
+
1
+
SRC_TABLE_PRIO
);
i
+
src_table_prio
,
i
+
1
+
src_table_prio
);
if
(
rc
<
0
)
{
perror
(
"change_table_priority"
);
return
NULL
;
...
...
@@ -1730,12 +1726,12 @@ insert_table(const unsigned char *src, unsigned short src_plen, int idx)
}
}
rc
=
add_rule
(
idx
+
SRC_TABLE_PRIO
,
src
,
src_plen
,
table
);
rc
=
add_rule
(
idx
+
src_table_prio
,
src
,
src_plen
,
table
);
if
(
rc
<
0
)
{
perror
(
"add rule"
);
return
NULL
;
}
used_tables
[
table
-
SRC_TABLE_IDX
]
=
1
;
used_tables
[
table
-
src_table_idx
]
=
1
;
memcpy
(
kernel_tables
[
idx
].
src
,
src
,
16
);
kernel_tables
[
idx
].
plen
=
src_plen
;
kernel_tables
[
idx
].
table
=
table
;
...
...
@@ -1802,7 +1798,7 @@ release_tables(void)
int
i
;
for
(
i
=
0
;
i
<
SRC_TABLE_NUM
;
i
++
)
{
if
(
kernel_tables
[
i
].
plen
!=
0
)
{
flush_rule
(
i
+
SRC_TABLE_PRIO
,
flush_rule
(
i
+
src_table_prio
,
v4mapped
(
kernel_tables
[
i
].
src
)
?
AF_INET
:
AF_INET6
);
kernel_tables
[
i
].
plen
=
0
;
}
...
...
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