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
ec19de91
Commit
ec19de91
authored
Aug 16, 2007
by
Grégoire Henry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout de kernel_setup_socket.
parent
8138dfc2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
8 deletions
+33
-8
babel.c
babel.c
+8
-0
kernel.c
kernel.c
+24
-8
kernel.h
kernel.h
+1
-0
No files found.
babel.c
View file @
ec19de91
...
...
@@ -286,6 +286,12 @@ main(int argc, char **argv)
exit
(
1
);
}
rc
=
kernel_setup_socket
(
1
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"kernel_setup_socket failed.
\n
"
);
exit
(
1
);
}
protocol_socket
=
babel_socket
(
protocol_port
);
if
(
protocol_socket
<
0
)
{
perror
(
"Couldn't create link local socket"
);
...
...
@@ -550,6 +556,7 @@ main(int argc, char **argv)
usleep
(
50000
+
random
()
%
100000
);
kernel_setup_interface
(
0
,
nets
[
i
].
ifname
,
nets
[
i
].
ifindex
);
}
kernel_setup_socket
(
0
);
kernel_setup
(
0
);
fd
=
open
(
state_file
,
O_WRONLY
|
O_TRUNC
|
O_CREAT
,
0644
);
...
...
@@ -586,6 +593,7 @@ main(int argc, char **argv)
fail:
for
(
i
=
0
;
i
<
numnets
;
i
++
)
kernel_setup_interface
(
0
,
nets
[
i
].
ifname
,
nets
[
i
].
ifindex
);
kernel_setup_socket
(
0
);
kernel_setup
(
0
);
exit
(
1
);
}
...
...
kernel.c
View file @
ec19de91
...
...
@@ -458,14 +458,6 @@ kernel_setup(int setup)
return
-
1
;
}
rc
=
netlink_socket
(
&
nl_listen
,
RTMGRP_IPV6_ROUTE
);
if
(
rc
<
0
)
{
perror
(
"netlink_socket(RTMGRP_IPV6_ROUTE)"
);
return
-
1
;
}
kernel_socket
=
nl_listen
.
sock
;
old_forwarding
=
read_proc
(
"/proc/sys/net/ipv6/conf/all/forwarding"
);
if
(
old_forwarding
<
0
)
{
perror
(
"Couldn't read forwarding knob."
);
...
...
@@ -512,6 +504,30 @@ kernel_setup(int setup)
close
(
nl_command
.
sock
);
nl_command
.
sock
=
-
1
;
return
1
;
}
}
int
kernel_setup_socket
(
int
setup
)
{
int
rc
;
if
(
setup
)
{
rc
=
netlink_socket
(
&
nl_listen
,
RTMGRP_IPV6_ROUTE
);
if
(
rc
<
0
)
{
perror
(
"netlink_socket(RTMGRP_IPV6_ROUTE)"
);
kernel_socket
=
-
1
;
return
-
1
;
}
kernel_socket
=
nl_listen
.
sock
;
return
1
;
}
else
{
close
(
nl_listen
.
sock
);
nl_listen
.
sock
=
-
1
;
kernel_socket
=
-
1
;
...
...
kernel.h
View file @
ec19de91
...
...
@@ -35,6 +35,7 @@ struct kernel_route {
#define ROUTE_MODIFY 2
int
kernel_setup
(
int
setup
);
int
kernel_setup_socket
(
int
setup
);
int
kernel_setup_interface
(
int
setup
,
const
char
*
ifname
,
int
ifindex
);
int
kernel_interface_mtu
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_interface_wireless
(
const
char
*
ifname
,
int
ifindex
);
...
...
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