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
3cde1704
Commit
3cde1704
authored
Mar 11, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feasible parameter to find_best_route.
parent
14eb3454
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
route.c
route.c
+4
-4
route.h
route.h
+2
-1
No files found.
route.c
View file @
3cde1704
...
@@ -242,7 +242,7 @@ update_feasible(const unsigned char *a,
...
@@ -242,7 +242,7 @@ update_feasible(const unsigned char *a,
/* This returns the feasible route with the smallest metric. */
/* This returns the feasible route with the smallest metric. */
struct
route
*
struct
route
*
find_best_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
find_best_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
int
feasible
)
{
{
struct
route
*
route
=
NULL
;
struct
route
*
route
=
NULL
;
int
i
;
int
i
;
...
@@ -252,7 +252,7 @@ find_best_route(const unsigned char *prefix, unsigned char plen)
...
@@ -252,7 +252,7 @@ find_best_route(const unsigned char *prefix, unsigned char plen)
continue
;
continue
;
if
(
routes
[
i
].
time
<
now
.
tv_sec
-
route_timeout_delay
)
if
(
routes
[
i
].
time
<
now
.
tv_sec
-
route_timeout_delay
)
continue
;
continue
;
if
(
!
route_feasible
(
&
routes
[
i
]))
if
(
feasible
&&
!
route_feasible
(
&
routes
[
i
]))
continue
;
continue
;
if
(
route
&&
route
->
metric
<=
routes
[
i
].
metric
)
if
(
route
&&
route
->
metric
<=
routes
[
i
].
metric
)
continue
;
continue
;
...
@@ -575,7 +575,7 @@ trigger_route_change(struct route *route,
...
@@ -575,7 +575,7 @@ trigger_route_change(struct route *route,
if
(
route
->
metric
>
oldmetric
)
{
if
(
route
->
metric
>
oldmetric
)
{
struct
route
*
better_route
;
struct
route
*
better_route
;
better_route
=
better_route
=
find_best_route
(
route
->
src
->
prefix
,
route
->
src
->
plen
);
find_best_route
(
route
->
src
->
prefix
,
route
->
src
->
plen
,
1
);
if
(
better_route
&&
better_route
->
metric
<=
route
->
metric
-
96
)
if
(
better_route
&&
better_route
->
metric
<=
route
->
metric
-
96
)
consider_route
(
better_route
);
consider_route
(
better_route
);
}
}
...
@@ -593,7 +593,7 @@ void
...
@@ -593,7 +593,7 @@ void
route_lost
(
struct
source
*
src
,
int
oldmetric
)
route_lost
(
struct
source
*
src
,
int
oldmetric
)
{
{
struct
route
*
new_route
;
struct
route
*
new_route
;
new_route
=
find_best_route
(
src
->
prefix
,
src
->
plen
);
new_route
=
find_best_route
(
src
->
prefix
,
src
->
plen
,
1
);
if
(
new_route
)
{
if
(
new_route
)
{
consider_route
(
new_route
);
consider_route
(
new_route
);
}
else
{
}
else
{
...
...
route.h
View file @
3cde1704
...
@@ -53,7 +53,8 @@ int route_feasible(struct route *route);
...
@@ -53,7 +53,8 @@ int route_feasible(struct route *route);
int
update_feasible
(
const
unsigned
char
*
a
,
int
update_feasible
(
const
unsigned
char
*
a
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
refmetric
);
unsigned
short
seqno
,
unsigned
short
refmetric
);
struct
route
*
find_best_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
struct
route
*
find_best_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
int
feasible
);
struct
route
*
install_best_route
(
const
unsigned
char
prefix
[
16
],
struct
route
*
install_best_route
(
const
unsigned
char
prefix
[
16
],
unsigned
char
plen
);
unsigned
char
plen
);
void
update_neighbour_metric
(
struct
neighbour
*
neigh
);
void
update_neighbour_metric
(
struct
neighbour
*
neigh
);
...
...
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