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
49a9c3a0
Commit
49a9c3a0
authored
Jun 30, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remember forwarded requests, satisfy them later.
parent
167be8b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
8 deletions
+74
-8
destination.c
destination.c
+46
-0
destination.h
destination.h
+8
-0
message.c
message.c
+17
-8
route.c
route.c
+3
-0
No files found.
destination.c
View file @
49a9c3a0
...
@@ -58,6 +58,8 @@ find_destination(const unsigned char *d, int create, unsigned char seqno)
...
@@ -58,6 +58,8 @@ find_destination(const unsigned char *d, int create, unsigned char seqno)
dests
[
i
].
seqno
=
seqno
;
dests
[
i
].
seqno
=
seqno
;
dests
[
i
].
metric
=
INFINITY
;
dests
[
i
].
metric
=
INFINITY
;
dests
[
i
].
time
=
now
.
tv_sec
;
dests
[
i
].
time
=
now
.
tv_sec
;
dests
[
i
].
requested_seqno
=
-
1
;
dests
[
i
].
requested_net
=
NULL
;
return
&
dests
[
i
];
return
&
dests
[
i
];
}
}
...
@@ -73,3 +75,47 @@ update_destination(struct destination *dest,
...
@@ -73,3 +75,47 @@ update_destination(struct destination *dest,
dest
->
time
=
now
.
tv_sec
;
dest
->
time
=
now
.
tv_sec
;
}
}
void
notice_request
(
struct
destination
*
dest
,
unsigned
char
seqno
,
struct
network
*
net
)
{
if
(
dest
->
requested_seqno
<
0
)
{
dest
->
requested_seqno
=
seqno
;
dest
->
requested_net
=
net
;
}
else
{
if
(
seqno_compare
(
dest
->
requested_seqno
,
seqno
)
<
0
)
dest
->
requested_seqno
=
seqno
;
if
(
net
==
NULL
||
net
!=
dest
->
requested_net
)
dest
->
requested_net
=
NULL
;
}
}
int
request_requested
(
struct
destination
*
dest
,
unsigned
char
seqno
,
struct
network
*
net
)
{
if
(
dest
->
requested_seqno
<
0
)
return
0
;
if
(
seqno_compare
(
dest
->
requested_seqno
,
seqno
)
<
0
)
return
0
;
if
(
net
==
NULL
||
net
!=
dest
->
requested_net
)
return
0
;
return
1
;
}
void
satisfy_request
(
struct
destination
*
dest
,
unsigned
char
seqno
,
struct
network
*
net
)
{
if
(
dest
->
requested_seqno
>=
0
)
{
if
(
net
==
NULL
||
net
==
dest
->
requested_net
)
{
if
(
seqno_compare
(
seqno
,
dest
->
requested_seqno
)
>=
0
)
{
dest
->
requested_seqno
=
-
1
;
dest
->
requested_net
=
NULL
;
}
}
}
}
destination.h
View file @
49a9c3a0
...
@@ -25,9 +25,17 @@ struct destination {
...
@@ -25,9 +25,17 @@ struct destination {
unsigned
char
seqno
;
unsigned
char
seqno
;
unsigned
short
metric
;
unsigned
short
metric
;
int
time
;
int
time
;
int
requested_seqno
;
struct
network
*
requested_net
;
};
};
struct
destination
*
find_destination
(
const
unsigned
char
*
d
,
struct
destination
*
find_destination
(
const
unsigned
char
*
d
,
int
create
,
unsigned
char
seqno
);
int
create
,
unsigned
char
seqno
);
void
update_destination
(
struct
destination
*
dest
,
void
update_destination
(
struct
destination
*
dest
,
unsigned
char
seqno
,
unsigned
short
metric
);
unsigned
char
seqno
,
unsigned
short
metric
);
void
notice_request
(
struct
destination
*
dest
,
unsigned
char
seqno
,
struct
network
*
net
);
int
request_requested
(
struct
destination
*
dest
,
unsigned
char
seqno
,
struct
network
*
net
);
void
satisfy_request
(
struct
destination
*
dest
,
unsigned
char
seqno
,
struct
network
*
net
);
message.c
View file @
49a9c3a0
...
@@ -144,14 +144,16 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -144,14 +144,16 @@ parse_packet(const unsigned char *from, struct network *net,
if
(
seqno_compare
(
installed
->
seqno
,
if
(
seqno_compare
(
installed
->
seqno
,
theirseqno
)
>=
0
)
theirseqno
)
>=
0
)
send_update
(
dest
,
neigh
->
network
);
send_update
(
dest
,
neigh
->
network
);
else
if
(
hopcount
>=
2
)
{
else
if
(
!
request_requested
(
dest
,
theirseqno
,
neigh
->
network
))
{
if
(
hopcount
>=
2
)
send_unicast_request
(
installed
->
nexthop
,
send_unicast_request
(
installed
->
nexthop
,
dest
,
dest
,
hopcount
-
1
,
hopcount
-
1
,
theirseqno
);
theirseqno
);
/* For now, let's hope the new seqno
notice_request
(
dest
,
theirseqno
,
arrives before the update is flushed. */
neigh
->
network
);
send_update
(
dest
,
neigh
->
network
);
}
}
}
}
}
}
...
@@ -530,6 +532,7 @@ flushupdates(void)
...
@@ -530,6 +532,7 @@ flushupdates(void)
accumulate_byte
(
net
,
seqno
);
accumulate_byte
(
net
,
seqno
);
accumulate_short
(
net
,
metric
);
accumulate_short
(
net
,
metric
);
accumulate_data
(
net
,
buffered_updates
[
i
]
->
address
,
16
);
accumulate_data
(
net
,
buffered_updates
[
i
]
->
address
,
16
);
satisfy_request
(
buffered_updates
[
i
],
seqno
,
net
);
}
}
}
}
schedule_flush_now
(
net
);
schedule_flush_now
(
net
);
...
@@ -578,6 +581,12 @@ send_update(struct destination *dest, struct network *net)
...
@@ -578,6 +581,12 @@ send_update(struct destination *dest, struct network *net)
if
(
net
==
NULL
)
{
if
(
net
==
NULL
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
for
(
i
=
0
;
i
<
numnets
;
i
++
)
send_update
(
dest
,
&
nets
[
i
]);
send_update
(
dest
,
&
nets
[
i
]);
if
(
dest
!=
NULL
)
{
/* This case is not handled by flushupdates. */
struct
route
*
installed
=
find_installed_route
(
dest
);
satisfy_request
(
dest
,
installed
?
installed
->
seqno
:
dest
->
seqno
,
NULL
);
}
return
;
return
;
}
}
...
...
route.c
View file @
49a9c3a0
...
@@ -428,6 +428,9 @@ send_triggered_update(struct route *route, int oldmetric)
...
@@ -428,6 +428,9 @@ send_triggered_update(struct route *route, int oldmetric)
if
((
route
->
metric
>=
INFINITY
&&
oldmetric
<
INFINITY
)
||
if
((
route
->
metric
>=
INFINITY
&&
oldmetric
<
INFINITY
)
||
(
route
->
metric
-
oldmetric
>=
256
||
oldmetric
-
route
->
metric
>=
256
))
(
route
->
metric
-
oldmetric
>=
256
||
oldmetric
-
route
->
metric
>=
256
))
send_update
(
route
->
dest
,
NULL
);
send_update
(
route
->
dest
,
NULL
);
else
if
(
route
->
dest
->
requested_seqno
>=
0
&&
seqno_compare
(
route
->
dest
->
requested_seqno
,
route
->
seqno
)
<=
0
)
send_update
(
route
->
dest
,
route
->
dest
->
requested_net
);
if
(
oldmetric
<
INFINITY
)
{
if
(
oldmetric
<
INFINITY
)
{
if
(
route
->
metric
>=
INFINITY
)
{
if
(
route
->
metric
>=
INFINITY
)
{
...
...
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