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
33d41c95
Commit
33d41c95
authored
May 02, 2010
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute new metrics in change_route_metric itself.
parent
16c818b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
route.c
route.c
+7
-12
No files found.
route.c
View file @
33d41c95
...
@@ -235,9 +235,10 @@ switch_routes(struct route *old, struct route *new)
...
@@ -235,9 +235,10 @@ switch_routes(struct route *old, struct route *new)
}
}
static
void
static
void
change_route_metric
(
struct
route
*
route
,
unsigned
newmetric
)
change_route_metric
(
struct
route
*
route
,
unsigned
cost
,
unsigned
add
)
{
{
int
old
,
new
;
int
old
,
new
;
int
newmetric
=
MIN
(
route
->
refmetric
+
cost
+
add
,
INFINITY
);
if
(
route_metric
(
route
)
==
newmetric
)
if
(
route_metric
(
route
)
==
newmetric
)
return
;
return
;
...
@@ -266,7 +267,7 @@ static void
...
@@ -266,7 +267,7 @@ static void
retract_route
(
struct
route
*
route
)
retract_route
(
struct
route
*
route
)
{
{
route
->
refmetric
=
INFINITY
;
route
->
refmetric
=
INFINITY
;
change_route_metric
(
route
,
INFINITY
);
change_route_metric
(
route
,
INFINITY
,
0
);
}
}
int
int
...
@@ -348,16 +349,11 @@ update_route_metric(struct route *route)
...
@@ -348,16 +349,11 @@ update_route_metric(struct route *route)
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
neigh
->
address
,
neigh
->
address
,
neigh
->
network
->
ifindex
);
neigh
->
network
->
ifindex
);
int
newmetric
=
MIN
(
route
->
refmetric
+
change_route_metric
(
route
,
add_metric
+
neighbour_cost
(
route
->
neigh
),
add_metric
);
neighbour_cost
(
route
->
neigh
),
if
(
route_metric
(
route
)
!=
oldmetric
)
INFINITY
);
if
(
newmetric
!=
oldmetric
)
{
change_route_metric
(
route
,
newmetric
);
route_changed
(
route
,
route
->
src
,
oldmetric
);
route_changed
(
route
,
route
->
src
,
oldmetric
);
}
}
}
}
}
void
void
...
@@ -420,7 +416,6 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
...
@@ -420,7 +416,6 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
feasible
=
update_feasible
(
src
,
seqno
,
refmetric
);
feasible
=
update_feasible
(
src
,
seqno
,
refmetric
);
route
=
find_route
(
p
,
plen
,
neigh
,
nexthop
);
route
=
find_route
(
p
,
plen
,
neigh
,
nexthop
);
metric
=
MIN
((
int
)
refmetric
+
neighbour_cost
(
neigh
)
+
add_metric
,
INFINITY
);
metric
=
MIN
((
int
)
refmetric
+
neighbour_cost
(
neigh
)
+
add_metric
,
INFINITY
);
if
(
route
)
{
if
(
route
)
{
struct
source
*
oldsrc
;
struct
source
*
oldsrc
;
unsigned
short
oldmetric
;
unsigned
short
oldmetric
;
...
@@ -451,7 +446,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
...
@@ -451,7 +446,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
route
->
time
=
now
.
tv_sec
;
route
->
time
=
now
.
tv_sec
;
route
->
seqno
=
seqno
;
route
->
seqno
=
seqno
;
route
->
refmetric
=
refmetric
;
route
->
refmetric
=
refmetric
;
change_route_metric
(
route
,
metric
);
change_route_metric
(
route
,
neighbour_cost
(
neigh
),
add_
metric
);
route
->
hold_time
=
hold_time
;
route
->
hold_time
=
hold_time
;
route_changed
(
route
,
oldsrc
,
oldmetric
);
route_changed
(
route
,
oldsrc
,
oldmetric
);
...
...
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