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
fd83431d
Commit
fd83431d
authored
Mar 11, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop routes when overflowing the route table.
parent
63178e83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
route.c
route.c
+45
-0
No files found.
route.c
View file @
fd83431d
...
...
@@ -309,6 +309,49 @@ update_network_metric(struct network *net)
}
}
/* We're overflowing the route table. Find some hopefully useless
routes and drop them. */
static
void
drop_some_routes
(
void
)
{
int
i
;
i
=
0
;
while
(
i
<
numroutes
)
{
if
(
!
routes
[
i
].
installed
&&
routes
[
i
].
time
<
now
.
tv_sec
-
90
)
{
flush_route
(
&
routes
[
i
]);
continue
;
}
if
(
routes
[
i
].
metric
>=
INFINITY
&&
routes
[
i
].
time
<
now
.
tv_sec
-
90
)
{
flush_route
(
&
routes
[
i
]);
continue
;
}
}
if
(
numroutes
<
MAXROUTES
)
return
;
/* We didn't manage to free a table entry just by dropping useless
routes. Let's take more drastic action. */
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
{
if
(
!
route_feasible
(
&
routes
[
i
]))
{
flush_route
(
&
routes
[
i
]);
return
;
}
}
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
{
if
(
!
routes
[
i
].
installed
)
{
flush_route
(
&
routes
[
i
]);
return
;
}
}
return
;
}
/* This is called whenever we receive an update. */
struct
route
*
update_route
(
const
unsigned
char
*
a
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
...
...
@@ -388,6 +431,8 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
if
(
refmetric
>=
INFINITY
)
/* Somebody's retracting a route we never saw. */
return
NULL
;
if
(
numroutes
>=
MAXROUTES
)
drop_some_routes
();
if
(
numroutes
>=
MAXROUTES
)
{
fprintf
(
stderr
,
"Too many routes -- ignoring update.
\n
"
);
return
NULL
;
...
...
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