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
b6955597
Commit
b6955597
authored
Mar 13, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use explicit timeouts for hellos, IHUs and updates.
This is in preparation for sub-second hello intervals.
parent
e75aa64e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
25 deletions
+32
-25
babel.c
babel.c
+7
-11
babel.h
babel.h
+1
-0
message.c
message.c
+14
-8
network.c
network.c
+1
-1
network.h
network.h
+9
-5
No files found.
babel.c
View file @
b6955597
...
...
@@ -529,12 +529,10 @@ main(int argc, char **argv)
if
(
!
nets
[
i
].
up
)
continue
;
timeval_min
(
&
tv
,
&
nets
[
i
].
flush_time
);
timeval_min_sec
(
&
tv
,
nets
[
i
].
hello_time
+
nets
[
i
].
hello_interval
);
timeval_min
(
&
tv
,
&
nets
[
i
].
hello_timeout
);
if
(
!
network_idle
(
&
nets
[
i
]))
{
timeval_min_sec
(
&
tv
,
nets
[
i
].
self_update_time
+
nets
[
i
].
self_update_interval
);
timeval_min_sec
(
&
tv
,
nets
[
i
].
update_time
+
update_interval
);
timeval_min
(
&
tv
,
&
nets
[
i
].
self_update_timeout
);
timeval_min
(
&
tv
,
&
nets
[
i
].
update_timeout
);
}
}
timeval_min
(
&
tv
,
&
update_flush_time
);
...
...
@@ -640,17 +638,15 @@ main(int argc, char **argv)
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
if
(
!
nets
[
i
].
up
)
continue
;
if
(
now
.
tv_sec
>=
nets
[
i
].
hello_time
+
nets
[
i
].
hello_interval
)
if
(
timeval_compare
(
&
now
,
&
nets
[
i
].
hello_timeout
)
>=
0
)
send_hello
(
&
nets
[
i
]);
if
(
now
.
tv_sec
>=
nets
[
i
].
ihu_time
+
nets
[
i
].
ihu_interval
)
if
(
timeval_compare
(
&
now
,
&
nets
[
i
].
ihu_timeout
)
>=
0
)
send_ihu
(
NULL
,
&
nets
[
i
]);
if
(
!
network_idle
(
&
nets
[
i
]))
{
if
(
now
.
tv_sec
>=
nets
[
i
].
update_time
+
update_interval
)
if
(
timeval_compare
(
&
now
,
&
nets
[
i
].
update_timeout
)
>=
0
)
send_update
(
&
nets
[
i
],
0
,
NULL
,
0
);
if
(
now
.
tv_sec
>=
nets
[
i
].
self_update_time
+
nets
[
i
].
self_update_interval
)
{
if
(
timeval_compare
(
&
now
,
&
nets
[
i
].
self_update_timeout
)
>=
0
)
send_self_update
(
&
nets
[
i
],
0
);
}
}
}
...
...
babel.h
View file @
b6955597
...
...
@@ -79,5 +79,6 @@ extern unsigned char protocol_group[16];
extern
int
protocol_socket
;
extern
int
kernel_socket
;
extern
int
max_request_hopcount
;
extern
int
update_interval
;
void
resize_receive_buffer
(
int
size
);
message.c
View file @
b6955597
...
...
@@ -464,7 +464,8 @@ send_hello_noupdate(struct network *net, unsigned interval)
{
debugf
(
"Sending hello (%d) to %s.
\n
"
,
interval
,
net
->
ifname
);
net
->
hello_seqno
=
seqno_plus
(
net
->
hello_seqno
,
1
);
net
->
hello_time
=
now
.
tv_sec
;
delay_jitter
(
&
net
->
hello_time
,
&
net
->
hello_timeout
,
net
->
hello_interval
*
1000
);
send_message
(
net
,
0
,
0
,
0
,
net
->
hello_seqno
,
interval
>
0xFFFF
?
0
:
interval
,
myid
);
...
...
@@ -750,7 +751,8 @@ send_update(struct network *net, int urgent,
if
(
parasitic
||
(
silent_time
&&
now
.
tv_sec
<
reboot_time
+
silent_time
))
{
if
(
prefix
==
NULL
)
{
send_self_update
(
net
,
0
);
net
->
update_time
=
now
.
tv_sec
;
delay_jitter
(
&
net
->
update_time
,
&
net
->
update_timeout
,
update_interval
*
1000
);
}
else
if
(
find_xroute
(
prefix
,
plen
))
{
buffer_update
(
net
,
prefix
,
plen
);
}
...
...
@@ -769,13 +771,15 @@ send_update(struct network *net, int urgent,
buffer_update
(
net
,
prefix
,
plen
);
}
else
{
send_self_update
(
net
,
0
);
if
(
now
.
tv_sec
-
net
->
update_time
<
1
)
/* Avoid sending full route dumps more than once per second */
if
(
now
.
tv_sec
-
net
->
update_time
.
tv_sec
<
1
)
return
;
debugf
(
"Sending update to %s for any.
\n
"
,
net
->
ifname
);
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
if
(
routes
[
i
].
installed
)
buffer_update
(
net
,
routes
[
i
].
src
->
prefix
,
routes
[
i
].
src
->
plen
);
net
->
update_time
=
now
.
tv_sec
;
delay_jitter
(
&
net
->
update_time
,
&
net
->
update_timeout
,
update_interval
*
1000
);
}
schedule_update_flush
(
net
,
urgent
);
}
...
...
@@ -807,8 +811,8 @@ send_self_update(struct network *net, int force_seqno)
debugf
(
"Sending self update to %s.
\n
"
,
net
->
ifname
);
net
->
self_update_time
=
now
.
tv_sec
;
delay_jitter
(
&
net
->
self_update_time
,
&
net
->
self_update_timeout
,
net
->
self_update_interval
*
1000
);
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
{
send_update
(
net
,
0
,
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
);
}
...
...
@@ -834,7 +838,8 @@ send_self_retract(struct network *net)
myseqno
=
seqno_plus
(
myseqno
,
1
);
seqno_time
=
now
.
tv_sec
;
net
->
self_update_time
=
now
.
tv_sec
;
delay_jitter
(
&
net
->
self_update_time
,
&
net
->
self_update_timeout
,
net
->
self_update_interval
);
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
{
really_send_update
(
net
,
myid
,
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
,
myseqno
,
0xFFFF
);
...
...
@@ -874,7 +879,8 @@ send_ihu(struct neighbour *neigh, struct network *net)
send_ihu
(
&
neighs
[
i
],
net
);
}
}
net
->
ihu_time
=
now
.
tv_sec
;
delay_jitter
(
&
net
->
ihu_time
,
&
net
->
ihu_timeout
,
net
->
ihu_interval
*
1000
);
}
else
{
int
rxcost
;
...
...
network.c
View file @
b6955597
...
...
@@ -128,7 +128,7 @@ update_jitter(struct network *net, int urgent)
}
void
timeout
_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
)
delay
_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
)
{
int
delay
;
delay
=
msecs
*
3
/
2
+
random
()
%
MAX
(
msecs
/
3
,
10
);
...
...
network.h
View file @
b6955597
...
...
@@ -25,10 +25,14 @@ struct network {
unsigned
int
ifindex
;
int
wired
;
unsigned
short
cost
;
int
hello_time
;
int
self_update_time
;
int
update_time
;
int
ihu_time
;
struct
timeval
hello_time
;
struct
timeval
hello_timeout
;
struct
timeval
self_update_time
;
struct
timeval
self_update_timeout
;
struct
timeval
update_time
;
struct
timeval
update_timeout
;
struct
timeval
ihu_time
;
struct
timeval
ihu_timeout
;
char
ifname
[
IF_NAMESIZE
];
unsigned
char
*
ipv4
;
int
buffered
;
...
...
@@ -52,6 +56,6 @@ int network_idle(struct network *net);
int
update_hello_interval
(
struct
network
*
net
);
unsigned
int
jitter
(
struct
network
*
net
);
unsigned
int
update_jitter
(
struct
network
*
net
,
int
urgent
);
void
timeout
_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
);
void
delay
_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
);
int
network_up
(
struct
network
*
net
,
int
up
);
void
check_networks
(
void
);
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