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
449c8d59
Commit
449c8d59
authored
Sep 24, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove support for forced xroutes.
Significantly simplifies the xroute logic.
parent
f915c7a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
39 deletions
+21
-39
babel.c
babel.c
+2
-3
xroute.c
xroute.c
+18
-31
xroute.h
xroute.h
+1
-5
No files found.
babel.c
View file @
449c8d59
...
@@ -968,10 +968,9 @@ dump_tables(FILE *out)
...
@@ -968,10 +968,9 @@ dump_tables(FILE *out)
neigh
->
network
->
up
?
""
:
" (down)"
);
neigh
->
network
->
up
?
""
:
" (down)"
);
}
}
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
{
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
{
fprintf
(
out
,
"%s metric %d (
%s
)
\n
"
,
fprintf
(
out
,
"%s metric %d (
exported
)
\n
"
,
format_prefix
(
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
),
format_prefix
(
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
),
xroutes
[
i
].
metric
,
xroutes
[
i
].
metric
);
xroutes
[
i
].
kind
==
XROUTE_FORCED
?
"forced"
:
"exported"
);
}
}
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
{
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
{
int
id
=
int
id
=
...
...
xroute.c
View file @
449c8d59
...
@@ -85,18 +85,11 @@ flush_xroute(struct xroute *xroute)
...
@@ -85,18 +85,11 @@ flush_xroute(struct xroute *xroute)
}
}
int
int
add_xroute
(
int
kind
,
unsigned
char
prefix
[
16
],
unsigned
char
plen
,
add_xroute
(
unsigned
char
prefix
[
16
],
unsigned
char
plen
,
unsigned
short
metric
,
unsigned
int
ifindex
,
int
proto
)
unsigned
short
metric
,
unsigned
int
ifindex
,
int
proto
)
{
{
struct
xroute
*
xroute
=
find_xroute
(
prefix
,
plen
);
struct
xroute
*
xroute
=
find_xroute
(
prefix
,
plen
);
if
(
xroute
)
{
if
(
xroute
)
{
if
(
xroute
->
kind
<
kind
)
return
0
;
else
if
(
xroute
->
kind
>
kind
)
{
flush_xroute
(
xroute
);
return
add_xroute
(
kind
,
prefix
,
plen
,
metric
,
ifindex
,
proto
);
}
if
(
xroute
->
metric
<=
metric
)
if
(
xroute
->
metric
<=
metric
)
return
0
;
return
0
;
xroute
->
metric
=
metric
;
xroute
->
metric
=
metric
;
...
@@ -116,7 +109,6 @@ add_xroute(int kind, unsigned char prefix[16], unsigned char plen,
...
@@ -116,7 +109,6 @@ add_xroute(int kind, unsigned char prefix[16], unsigned char plen,
xroutes
=
new_xroutes
;
xroutes
=
new_xroutes
;
}
}
xroutes
[
numxroutes
].
kind
=
kind
;
memcpy
(
xroutes
[
numxroutes
].
prefix
,
prefix
,
16
);
memcpy
(
xroutes
[
numxroutes
].
prefix
,
prefix
,
16
);
xroutes
[
numxroutes
].
plen
=
plen
;
xroutes
[
numxroutes
].
plen
=
plen
;
xroutes
[
numxroutes
].
metric
=
metric
;
xroutes
[
numxroutes
].
metric
=
metric
;
...
@@ -168,26 +160,22 @@ check_xroutes(int send_updates)
...
@@ -168,26 +160,22 @@ check_xroutes(int send_updates)
i
=
0
;
i
=
0
;
while
(
i
<
numxroutes
)
{
while
(
i
<
numxroutes
)
{
export
=
0
;
export
=
0
;
if
(
xroutes
[
i
].
kind
==
XROUTE_FORCED
)
{
metric
=
redistribute_filter
(
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
,
export
=
1
;
xroutes
[
i
].
ifindex
,
xroutes
[
i
].
proto
);
}
else
if
(
xroutes
[
i
].
kind
==
XROUTE_REDISTRIBUTED
)
{
if
((
metric
<
INFINITY
&&
metric
==
xroutes
[
i
].
metric
)
||
metric
=
redistribute_filter
(
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
,
metric
==
METRIC_INHERIT
)
{
xroutes
[
i
].
ifindex
,
xroutes
[
i
].
proto
);
for
(
j
=
0
;
j
<
numroutes
;
j
++
)
{
if
((
metric
<
INFINITY
&&
metric
==
xroutes
[
i
].
metric
)
||
if
(
xroutes
[
i
].
plen
==
routes
[
j
].
plen
&&
metric
==
METRIC_INHERIT
)
{
memcmp
(
xroutes
[
i
].
prefix
,
routes
[
j
].
prefix
,
16
)
==
0
&&
for
(
j
=
0
;
j
<
numroutes
;
j
++
)
{
xroutes
[
i
].
ifindex
==
routes
[
j
].
ifindex
&&
if
(
xroutes
[
i
].
plen
==
routes
[
j
].
plen
&&
xroutes
[
i
].
proto
==
routes
[
j
].
proto
)
{
memcmp
(
xroutes
[
i
].
prefix
,
routes
[
j
].
prefix
,
16
)
==
0
&&
if
(
metric
<
INFINITY
)
{
xroutes
[
i
].
ifindex
==
routes
[
j
].
ifindex
&&
export
=
1
;
xroutes
[
i
].
proto
==
routes
[
j
].
proto
)
{
break
;
if
(
metric
<
INFINITY
)
{
}
else
if
(
metric
==
METRIC_INHERIT
&&
export
=
1
;
xroutes
[
i
].
metric
==
routes
[
j
].
metric
*
256
)
{
break
;
export
=
1
;
}
else
if
(
metric
==
METRIC_INHERIT
&&
break
;
xroutes
[
i
].
metric
==
routes
[
j
].
metric
*
256
)
{
export
=
1
;
break
;
}
}
}
}
}
}
}
...
@@ -222,8 +210,7 @@ check_xroutes(int send_updates)
...
@@ -222,8 +210,7 @@ check_xroutes(int send_updates)
if
(
metric
==
METRIC_INHERIT
)
if
(
metric
==
METRIC_INHERIT
)
metric
=
routes
[
i
].
metric
*
256
;
metric
=
routes
[
i
].
metric
*
256
;
if
(
metric
<
INFINITY
)
{
if
(
metric
<
INFINITY
)
{
rc
=
add_xroute
(
XROUTE_REDISTRIBUTED
,
rc
=
add_xroute
(
routes
[
i
].
prefix
,
routes
[
i
].
plen
,
routes
[
i
].
prefix
,
routes
[
i
].
plen
,
metric
,
routes
[
i
].
ifindex
,
routes
[
i
].
proto
);
metric
,
routes
[
i
].
ifindex
,
routes
[
i
].
proto
);
if
(
rc
)
{
if
(
rc
)
{
struct
route
*
route
;
struct
route
*
route
;
...
...
xroute.h
View file @
449c8d59
...
@@ -22,13 +22,9 @@ THE SOFTWARE.
...
@@ -22,13 +22,9 @@ THE SOFTWARE.
/* These should come in decreasing order of priority. */
/* These should come in decreasing order of priority. */
#define XROUTE_FORCED 1
#define XROUTE_REDISTRIBUTED 2
struct
xroute
{
struct
xroute
{
unsigned
char
prefix
[
16
];
unsigned
char
prefix
[
16
];
unsigned
char
plen
;
unsigned
char
plen
;
char
kind
;
unsigned
short
metric
;
unsigned
short
metric
;
unsigned
int
ifindex
;
unsigned
int
ifindex
;
int
proto
;
int
proto
;
...
@@ -39,6 +35,6 @@ extern int numxroutes;
...
@@ -39,6 +35,6 @@ extern int numxroutes;
struct
xroute
*
find_xroute
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
struct
xroute
*
find_xroute
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
void
flush_xroute
(
struct
xroute
*
xroute
);
void
flush_xroute
(
struct
xroute
*
xroute
);
int
add_xroute
(
int
kind
,
unsigned
char
prefix
[
16
],
unsigned
char
plen
,
int
add_xroute
(
unsigned
char
prefix
[
16
],
unsigned
char
plen
,
unsigned
short
metric
,
unsigned
int
ifindex
,
int
proto
);
unsigned
short
metric
,
unsigned
int
ifindex
,
int
proto
);
int
check_xroutes
(
int
send_updates
);
int
check_xroutes
(
int
send_updates
);
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