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
050c0366
Commit
050c0366
authored
Apr 08, 2009
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split link-quality flag from wired/wireless flag.
parent
ff4cc024
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
neighbour.c
neighbour.c
+12
-13
network.c
network.c
+2
-0
network.h
network.h
+1
-0
No files found.
neighbour.c
View file @
050c0366
...
...
@@ -273,17 +273,7 @@ neighbour_rxcost(struct neighbour *neigh)
if
((
reach
&
0xFFF0
)
==
0
||
delay
>=
180000
)
{
return
INFINITY
;
}
else
if
((
neigh
->
network
->
flags
&
NET_WIRED
))
{
/* To lose one hello is a misfortune, to lose two is carelessness. */
if
((
reach
&
0xC000
)
==
0xC000
)
return
neigh
->
network
->
cost
;
else
if
((
reach
&
0xC000
)
==
0
)
return
INFINITY
;
else
if
((
reach
&
0x2000
))
return
neigh
->
network
->
cost
;
else
return
INFINITY
;
}
else
{
}
else
if
((
neigh
->
network
->
flags
&
NET_LQ
))
{
int
sreach
=
((
reach
&
0x8000
)
>>
2
)
+
((
reach
&
0x4000
)
>>
1
)
+
...
...
@@ -293,8 +283,17 @@ neighbour_rxcost(struct neighbour *neigh)
/* cost >= network->cost */
if
(
delay
>=
40000
)
cost
=
(
cost
*
(
delay
-
20000
)
+
10000
)
/
20000
;
return
MIN
(
cost
,
INFINITY
);
}
else
{
/* To lose one hello is a misfortune, to lose two is carelessness. */
if
((
reach
&
0xC000
)
==
0xC000
)
return
neigh
->
network
->
cost
;
else
if
((
reach
&
0xC000
)
==
0
)
return
INFINITY
;
else
if
((
reach
&
0x2000
))
return
neigh
->
network
->
cost
;
else
return
INFINITY
;
}
}
...
...
@@ -315,7 +314,7 @@ neighbour_cost(struct neighbour *neigh)
if
(
b
>=
INFINITY
)
return
INFINITY
;
if
(
(
neigh
->
network
->
flags
&
NET_WIRED
)
||
(
a
<=
256
&&
b
<=
256
))
{
if
(
!
(
neigh
->
network
->
flags
&
NET_LQ
)
||
(
a
<=
256
&&
b
<=
256
))
{
return
a
;
}
else
{
/* a = 256/alpha, b = 256/beta, where alpha and beta are the expected
...
...
network.c
View file @
050c0366
...
...
@@ -263,11 +263,13 @@ network_up(struct network *net, int up)
if
(
net
->
cost
<=
0
)
net
->
cost
=
96
;
if
(
split_horizon
)
net
->
flags
|=
NET_SPLIT_HORIZON
;
net
->
flags
&=
~
NET_LQ
;
}
else
{
net
->
flags
&=
~
NET_WIRED
;
net
->
cost
=
NET_CONF
(
net
,
cost
,
0
);
if
(
net
->
cost
<=
0
)
net
->
cost
=
256
;
net
->
flags
&=
~
NET_SPLIT_HORIZON
;
net
->
flags
|=
NET_LQ
;
}
update_hello_interval
(
net
);
...
...
network.h
View file @
050c0366
...
...
@@ -37,6 +37,7 @@ struct network_conf {
#define NET_UP (1 << 0)
#define NET_WIRED (1<<1)
#define NET_SPLIT_HORIZON (1 << 2)
#define NET_LQ (1 << 3)
struct
network
{
struct
network
*
next
;
...
...
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