Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
labs
BIRD Internet Routing Daemon
Commits
d0e23d42
Commit
d0e23d42
authored
May 17, 2015
by
Ondřej Zajíček
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify flushing process
Related to changes from previous patch.
parent
86f567e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
31 deletions
+4
-31
nest/rt-table.c
nest/rt-table.c
+4
-31
No files found.
nest/rt-table.c
View file @
d0e23d42
...
...
@@ -1384,9 +1384,8 @@ rt_init(void)
static
int
rt_prune_step
(
rtable
*
tab
,
int
step
,
int
*
limit
)
rt_prune_step
(
rtable
*
tab
,
int
*
limit
)
{
static
struct
tbf
rl_flush
=
TBF_DEFAULT_LOG_LIMITS
;
struct
fib_iterator
*
fit
=
&
tab
->
prune_fit
;
DBG
(
"Pruning route table %s
\n
"
,
tab
->
name
);
...
...
@@ -1411,9 +1410,7 @@ again:
rescan:
for
(
e
=
n
->
routes
;
e
;
e
=
e
->
next
)
if
(
e
->
sender
->
proto
->
flushing
||
(
e
->
flags
&
REF_DISCARD
)
||
(
step
&&
e
->
attrs
->
src
->
proto
->
flushing
))
if
(
e
->
sender
->
proto
->
flushing
||
(
e
->
flags
&
REF_DISCARD
))
{
if
(
*
limit
<=
0
)
{
...
...
@@ -1421,10 +1418,6 @@ again:
return
0
;
}
if
(
step
)
log_rl
(
&
rl_flush
,
L_WARN
"Route %I/%d from %s still in %s after flush"
,
n
->
n
.
prefix
,
n
->
n
.
pxlen
,
e
->
attrs
->
src
->
proto
->
name
,
tab
->
name
);
rte_discard
(
tab
,
e
);
(
*
limit
)
--
;
...
...
@@ -1464,7 +1457,7 @@ static inline int
rt_prune_table
(
rtable
*
tab
)
{
int
limit
=
512
;
return
rt_prune_step
(
tab
,
0
,
&
limit
);
return
rt_prune_step
(
tab
,
&
limit
);
}
/**
...
...
@@ -1473,37 +1466,17 @@ rt_prune_table(rtable *tab)
* The prune loop scans routing tables and removes routes belonging to flushing
* protocols, discarded routes and also stale network entries. Returns 1 when
* all such routes are pruned. It is a part of the protocol flushing loop.
*
* The prune loop runs in two steps. In the first step it prunes just the routes
* with flushing senders (in explicitly marked tables) so the route removal is
* propagated as usual. In the second step, all remaining relevant routes are
* removed. Ideally, there shouldn't be any, but it happens when pipe filters
* are changed.
*/
int
rt_prune_loop
(
void
)
{
static
int
step
=
0
;
int
limit
=
512
;
rtable
*
t
;
again:
WALK_LIST
(
t
,
routing_tables
)
if
(
!
rt_prune_step
(
t
,
step
,
&
limit
))
if
(
!
rt_prune_step
(
t
,
&
limit
))
return
0
;
if
(
step
==
0
)
{
/* Prepare for the second step */
WALK_LIST
(
t
,
routing_tables
)
t
->
prune_state
=
RPS_SCHEDULED
;
step
=
1
;
goto
again
;
}
/* Done */
step
=
0
;
return
1
;
}
...
...
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