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
3a18627b
Commit
3a18627b
authored
Mar 12, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify handle_request.
parent
9370f0e9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
24 deletions
+35
-24
message.c
message.c
+35
-24
No files found.
message.c
View file @
3a18627b
...
...
@@ -251,45 +251,56 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
unsigned
short
seqno
,
unsigned
short
router_hash
)
{
struct
xroute
*
xroute
;
struct
route
*
route
,
*
best_route
;
if
(
hop_count
==
0
)
{
send_update
(
neigh
->
network
,
1
,
prefix
,
plen
);
return
;
}
struct
route
*
route
;
xroute
=
find_xroute
(
prefix
,
plen
);
if
(
xroute
)
{
if
(
router_hash
==
hash_id
(
myid
)
&&
seqno_compare
(
seqno
,
myseqno
)
>
0
)
if
(
hop_count
>
0
&&
router_hash
==
hash_id
(
myid
))
{
if
(
seqno_compare
(
seqno
,
myseqno
)
>
0
)
update_myseqno
(
1
);
}
send_update
(
neigh
->
network
,
1
,
prefix
,
plen
);
return
;
}
/* We usually want to send the request to our selected successor,
but avoid it if we suspect it's dead. So pick the best successor
(feasible of not) if our selected successor's metric is too large. */
route
=
find_installed_route
(
prefix
,
plen
);
best_route
=
find_best_route
(
prefix
,
plen
,
0
,
neigh
);
if
(
!
route
||
route
->
neigh
==
neigh
||
route
->
metric
==
INFINITY
)
route
=
best_route
;
else
if
(
route
&&
best_route
&&
route
->
metric
>=
best_route
->
metric
+
256
)
route
=
best_route
;
if
(
!
route
||
route
->
metric
>=
INFINITY
||
route
->
neigh
==
neigh
)
return
;
if
(
router_hash
==
hash_id
(
route
->
src
->
address
)
&&
seqno_compare
(
seqno
,
route
->
seqno
)
>
0
)
{
if
(
hop_count
>
0
&&
(
!
route
||
route
->
metric
>=
INFINITY
||
(
router_hash
==
hash_id
(
route
->
src
->
address
)
&&
seqno_compare
(
seqno
,
route
->
seqno
)
>
0
)))
{
/* No route, or the route we have is not fresh enough. */
if
(
hop_count
>
1
)
{
send_unicast_request
(
route
->
neigh
,
prefix
,
plen
,
struct
route
*
successor_route
;
/* We usually want to send the request to our selected successor,
but not when we suspect that it's dead. So pick the best
successor (feasible of not) if our selected successor's
metric is suspiciously large. */
successor_route
=
find_best_route
(
prefix
,
plen
,
0
,
neigh
);
if
(
!
successor_route
||
successor_route
->
metric
>=
INFINITY
)
successor_route
=
route
;
if
(
route
&&
successor_route
&&
successor_route
->
metric
+
256
>=
route
->
metric
)
successor_route
=
route
;
if
(
!
successor_route
||
successor_route
->
metric
>=
INFINITY
)
return
;
send_unicast_request
(
successor_route
->
neigh
,
prefix
,
plen
,
hop_count
-
1
,
seqno
,
router_hash
);
record_request
(
prefix
,
plen
,
seqno
,
router_hash
,
neigh
->
network
,
0
);
}
}
else
{
send_update
(
neigh
->
network
,
1
,
prefix
,
plen
);
}
return
;
}
/* We do send replies for recently retracted routes, to satisfy
nodes whose routes are about to expire. */
if
(
route
)
send_update
(
neigh
->
network
,
1
,
prefix
,
plen
);
}
...
...
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