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
1d8a3cce
Commit
1d8a3cce
authored
May 29, 2013
by
Toke Høiland-Jørgensen
Committed by
Juliusz Chroboczek
Jun 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to get routes from multiple kernel tables.
parent
1fbd6fe7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
12 deletions
+30
-12
babeld.c
babeld.c
+1
-2
babeld.man
babeld.man
+3
-1
kernel.c
kernel.c
+8
-0
kernel.h
kernel.h
+7
-1
kernel_netlink.c
kernel_netlink.c
+8
-7
kernel_socket.c
kernel_socket.c
+3
-1
No files found.
babeld.c
View file @
1d8a3cce
...
...
@@ -226,8 +226,7 @@ main(int argc, char **argv)
goto
usage
;
break
;
case
'T'
:
import_table
=
parse_nat
(
optarg
);
if
(
import_table
<
0
||
import_table
>
0xFFFF
)
if
(
add_import_table
(
parse_nat
(
optarg
)))
goto
usage
;
break
;
case
'c'
:
...
...
babeld.man
View file @
1d8a3cce
...
...
@@ -115,7 +115,9 @@ Use the given kernel routing table for routes inserted by
.BR babeld .
.TP
.BI \-T " table"
Export routes from the given kernel routing table.
Export routes from the given kernel routing table. This can be
specified multiple times in order to export routes from more than one
table.
.TP
.BI \-c " filename"
Specify the name of the configuration file. The default is
...
...
kernel.c
View file @
1d8a3cce
...
...
@@ -98,3 +98,11 @@ read_random_bytes(void *buf, size_t len)
return
rc
;
}
int
add_import_table
(
int
table
)
{
if
(
table
<
0
||
table
>
0xFFFF
)
return
-
1
;
if
(
import_table_count
>
MAX_IMPORT_TABLES
-
1
)
return
-
2
;
import_tables
[
import_table_count
++
]
=
table
;
return
0
;
}
kernel.h
View file @
1d8a3cce
...
...
@@ -42,7 +42,13 @@ struct kernel_route {
#define CHANGE_ROUTE (1 << 1)
#define CHANGE_ADDR (1 << 2)
extern
int
export_table
,
import_table
;
#ifndef MAX_IMPORT_TABLES
#define MAX_IMPORT_TABLES 10
#endif
extern
int
export_table
,
import_tables
[
MAX_IMPORT_TABLES
],
import_table_count
;
int
add_import_table
(
int
table
);
int
kernel_setup
(
int
setup
);
int
kernel_setup_socket
(
int
setup
);
...
...
kernel_netlink.c
View file @
1d8a3cce
...
...
@@ -51,7 +51,7 @@ THE SOFTWARE.
#include "util.h"
#include "interface.h"
int
export_table
=
-
1
,
import_table
=
-
1
;
int
export_table
=
-
1
,
import_table
s
[
MAX_IMPORT_TABLES
],
import_table_count
=
0
;
static
int
old_forwarding
=
-
1
;
static
int
old_ipv4_forwarding
=
-
1
;
...
...
@@ -468,8 +468,8 @@ kernel_setup(int setup)
if
(
export_table
<
0
)
export_table
=
RT_TABLE_MAIN
;
if
(
import_table
<
0
)
import_table
=
RT_TABLE_MAIN
;
if
(
import_table
_count
<
1
)
import_table
s
[
import_table_count
++
]
=
RT_TABLE_MAIN
;
dgram_socket
=
socket
(
PF_INET
,
SOCK_DGRAM
,
0
);
if
(
dgram_socket
<
0
)
...
...
@@ -1037,10 +1037,11 @@ parse_kernel_route_rta(struct rtmsg *rtm, int len, struct kernel_route *route)
}
#undef COPY_ADDR
if
(
table
!=
import_table
)
return
-
1
;
return
0
;
int
i
;
for
(
i
=
0
;
i
<
import_table_count
;
i
++
)
if
(
table
==
import_tables
[
i
])
return
0
;
return
-
1
;
}
static
void
...
...
kernel_socket.c
View file @
1d8a3cce
...
...
@@ -57,7 +57,7 @@ static int get_sdl(struct sockaddr_dl *sdl, char *ifname);
static
const
unsigned
char
v4prefix
[
16
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xFF
,
0xFF
,
0
,
0
,
0
,
0
};
int
export_table
=
-
1
,
import_table
=
-
1
;
int
export_table
=
-
1
,
import_table
_count
=
0
,
import_tables
[
MAX_IMPORT_TABLES
]
;
int
if_eui64
(
char
*
ifname
,
int
ifindex
,
unsigned
char
*
eui
)
...
...
@@ -835,6 +835,8 @@ kernel_callback(int (*fn)(int, void*), void *closure)
}
int
add_import_table
(
int
table
)
{
return
0
;
}
// not used
/* Local Variables: */
/* c-basic-offset: 4 */
/* indent-tabs-mode: nil */
...
...
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