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
5a262efc
Commit
5a262efc
authored
Feb 16, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move multicast membership management to network_up.
parent
f311f9f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
13 deletions
+33
-13
babel.c
babel.c
+0
-12
network.c
network.c
+33
-1
No files found.
babel.c
View file @
5a262efc
...
...
@@ -91,7 +91,6 @@ int
main
(
int
argc
,
char
**
argv
)
{
struct
sockaddr_in6
sin6
;
struct
ipv6_mreq
mreq
;
int
i
,
rc
,
fd
;
static
unsigned
char
*
buf
;
struct
timeval
check_neighbours_time
;
...
...
@@ -355,17 +354,6 @@ main(int argc, char **argv)
goto
fail
;
}
memset
(
&
mreq
,
0
,
sizeof
(
mreq
));
memcpy
(
&
mreq
.
ipv6mr_multiaddr
,
protocol_group
,
16
);
mreq
.
ipv6mr_interface
=
ifindex
;
rc
=
setsockopt
(
protocol_socket
,
IPPROTO_IPV6
,
IPV6_JOIN_GROUP
,
(
char
*
)
&
mreq
,
sizeof
(
mreq
));
if
(
rc
<
0
)
{
perror
(
"setsockopt(IPV6_JOIN_GROUP)"
);
goto
fail
;
}
mtu
=
kernel_interface_mtu
(
*
arg
,
ifindex
);
if
(
mtu
<
0
)
{
fprintf
(
stderr
,
"Warning: couldn't get MTU of interface %s (%d).
\n
"
,
...
...
network.c
View file @
5a262efc
...
...
@@ -23,6 +23,11 @@ THE SOFTWARE.
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h>
#include <arpa/inet.h>
#include "babel.h"
#include "util.h"
...
...
@@ -126,6 +131,7 @@ static int
network_up
(
struct
network
*
net
,
int
up
)
{
int
mtu
,
rc
,
wired
;
struct
ipv6_mreq
mreq
;
if
(
up
==
net
->
up
)
return
0
;
...
...
@@ -133,6 +139,12 @@ network_up(struct network *net, int up)
net
->
up
=
up
;
if
(
up
)
{
if
(
net
->
ifindex
<=
0
)
{
fprintf
(
stderr
,
"Upping unknown interface %s.
\n
"
,
net
->
ifname
);
return
network_up
(
net
,
0
);
}
mtu
=
kernel_interface_mtu
(
net
->
ifname
,
net
->
ifindex
);
if
(
mtu
<
0
)
{
fprintf
(
stderr
,
"Warning: couldn't get MTU of interface %s (%d).
\n
"
,
...
...
@@ -169,13 +181,33 @@ network_up(struct network *net, int up)
net
->
wired
=
wired
;
net
->
cost
=
wired
?
128
:
256
;
update_hello_interval
(
net
);
memset
(
&
mreq
,
0
,
sizeof
(
mreq
));
memcpy
(
&
mreq
.
ipv6mr_multiaddr
,
protocol_group
,
16
);
mreq
.
ipv6mr_interface
=
net
->
ifindex
;
rc
=
setsockopt
(
protocol_socket
,
IPPROTO_IPV6
,
IPV6_JOIN_GROUP
,
(
char
*
)
&
mreq
,
sizeof
(
mreq
));
if
(
rc
<
0
)
{
perror
(
"setsockopt(IPV6_JOIN_GROUP)"
);
/* But don't bail out for now. */
}
}
else
{
net
->
buffered
=
0
;
net
->
bufsize
=
0
;
free
(
net
->
sendbuf
);
net
->
sendbuf
=
NULL
;
if
(
net
->
ifindex
>
0
)
{
memset
(
&
mreq
,
0
,
sizeof
(
mreq
));
memcpy
(
&
mreq
.
ipv6mr_multiaddr
,
protocol_group
,
16
);
mreq
.
ipv6mr_interface
=
net
->
ifindex
;
rc
=
setsockopt
(
protocol_socket
,
IPPROTO_IPV6
,
IPV6_LEAVE_GROUP
,
(
char
*
)
&
mreq
,
sizeof
(
mreq
));
if
(
rc
<
0
)
{
perror
(
"setsockopt(IPV6_LEAVE_GROUP)"
);
}
}
}
if
(
!
up
)
...
...
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