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
e7aad3be
Commit
e7aad3be
authored
May 19, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow resizing routes on table overflow.
parent
702d05ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
53 deletions
+14
-53
babel.h
babel.h
+0
-1
route.c
route.c
+12
-50
route.h
route.h
+2
-2
No files found.
babel.h
View file @
e7aad3be
...
...
@@ -20,7 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#define MAXROUTES 512
#define MAXSRCS 256
#define MAXNEIGHBOURS 64
...
...
route.c
View file @
e7aad3be
...
...
@@ -38,8 +38,8 @@ THE SOFTWARE.
#include "resend.h"
#include "filter.h"
struct
route
routes
[
MAXROUTES
]
;
int
numroutes
=
0
;
struct
route
*
routes
=
NULL
;
int
numroutes
=
0
,
maxroutes
=
0
;
int
kernel_metric
=
0
;
int
route_timeout_delay
=
160
;
int
route_gc_delay
=
180
;
...
...
@@ -317,49 +317,6 @@ 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
,
...
...
@@ -440,11 +397,16 @@ 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
;
if
(
numroutes
>=
maxroutes
)
{
struct
route
*
new_routes
;
int
n
=
maxroutes
<
1
?
8
:
2
*
maxroutes
;
new_routes
=
routes
==
NULL
?
malloc
(
n
*
sizeof
(
struct
route
))
:
realloc
(
routes
,
n
*
sizeof
(
struct
route
));
if
(
new_routes
==
NULL
)
return
NULL
;
maxroutes
=
n
;
routes
=
new_routes
;
}
route
=
&
routes
[
numroutes
];
route
->
src
=
src
;
...
...
route.h
View file @
e7aad3be
...
...
@@ -31,8 +31,8 @@ struct route {
int
installed
;
};
extern
struct
route
routes
[
MAXROUTES
]
;
extern
int
numroutes
;
extern
struct
route
*
routes
;
extern
int
numroutes
,
maxroutes
;
extern
int
kernel_metric
;
extern
int
route_timeout_delay
;
extern
int
route_gc_delay
;
...
...
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