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
d0c25cd4
Commit
d0c25cd4
authored
Jun 17, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split checking kernel routes from route expiry.
parent
2e928f33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
babel.c
babel.c
+24
-15
No files found.
babel.c
View file @
d0c25cd4
...
...
@@ -73,7 +73,7 @@ int protocol_port;
unsigned
char
protocol_group
[
16
];
int
protocol_socket
=
-
1
;
int
kernel_socket
=
-
1
;
static
int
routes_changed
=
0
;
static
int
kernel_
routes_changed
=
0
;
static
volatile
sig_atomic_t
exiting
=
0
,
dumping
=
0
;
...
...
@@ -81,7 +81,7 @@ struct network *add_network(char *ifname, int ifindex, int bufsize,
int
wired
,
unsigned
int
cost
);
void
expire_routes
(
void
);
static
int
kernel_routes_c
hanged
(
void
*
closure
);
static
int
kernel_routes_c
allback
(
void
*
closure
);
static
void
init_signals
(
void
);
static
void
dump_tables
(
FILE
*
out
);
...
...
@@ -92,7 +92,7 @@ main(int argc, char **argv)
struct
ipv6_mreq
mreq
;
int
i
,
rc
,
fd
;
static
unsigned
char
*
buf
;
int
expiry_time
;
int
expiry_time
,
kernel_dump_time
;
void
*
vrc
;
unsigned
int
seed
;
char
**
arg
;
...
...
@@ -354,6 +354,9 @@ main(int argc, char **argv)
init_signals
();
check_myxroutes
();
kernel_routes_changed
=
0
;
kernel_dump_time
=
now
.
tv_sec
+
20
+
random
()
%
20
;
expiry_time
=
now
.
tv_sec
+
20
+
random
()
%
20
;
/* Make some noise so others notice us */
...
...
@@ -419,7 +422,7 @@ main(int argc, char **argv)
break
;
if
(
kernel_socket
>=
0
&&
FD_ISSET
(
kernel_socket
,
&
readfds
))
kernel_callback
(
kernel_routes_c
hanged
,
NULL
);
kernel_callback
(
kernel_routes_c
allback
,
NULL
);
if
(
FD_ISSET
(
protocol_socket
,
&
readfds
))
{
rc
=
babel_recv
(
protocol_socket
,
buf
,
maxmtu
,
...
...
@@ -441,12 +444,24 @@ main(int argc, char **argv)
}
}
if
(
routes_changed
||
now
.
tv_sec
>=
expiry_time
)
{
if
(
now
.
tv_sec
>=
expiry_time
)
{
expire_routes
();
routes_changed
=
0
;
expiry_time
=
now
.
tv_sec
+
20
+
random
()
%
20
;
}
if
(
kernel_routes_changed
||
now
.
tv_sec
>=
kernel_dump_time
)
{
rc
=
check_myxroutes
();
if
(
rc
>
0
)
send_self_update
(
NULL
,
1
);
else
if
(
rc
<
0
)
fprintf
(
stderr
,
"Warning: couldn't check installed routes.
\n
"
);
kernel_routes_changed
=
0
;
if
(
kernel_socket
>=
0
)
kernel_dump_time
=
now
.
tv_sec
+
200
+
random
()
%
100
;
else
kernel_dump_time
=
now
.
tv_sec
+
20
+
random
()
%
20
;
}
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
if
(
now
.
tv_sec
>=
nets
[
i
].
hello_time
+
nets
[
i
].
hello_interval
)
send_hello
(
&
nets
[
i
]);
...
...
@@ -633,9 +648,9 @@ dump_tables(FILE *out)
}
static
int
kernel_routes_c
hanged
(
void
*
closure
)
kernel_routes_c
allback
(
void
*
closure
)
{
routes_changed
=
1
;
kernel_
routes_changed
=
1
;
return
1
;
}
...
...
@@ -689,13 +704,7 @@ add_network(char *ifname, int ifindex, int mtu, int wired, unsigned int cost)
void
expire_routes
(
void
)
{
int
rc
,
i
;
rc
=
check_myxroutes
();
if
(
rc
>
0
)
send_self_update
(
NULL
,
1
);
else
if
(
rc
<
0
)
fprintf
(
stderr
,
"Warning: couldn't check installed routes.
\n
"
);
int
i
;
for
(
i
=
0
;
i
<
numneighs
;
i
++
)
{
if
(
neighs
[
i
].
id
[
0
]
==
0
)
...
...
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