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
6d7356dc
Commit
6d7356dc
authored
Apr 11, 2013
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate interface checks, export scheduling function.
parent
cee445be
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
babeld.c
babeld.c
+23
-3
babeld.h
babeld.h
+1
-0
No files found.
babeld.c
View file @
6d7356dc
...
@@ -84,7 +84,7 @@ static int kernel_routes_changed = 0;
...
@@ -84,7 +84,7 @@ static int kernel_routes_changed = 0;
static
int
kernel_link_changed
=
0
;
static
int
kernel_link_changed
=
0
;
static
int
kernel_addr_changed
=
0
;
static
int
kernel_addr_changed
=
0
;
struct
timeval
check_neighbours_timeout
;
struct
timeval
check_neighbours_timeout
,
check_interfaces_timeout
;
static
volatile
sig_atomic_t
exiting
=
0
,
dumping
=
0
,
reopening
=
0
;
static
volatile
sig_atomic_t
exiting
=
0
,
dumping
=
0
,
reopening
=
0
;
...
@@ -490,18 +490,21 @@ main(int argc, char **argv)
...
@@ -490,18 +490,21 @@ main(int argc, char **argv)
rc
=
resize_receive_buffer
(
1500
);
rc
=
resize_receive_buffer
(
1500
);
if
(
rc
<
0
)
if
(
rc
<
0
)
goto
fail
;
goto
fail
;
check_interfaces
();
if
(
receive_buffer
==
NULL
)
if
(
receive_buffer
==
NULL
)
goto
fail
;
goto
fail
;
check_interfaces
();
rc
=
check_xroutes
(
0
);
rc
=
check_xroutes
(
0
);
if
(
rc
<
0
)
if
(
rc
<
0
)
fprintf
(
stderr
,
"Warning: couldn't check exported routes.
\n
"
);
fprintf
(
stderr
,
"Warning: couldn't check exported routes.
\n
"
);
kernel_routes_changed
=
0
;
kernel_routes_changed
=
0
;
kernel_link_changed
=
0
;
kernel_link_changed
=
0
;
kernel_addr_changed
=
0
;
kernel_addr_changed
=
0
;
kernel_dump_time
=
now
.
tv_sec
+
roughly
(
30
);
kernel_dump_time
=
now
.
tv_sec
+
roughly
(
30
);
schedule_neighbours_check
(
5000
,
1
);
schedule_neighbours_check
(
5000
,
1
);
schedule_interfaces_check
(
30000
,
1
);
expiry_time
=
now
.
tv_sec
+
roughly
(
30
);
expiry_time
=
now
.
tv_sec
+
roughly
(
30
);
source_expiry_time
=
now
.
tv_sec
+
roughly
(
300
);
source_expiry_time
=
now
.
tv_sec
+
roughly
(
300
);
...
@@ -539,6 +542,7 @@ main(int argc, char **argv)
...
@@ -539,6 +542,7 @@ main(int argc, char **argv)
gettime
(
&
now
);
gettime
(
&
now
);
tv
=
check_neighbours_timeout
;
tv
=
check_neighbours_timeout
;
timeval_min
(
&
tv
,
&
check_interfaces_timeout
);
timeval_min_sec
(
&
tv
,
expiry_time
);
timeval_min_sec
(
&
tv
,
expiry_time
);
timeval_min_sec
(
&
tv
,
source_expiry_time
);
timeval_min_sec
(
&
tv
,
source_expiry_time
);
timeval_min_sec
(
&
tv
,
kernel_dump_time
);
timeval_min_sec
(
&
tv
,
kernel_dump_time
);
...
@@ -679,8 +683,12 @@ main(int argc, char **argv)
...
@@ -679,8 +683,12 @@ main(int argc, char **argv)
schedule_neighbours_check
(
msecs
,
1
);
schedule_neighbours_check
(
msecs
,
1
);
}
}
if
(
now
.
tv_sec
>=
expiry_time
)
{
if
(
timeval_compare
(
&
check_interfaces_timeout
,
&
now
)
<
0
)
{
check_interfaces
();
check_interfaces
();
schedule_interfaces_check
(
30000
,
1
);
}
if
(
now
.
tv_sec
>=
expiry_time
)
{
expire_routes
();
expire_routes
();
expire_resend
();
expire_resend
();
expiry_time
=
now
.
tv_sec
+
roughly
(
30
);
expiry_time
=
now
.
tv_sec
+
roughly
(
30
);
...
@@ -831,6 +839,18 @@ schedule_neighbours_check(int msecs, int override)
...
@@ -831,6 +839,18 @@ schedule_neighbours_check(int msecs, int override)
timeval_min
(
&
check_neighbours_timeout
,
&
timeout
);
timeval_min
(
&
check_neighbours_timeout
,
&
timeout
);
}
}
void
schedule_interfaces_check
(
int
msecs
,
int
override
)
{
struct
timeval
timeout
;
timeval_add_msec
(
&
timeout
,
&
now
,
roughly
(
msecs
));
if
(
override
)
check_interfaces_timeout
=
timeout
;
else
timeval_min
(
&
check_interfaces_timeout
,
&
timeout
);
}
int
int
resize_receive_buffer
(
int
size
)
resize_receive_buffer
(
int
size
)
{
{
...
...
babeld.h
View file @
6d7356dc
...
@@ -100,4 +100,5 @@ extern int kernel_socket;
...
@@ -100,4 +100,5 @@ extern int kernel_socket;
extern
int
max_request_hopcount
;
extern
int
max_request_hopcount
;
void
schedule_neighbours_check
(
int
msecs
,
int
override
);
void
schedule_neighbours_check
(
int
msecs
,
int
override
);
void
schedule_interfaces_check
(
int
msecs
,
int
override
);
int
resize_receive_buffer
(
int
size
);
int
resize_receive_buffer
(
int
size
);
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