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
a2c5c220
Commit
a2c5c220
authored
Jun 12, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for listening on kernel sockets.
parent
93d30327
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
babel.c
babel.c
+9
-1
babel.h
babel.h
+5
-0
No files found.
babel.c
View file @
a2c5c220
...
@@ -71,6 +71,7 @@ char *state_file = "/var/lib/babel-state";
...
@@ -71,6 +71,7 @@ char *state_file = "/var/lib/babel-state";
int
protocol_port
;
int
protocol_port
;
unsigned
char
protocol_group
[
16
];
unsigned
char
protocol_group
[
16
];
int
protocol_socket
=
-
1
;
int
protocol_socket
=
-
1
;
int
kernel_socket
=
-
1
;
static
volatile
sig_atomic_t
exiting
=
0
,
dumping
=
0
;
static
volatile
sig_atomic_t
exiting
=
0
,
dumping
=
0
;
...
@@ -389,7 +390,10 @@ main(int argc, char **argv)
...
@@ -389,7 +390,10 @@ main(int argc, char **argv)
if
(
timeval_compare
(
&
tv
,
&
now
)
>
0
)
{
if
(
timeval_compare
(
&
tv
,
&
now
)
>
0
)
{
timeval_minus
(
&
tv
,
&
tv
,
&
now
);
timeval_minus
(
&
tv
,
&
tv
,
&
now
);
FD_SET
(
protocol_socket
,
&
readfds
);
FD_SET
(
protocol_socket
,
&
readfds
);
rc
=
select
(
protocol_socket
+
1
,
&
readfds
,
NULL
,
NULL
,
&
tv
);
if
(
kernel_socket
>=
0
)
FD_SET
(
kernel_socket
,
&
readfds
);
rc
=
select
(
MAX
(
protocol_socket
,
kernel_socket
)
+
1
,
&
readfds
,
NULL
,
NULL
,
&
tv
);
if
(
rc
<
0
&&
errno
!=
EINTR
)
{
if
(
rc
<
0
&&
errno
!=
EINTR
)
{
perror
(
"select"
);
perror
(
"select"
);
sleep
(
1
);
sleep
(
1
);
...
@@ -402,6 +406,10 @@ main(int argc, char **argv)
...
@@ -402,6 +406,10 @@ main(int argc, char **argv)
if
(
exiting
)
if
(
exiting
)
break
;
break
;
if
(
kernel_socket
>=
0
&&
FD_ISSET
(
kernel_socket
,
&
readfds
))
{
kernel_callback
();
}
if
(
FD_ISSET
(
protocol_socket
,
&
readfds
))
{
if
(
FD_ISSET
(
protocol_socket
,
&
readfds
))
{
rc
=
babel_recv
(
protocol_socket
,
buf
,
maxmtu
,
rc
=
babel_recv
(
protocol_socket
,
buf
,
maxmtu
,
(
struct
sockaddr
*
)
&
sin6
,
sizeof
(
sin6
));
(
struct
sockaddr
*
)
&
sin6
,
sizeof
(
sin6
));
...
...
babel.h
View file @
a2c5c220
...
@@ -30,6 +30,10 @@ THE SOFTWARE.
...
@@ -30,6 +30,10 @@ THE SOFTWARE.
#define INFINITY ((unsigned short)(~0))
#define INFINITY ((unsigned short)(~0))
#ifndef RTPROT_BABEL
#define RTPROT_BABEL 42
#endif
#undef MAX
#undef MAX
#undef MIN
#undef MIN
...
@@ -90,3 +94,4 @@ extern int numnets;
...
@@ -90,3 +94,4 @@ extern int numnets;
extern
int
protocol_port
;
extern
int
protocol_port
;
extern
unsigned
char
protocol_group
[
16
];
extern
unsigned
char
protocol_group
[
16
];
extern
int
protocol_socket
;
extern
int
protocol_socket
;
extern
int
kernel_socket
;
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