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
75ceb38e
Commit
75ceb38e
authored
Feb 07, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement -t and -T.
parent
6898efa1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
3 deletions
+27
-3
babel.c
babel.c
+13
-1
kernel.h
kernel.h
+2
-0
kernel_netlink.c
kernel_netlink.c
+10
-2
kernel_socket.c
kernel_socket.c
+2
-0
No files found.
babel.c
View file @
75ceb38e
...
...
@@ -193,6 +193,16 @@ main(int argc, char **argv)
link_detect
=
1
;
}
else
if
(
strcmp
(
*
arg
,
"-w"
)
==
0
)
{
all_wireless
=
1
;
}
else
if
(
strcmp
(
*
arg
,
"-t"
)
==
0
)
{
SHIFTE
();
export_table
=
atoi
(
*
arg
);
if
(
export_table
<
0
||
export_table
>
0xFFFF
)
goto
syntax
;
}
else
if
(
strcmp
(
*
arg
,
"-T"
)
==
0
)
{
SHIFTE
();
import_table
=
atoi
(
*
arg
);
if
(
import_table
<
0
||
import_table
>
0xFFFF
)
goto
syntax
;
}
else
{
goto
syntax
;
}
...
...
@@ -626,7 +636,9 @@ main(int argc, char **argv)
" "
"[-u update] [-k metric] [-4] [-s] [-P] [-c cost] [-l] [-w]
\n
"
" "
"[-d level] [-x net cost] [-X net cost]... id interface...
\n
"
,
"[-d level] [-t table] [-T table] [-x net cost] [-X net cost]
\n
"
" "
"id interface...
\n
"
,
argv
[
0
]);
exit
(
1
);
...
...
kernel.h
View file @
75ceb38e
...
...
@@ -34,6 +34,8 @@ struct kernel_route {
#define ROUTE_ADD 1
#define ROUTE_MODIFY 2
extern
int
export_table
,
import_table
;
int
kernel_setup
(
int
setup
,
int
ipv4
);
int
kernel_setup_socket
(
int
setup
);
int
kernel_setup_interface
(
int
setup
,
const
char
*
ifname
,
int
ifindex
);
...
...
kernel_netlink.c
View file @
75ceb38e
...
...
@@ -48,6 +48,8 @@ THE SOFTWARE.
#include "kernel.h"
#include "util.h"
int
export_table
=
-
1
,
import_table
=
-
1
;
static
int
old_forwarding
=
-
1
;
static
int
old_ipv4_forwarding
=
-
1
;
static
int
old_accept_redirects
=
-
1
;
...
...
@@ -391,6 +393,12 @@ kernel_setup(int setup, int ipv4)
int
rc
;
if
(
setup
)
{
if
(
export_table
<
0
)
export_table
=
RT_TABLE_MAIN
;
if
(
import_table
<
0
)
import_table
=
RT_TABLE_MAIN
;
dgram_socket
=
socket
(
PF_INET
,
SOCK_DGRAM
,
0
);
if
(
dgram_socket
<
0
)
return
-
1
;
...
...
@@ -697,7 +705,7 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
rtm
=
NLMSG_DATA
(
&
buf
.
nh
);
rtm
->
rtm_family
=
ipv4
?
AF_INET
:
AF_INET6
;
rtm
->
rtm_dst_len
=
ipv4
?
plen
-
96
:
plen
;
rtm
->
rtm_table
=
RT_TABLE_MAIN
;
rtm
->
rtm_table
=
export_table
;
rtm
->
rtm_scope
=
RT_SCOPE_UNIVERSE
;
if
(
metric
<
KERNEL_INFINITY
)
rtm
->
rtm_type
=
RTN_UNICAST
;
...
...
@@ -800,7 +808,7 @@ parse_kernel_route_rta(struct rtmsg *rtm, int len, struct kernel_route *route)
}
#undef COPY_ADDR
if
(
table
!=
RT_TABLE_MAIN
)
if
(
table
!=
import_table
)
return
-
1
;
return
0
;
...
...
kernel_socket.c
View file @
75ceb38e
...
...
@@ -45,6 +45,8 @@ THE SOFTWARE.
#include "kernel.h"
#include "util.h"
int
export_table
=
-
1
,
import_table
=
-
1
;
/* KAME said : "Following two macros are highly depending on KAME Release" */
#define IN6_LINKLOCAL_IFINDEX(a) ((a).s6_addr[2] << 8 | (a).s6_addr[3])
#define SET_IN6_LINKLOCAL_IFINDEX(a, i) \
...
...
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