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
c99109be
Commit
c99109be
authored
Mar 13, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite handle_request.
parent
78877d2b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
34 deletions
+32
-34
message.c
message.c
+32
-34
No files found.
message.c
View file @
c99109be
...
@@ -247,6 +247,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
...
@@ -247,6 +247,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
{
{
struct
xroute
*
xroute
;
struct
xroute
*
xroute
;
struct
route
*
route
;
struct
route
*
route
;
struct
neighbour
*
successor
=
NULL
;
xroute
=
find_xroute
(
prefix
,
plen
);
xroute
=
find_xroute
(
prefix
,
plen
);
if
(
xroute
)
{
if
(
xroute
)
{
...
@@ -264,23 +265,29 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
...
@@ -264,23 +265,29 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
}
}
route
=
find_installed_route
(
prefix
,
plen
);
route
=
find_installed_route
(
prefix
,
plen
);
if
(
route
&&
(
hop_count
==
0
||
(
route
->
metric
<
INFINITY
&&
(
router_hash
!=
hash_id
(
route
->
src
->
address
)
||
seqno_compare
(
seqno
,
route
->
seqno
)
<=
0
))))
{
/* We can satisfy this request straight away. Note that in the
hop_count=0 case, we do send a recent retraction, in order to
reply to nodes whose routes are about to expire. */
send_update
(
neigh
->
network
,
1
,
prefix
,
plen
);
return
;
}
if
(
hop_count
>
0
&&
if
(
hop_count
<=
1
)
(
!
route
||
route
->
metric
>=
INFINITY
||
return
;
(
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
)
{
struct
neighbour
*
successor
=
NULL
;
/* Let's forward this request. */
if
(
route
&&
route
->
metric
<
INFINITY
)
if
(
route
&&
route
->
metric
<
INFINITY
)
successor
=
route
->
neigh
;
successor
=
route
->
neigh
;
if
(
!
successor
||
successor
==
neigh
)
{
if
(
!
successor
||
successor
==
neigh
)
{
struct
route
*
other_route
;
struct
route
*
other_route
;
/* We're about to forward a request to the requestor.
/* We're about to forward a request to the requestor. Try to
Try to find a different neighbour to forward the
find a different neighbour to forward the request to. */
request to. */
other_route
=
find_best_route
(
prefix
,
plen
,
0
,
neigh
);
other_route
=
find_best_route
(
prefix
,
plen
,
0
,
neigh
);
if
(
other_route
&&
other_route
->
metric
<
INFINITY
)
if
(
other_route
&&
other_route
->
metric
<
INFINITY
)
...
@@ -291,18 +298,9 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
...
@@ -291,18 +298,9 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
/* Give up */
/* Give up */
return
;
return
;
send_unicast_request
(
successor
,
prefix
,
plen
,
send_unicast_request
(
successor
,
prefix
,
plen
,
hop_count
-
1
,
hop_count
-
1
,
seqno
,
router_hash
);
seqno
,
router_hash
);
record_request
(
prefix
,
plen
,
seqno
,
router_hash
,
record_request
(
prefix
,
plen
,
seqno
,
router_hash
,
neigh
->
network
,
0
);
neigh
->
network
,
0
);
}
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