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
123c69f2
Commit
123c69f2
authored
Feb 16, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move calls to kernel_setup_interface to network_up.
parent
2fbebc73
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
29 deletions
+10
-29
babel.c
babel.c
+0
-9
network.c
network.c
+9
-20
network.h
network.h
+1
-0
No files found.
babel.c
View file @
123c69f2
...
@@ -347,13 +347,6 @@ main(int argc, char **argv)
...
@@ -347,13 +347,6 @@ main(int argc, char **argv)
goto
fail
;
goto
fail
;
}
}
rc
=
kernel_setup_interface
(
1
,
*
arg
,
ifindex
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"kernel_setup_interface(%s, %d) failed.
\n
"
,
*
arg
,
ifindex
);
goto
fail
;
}
mtu
=
kernel_interface_mtu
(
*
arg
,
ifindex
);
mtu
=
kernel_interface_mtu
(
*
arg
,
ifindex
);
if
(
mtu
<
0
)
{
if
(
mtu
<
0
)
{
fprintf
(
stderr
,
"Warning: couldn't get MTU of interface %s (%d).
\n
"
,
fprintf
(
stderr
,
"Warning: couldn't get MTU of interface %s (%d).
\n
"
,
...
@@ -604,7 +597,6 @@ main(int argc, char **argv)
...
@@ -604,7 +597,6 @@ main(int argc, char **argv)
flushbuf
(
&
nets
[
i
]);
flushbuf
(
&
nets
[
i
]);
usleep
(
50000
+
random
()
%
100000
);
usleep
(
50000
+
random
()
%
100000
);
network_up
(
&
nets
[
i
],
0
);
network_up
(
&
nets
[
i
],
0
);
kernel_setup_interface
(
0
,
nets
[
i
].
ifname
,
nets
[
i
].
ifindex
);
}
}
kernel_setup_socket
(
0
);
kernel_setup_socket
(
0
);
kernel_setup
(
0
);
kernel_setup
(
0
);
...
@@ -653,7 +645,6 @@ main(int argc, char **argv)
...
@@ -653,7 +645,6 @@ main(int argc, char **argv)
if
(
!
nets
[
i
].
up
)
if
(
!
nets
[
i
].
up
)
continue
;
continue
;
network_up
(
&
nets
[
i
],
0
);
network_up
(
&
nets
[
i
],
0
);
kernel_setup_interface
(
0
,
nets
[
i
].
ifname
,
nets
[
i
].
ifindex
);
}
}
kernel_setup_socket
(
0
);
kernel_setup_socket
(
0
);
kernel_setup
(
0
);
kernel_setup
(
0
);
...
...
network.c
View file @
123c69f2
...
@@ -127,7 +127,7 @@ update_jitter(struct network *net, int urgent)
...
@@ -127,7 +127,7 @@ update_jitter(struct network *net, int urgent)
return
(
interval
/
2
+
random
()
%
interval
);
return
(
interval
/
2
+
random
()
%
interval
);
}
}
static
int
int
network_up
(
struct
network
*
net
,
int
up
)
network_up
(
struct
network
*
net
,
int
up
)
{
{
int
mtu
,
rc
,
wired
;
int
mtu
,
rc
,
wired
;
...
@@ -145,6 +145,13 @@ network_up(struct network *net, int up)
...
@@ -145,6 +145,13 @@ network_up(struct network *net, int up)
return
network_up
(
net
,
0
);
return
network_up
(
net
,
0
);
}
}
rc
=
kernel_setup_interface
(
1
,
net
->
ifname
,
net
->
ifindex
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"kernel_setup_interface(%s, %d) failed.
\n
"
,
net
->
ifname
,
net
->
ifindex
);
return
network_up
(
net
,
0
);
}
mtu
=
kernel_interface_mtu
(
net
->
ifname
,
net
->
ifindex
);
mtu
=
kernel_interface_mtu
(
net
->
ifname
,
net
->
ifindex
);
if
(
mtu
<
0
)
{
if
(
mtu
<
0
)
{
fprintf
(
stderr
,
"Warning: couldn't get MTU of interface %s (%d).
\n
"
,
fprintf
(
stderr
,
"Warning: couldn't get MTU of interface %s (%d).
\n
"
,
...
@@ -207,6 +214,7 @@ network_up(struct network *net, int up)
...
@@ -207,6 +214,7 @@ network_up(struct network *net, int up)
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
perror
(
"setsockopt(IPV6_LEAVE_GROUP)"
);
perror
(
"setsockopt(IPV6_LEAVE_GROUP)"
);
}
}
kernel_setup_interface
(
0
,
net
->
ifname
,
net
->
ifindex
);
}
}
}
}
...
@@ -223,25 +231,6 @@ check_networks(void)
...
@@ -223,25 +231,6 @@ check_networks(void)
unsigned
char
ipv4
[
4
];
unsigned
char
ipv4
[
4
];
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
rc
=
kernel_interface_ipv4
(
nets
[
i
].
ifname
,
nets
[
i
].
ifindex
,
ipv4
);
if
(
rc
>
0
)
{
if
(
!
nets
[
i
].
ipv4
||
memcmp
(
ipv4
,
nets
[
i
].
ipv4
,
4
)
!=
0
)
{
debugf
(
"Noticed IPv4 change for %s.
\n
"
,
nets
[
i
].
ifname
);
if
(
!
nets
[
i
].
ipv4
)
nets
[
i
].
ipv4
=
malloc
(
4
);
if
(
nets
[
i
].
ipv4
)
memcpy
(
nets
[
i
].
ipv4
,
ipv4
,
4
);
changed
=
1
;
}
}
else
{
debugf
(
"Noticed IPv4 change for %s.
\n
"
,
nets
[
i
].
ifname
);
if
(
nets
[
i
].
ipv4
)
{
free
(
nets
[
i
].
ipv4
);
nets
[
i
].
ipv4
=
NULL
;
changed
=
1
;
}
}
ifindex
=
if_nametoindex
(
nets
[
i
].
ifname
);
ifindex
=
if_nametoindex
(
nets
[
i
].
ifname
);
if
(
ifindex
!=
nets
[
i
].
ifindex
)
{
if
(
ifindex
!=
nets
[
i
].
ifindex
)
{
debugf
(
"Noticed ifindex change for %s.
\n
"
,
nets
[
i
].
ifname
);
debugf
(
"Noticed ifindex change for %s.
\n
"
,
nets
[
i
].
ifname
);
...
...
network.h
View file @
123c69f2
...
@@ -52,4 +52,5 @@ int network_idle(struct network *net);
...
@@ -52,4 +52,5 @@ int network_idle(struct network *net);
int
update_hello_interval
(
struct
network
*
net
);
int
update_hello_interval
(
struct
network
*
net
);
unsigned
int
jitter
(
struct
network
*
net
);
unsigned
int
jitter
(
struct
network
*
net
);
unsigned
int
update_jitter
(
struct
network
*
net
,
int
urgent
);
unsigned
int
update_jitter
(
struct
network
*
net
,
int
urgent
);
int
network_up
(
struct
network
*
net
,
int
up
);
void
check_networks
(
void
);
void
check_networks
(
void
);
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