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
6d768ba4
Commit
6d768ba4
authored
Jun 04, 2015
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate testing for ipv6_subtrees within a function.
parent
36f056a0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
6 deletions
+21
-6
disambiguation.c
disambiguation.c
+4
-4
kernel.h
kernel.h
+1
-0
kernel_netlink.c
kernel_netlink.c
+10
-2
kernel_socket.c
kernel_socket.c
+6
-0
No files found.
disambiguation.c
View file @
6d768ba4
...
@@ -266,7 +266,7 @@ kinstall_route(const struct babel_route *route)
...
@@ -266,7 +266,7 @@ kinstall_route(const struct babel_route *route)
format_prefix
(
route
->
src
->
prefix
,
route
->
src
->
plen
),
format_prefix
(
route
->
src
->
prefix
,
route
->
src
->
plen
),
format_prefix
(
route
->
src
->
src_prefix
,
route
->
src
->
src_plen
));
format_prefix
(
route
->
src
->
src_prefix
,
route
->
src
->
src_plen
));
/* Install source-specific conflicting routes */
/* Install source-specific conflicting routes */
if
(
!
has_ipv6_subtrees
||
v4
)
{
if
(
!
kernel_disambiguate
(
v4
)
)
{
stream
=
route_stream
(
1
);
stream
=
route_stream
(
1
);
if
(
!
stream
)
{
if
(
!
stream
)
{
fprintf
(
stderr
,
"Couldn't allocate route stream.
\n
"
);
fprintf
(
stderr
,
"Couldn't allocate route stream.
\n
"
);
...
@@ -330,7 +330,7 @@ kuninstall_route(const struct babel_route *route)
...
@@ -330,7 +330,7 @@ kuninstall_route(const struct babel_route *route)
perror
(
"kernel_route(FLUSH)"
);
perror
(
"kernel_route(FLUSH)"
);
/* Remove source-specific conflicting routes */
/* Remove source-specific conflicting routes */
if
(
!
has_ipv6_subtrees
||
v4
)
{
if
(
!
kernel_disambiguate
(
v4
)
)
{
stream
=
route_stream
(
1
);
stream
=
route_stream
(
1
);
if
(
!
stream
)
{
if
(
!
stream
)
{
fprintf
(
stderr
,
"Couldn't allocate route stream.
\n
"
);
fprintf
(
stderr
,
"Couldn't allocate route stream.
\n
"
);
...
@@ -376,7 +376,7 @@ kswitch_routes(const struct babel_route *old, const struct babel_route *new)
...
@@ -376,7 +376,7 @@ kswitch_routes(const struct babel_route *old, const struct babel_route *new)
}
}
/* Remove source-specific conflicting routes */
/* Remove source-specific conflicting routes */
if
(
!
has_ipv6_subtrees
||
v4mapped
(
old
->
nexthop
))
{
if
(
!
kernel_disambiguate
(
v4mapped
(
old
->
nexthop
)
))
{
stream
=
route_stream
(
1
);
stream
=
route_stream
(
1
);
if
(
!
stream
)
{
if
(
!
stream
)
{
fprintf
(
stderr
,
"Couldn't allocate route stream.
\n
"
);
fprintf
(
stderr
,
"Couldn't allocate route stream.
\n
"
);
...
@@ -423,7 +423,7 @@ kchange_route_metric(const struct babel_route *route,
...
@@ -423,7 +423,7 @@ kchange_route_metric(const struct babel_route *route,
return
-
1
;
return
-
1
;
}
}
if
(
!
has_ipv6_subtrees
||
v4mapped
(
route
->
nexthop
))
{
if
(
!
kernel_disambiguate
(
v4mapped
(
route
->
nexthop
)
))
{
stream
=
route_stream
(
1
);
stream
=
route_stream
(
1
);
if
(
!
stream
)
{
if
(
!
stream
)
{
fprintf
(
stderr
,
"Couldn't allocate route stream.
\n
"
);
fprintf
(
stderr
,
"Couldn't allocate route stream.
\n
"
);
...
...
kernel.h
View file @
6d768ba4
...
@@ -65,6 +65,7 @@ int kernel_interface_ipv4(const char *ifname, int ifindex,
...
@@ -65,6 +65,7 @@ int kernel_interface_ipv4(const char *ifname, int ifindex,
int
kernel_interface_mtu
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_interface_mtu
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_interface_wireless
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_interface_wireless
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_interface_channel
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_interface_channel
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_disambiguate
(
int
v4
);
int
kernel_route
(
int
operation
,
const
unsigned
char
*
dest
,
unsigned
short
plen
,
int
kernel_route
(
int
operation
,
const
unsigned
char
*
dest
,
unsigned
short
plen
,
const
unsigned
char
*
src
,
unsigned
short
src_plen
,
const
unsigned
char
*
src
,
unsigned
short
src_plen
,
const
unsigned
char
*
gate
,
int
ifindex
,
unsigned
int
metric
,
const
unsigned
char
*
gate
,
int
ifindex
,
unsigned
int
metric
,
...
...
kernel_netlink.c
View file @
6d768ba4
...
@@ -917,6 +917,14 @@ kernel_interface_channel(const char *ifname, int ifindex)
...
@@ -917,6 +917,14 @@ kernel_interface_channel(const char *ifname, int ifindex)
return
-
1
;
return
-
1
;
}
}
/* Return true if we cannot handle disambiguation ourselves. */
int
kernel_disambiguate
(
int
v4
)
{
return
!
v4
&&
has_ipv6_subtrees
;
}
int
int
kernel_route
(
int
operation
,
const
unsigned
char
*
dest
,
unsigned
short
plen
,
kernel_route
(
int
operation
,
const
unsigned
char
*
dest
,
unsigned
short
plen
,
const
unsigned
char
*
src
,
unsigned
short
src_plen
,
const
unsigned
char
*
src
,
unsigned
short
src_plen
,
...
@@ -994,7 +1002,7 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
...
@@ -994,7 +1002,7 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
if
(
src_plen
==
0
)
{
if
(
src_plen
==
0
)
{
table
=
export_table
;
table
=
export_table
;
}
else
if
(
has_ipv6_subtrees
&&
!
ipv4
)
{
}
else
if
(
kernel_disambiguate
(
ipv4
)
)
{
table
=
export_table
;
table
=
export_table
;
use_src
=
1
;
use_src
=
1
;
}
else
{
}
else
{
...
@@ -1841,7 +1849,7 @@ find_table(const unsigned char *src, unsigned short src_plen)
...
@@ -1841,7 +1849,7 @@ find_table(const unsigned char *src, unsigned short src_plen)
int
i
,
new_i
;
int
i
,
new_i
;
if
(
src_plen
==
0
||
if
(
src_plen
==
0
||
(
has_ipv6_subtrees
&&
(
src_plen
<
96
||
!
v4mapped
(
src
))))
{
(
kernel_disambiguate
(
src_plen
>=
96
&&
v4mapped
(
src
))))
{
fprintf
(
stderr
,
"Find_table called for route handled by kernel "
fprintf
(
stderr
,
"Find_table called for route handled by kernel "
"(this shouldn't happen)."
);
"(this shouldn't happen)."
);
return
-
1
;
return
-
1
;
...
...
kernel_socket.c
View file @
6d768ba4
...
@@ -382,6 +382,12 @@ kernel_interface_channel(const char *ifname, int ifindex)
...
@@ -382,6 +382,12 @@ kernel_interface_channel(const char *ifname, int ifindex)
return
-
1
;
return
-
1
;
}
}
int
kernel_disambiguate
(
int
v4
)
{
return
0
;
}
int
int
kernel_route
(
int
operation
,
const
unsigned
char
*
dest
,
unsigned
short
plen
,
kernel_route
(
int
operation
,
const
unsigned
char
*
dest
,
unsigned
short
plen
,
const
unsigned
char
*
src
,
unsigned
short
src_plen
,
const
unsigned
char
*
src
,
unsigned
short
src_plen
,
...
...
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