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
51101a7c
Commit
51101a7c
authored
Apr 27, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename neighbour_cost to rxcost and symmetric_cost to cost.
parent
1cb3f767
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
13 deletions
+9
-13
babel.c
babel.c
+2
-2
message.c
message.c
+1
-5
neighbour.c
neighbour.c
+3
-3
neighbour.h
neighbour.h
+1
-1
route.c
route.c
+2
-2
No files found.
babel.c
View file @
51101a7c
...
@@ -437,11 +437,11 @@ main(int argc, char **argv)
...
@@ -437,11 +437,11 @@ main(int argc, char **argv)
if
(
neighs
[
i
].
id
[
0
]
==
0
)
if
(
neighs
[
i
].
id
[
0
]
==
0
)
continue
;
continue
;
printf
(
"Neighbour %s "
,
format_address
(
neighs
[
i
].
id
));
printf
(
"Neighbour %s "
,
format_address
(
neighs
[
i
].
id
));
printf
(
"at %s dev %s reach %04x cost %d txcost %d.
\n
"
,
printf
(
"at %s dev %s reach %04x
rx
cost %d txcost %d.
\n
"
,
format_address
(
neighs
[
i
].
address
),
format_address
(
neighs
[
i
].
address
),
neighs
[
i
].
network
->
ifname
,
neighs
[
i
].
network
->
ifname
,
neighs
[
i
].
reach
,
neighs
[
i
].
reach
,
neighbour_cost
(
&
neighs
[
i
]),
neighbour_
rx
cost
(
&
neighs
[
i
]),
neighs
[
i
].
txcost
);
neighs
[
i
].
txcost
);
}
}
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
{
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
{
...
...
message.c
View file @
51101a7c
...
@@ -546,8 +546,6 @@ send_txcost(struct neighbour *neigh, struct network *net)
...
@@ -546,8 +546,6 @@ send_txcost(struct neighbour *neigh, struct network *net)
}
}
net
->
txcost_time
=
now
.
tv_sec
;
net
->
txcost_time
=
now
.
tv_sec
;
}
else
{
}
else
{
int
cost
;
if
(
net
&&
neigh
->
network
!=
net
)
if
(
net
&&
neigh
->
network
!=
net
)
return
;
return
;
...
@@ -558,12 +556,10 @@ send_txcost(struct neighbour *neigh, struct network *net)
...
@@ -558,12 +556,10 @@ send_txcost(struct neighbour *neigh, struct network *net)
format_address
(
neigh
->
id
),
format_address
(
neigh
->
id
),
format_address
(
neigh
->
address
));
format_address
(
neigh
->
address
));
cost
=
neighbour_cost
(
neigh
);
start_message
(
net
,
20
);
start_message
(
net
,
20
);
accumulate_byte
(
net
,
3
);
accumulate_byte
(
net
,
3
);
accumulate_byte
(
net
,
0
);
accumulate_byte
(
net
,
0
);
accumulate_short
(
net
,
neighbour_cost
(
neigh
));
accumulate_short
(
net
,
neighbour_
rx
cost
(
neigh
));
accumulate_data
(
net
,
neigh
->
id
,
16
);
accumulate_data
(
net
,
neigh
->
id
,
16
);
schedule_flush
(
net
);
schedule_flush
(
net
);
}
}
...
...
neighbour.c
View file @
51101a7c
...
@@ -190,7 +190,7 @@ check_neighbour(struct neighbour *neigh)
...
@@ -190,7 +190,7 @@ check_neighbour(struct neighbour *neigh)
}
}
int
int
neighbour_cost
(
struct
neighbour
*
neigh
)
neighbour_
rx
cost
(
struct
neighbour
*
neigh
)
{
{
update_neighbour
(
neigh
,
-
1
,
0
);
update_neighbour
(
neigh
,
-
1
,
0
);
if
(
neigh
->
reach
==
0
)
if
(
neigh
->
reach
==
0
)
...
@@ -215,7 +215,7 @@ neighbour_cost(struct neighbour *neigh)
...
@@ -215,7 +215,7 @@ neighbour_cost(struct neighbour *neigh)
}
}
int
int
neighbour_
symmetric_
cost
(
struct
neighbour
*
neigh
)
neighbour_cost
(
struct
neighbour
*
neigh
)
{
{
int
c
;
int
c
;
/* (1/(alpha * beta) + 1/beta) / 2, which is half the expected
/* (1/(alpha * beta) + 1/beta) / 2, which is half the expected
...
@@ -226,7 +226,7 @@ neighbour_symmetric_cost(struct neighbour *neigh)
...
@@ -226,7 +226,7 @@ neighbour_symmetric_cost(struct neighbour *neigh)
if
(
neigh
->
txcost
>=
INFINITY
)
if
(
neigh
->
txcost
>=
INFINITY
)
return
INFINITY
;
return
INFINITY
;
c
=
neighbour_cost
(
neigh
);
c
=
neighbour_
rx
cost
(
neigh
);
if
(
c
>=
INFINITY
)
if
(
c
>=
INFINITY
)
return
INFINITY
;
return
INFINITY
;
...
...
neighbour.h
View file @
51101a7c
...
@@ -43,5 +43,5 @@ add_neighbour(const unsigned char *id, const unsigned char *address,
...
@@ -43,5 +43,5 @@ add_neighbour(const unsigned char *id, const unsigned char *address,
struct
network
*
net
);
struct
network
*
net
);
void
update_neighbour
(
struct
neighbour
*
neigh
,
int
hello
,
int
hello_interval
);
void
update_neighbour
(
struct
neighbour
*
neigh
,
int
hello
,
int
hello_interval
);
void
check_neighbour
(
struct
neighbour
*
neigh
);
void
check_neighbour
(
struct
neighbour
*
neigh
);
int
neighbour_rxcost
(
struct
neighbour
*
neigh
);
int
neighbour_cost
(
struct
neighbour
*
neigh
);
int
neighbour_cost
(
struct
neighbour
*
neigh
);
int
neighbour_symmetric_cost
(
struct
neighbour
*
neigh
);
route.c
View file @
51101a7c
...
@@ -284,7 +284,7 @@ void
...
@@ -284,7 +284,7 @@ void
update_route_metric
(
struct
route
*
route
)
update_route_metric
(
struct
route
*
route
)
{
{
int
metric
,
oldmetric
,
install
=
0
;
int
metric
,
oldmetric
,
install
=
0
;
metric
=
MIN
(
route
->
refmetric
+
neighbour_
symmetric_
cost
(
route
->
nexthop
),
metric
=
MIN
(
route
->
refmetric
+
neighbour_cost
(
route
->
nexthop
),
INFINITY
);
INFINITY
);
if
(
route
->
installed
&&
if
(
route
->
installed
&&
(
metric
>=
INFINITY
||
(
metric
>=
INFINITY
||
...
@@ -328,7 +328,7 @@ update_route(const unsigned char *d, int seqno, int refmetric,
...
@@ -328,7 +328,7 @@ update_route(const unsigned char *d, int seqno, int refmetric,
if
(
dest
==
NULL
)
if
(
dest
==
NULL
)
return
NULL
;
return
NULL
;
metric
=
MIN
(
refmetric
+
neighbour_
symmetric_
cost
(
nexthop
),
INFINITY
);
metric
=
MIN
(
refmetric
+
neighbour_cost
(
nexthop
),
INFINITY
);
route
=
find_route
(
d
,
nexthop
);
route
=
find_route
(
d
,
nexthop
);
...
...
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