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
31f695ae
Commit
31f695ae
authored
Oct 09, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache link-local addresses in network structure.
parent
78c852a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
network.c
network.c
+37
-0
network.h
network.h
+3
-0
No files found.
network.c
View file @
31f695ae
...
@@ -192,6 +192,7 @@ network_up(struct network *net, int up)
...
@@ -192,6 +192,7 @@ network_up(struct network *net, int up)
net
->
up
=
up
;
net
->
up
=
up
;
if
(
up
)
{
if
(
up
)
{
unsigned
char
ll
[
32
][
16
];
if
(
net
->
ifindex
<=
0
)
{
if
(
net
->
ifindex
<=
0
)
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"Upping unknown interface %s.
\n
"
,
net
->
ifname
);
"Upping unknown interface %s.
\n
"
,
net
->
ifname
);
...
@@ -268,6 +269,23 @@ network_up(struct network *net, int up)
...
@@ -268,6 +269,23 @@ network_up(struct network *net, int up)
tries to up it again. */
tries to up it again. */
return
network_up
(
net
,
0
);
return
network_up
(
net
,
0
);
}
}
if
(
net
->
ll
)
free
(
net
->
ll
);
net
->
nll
=
0
;
net
->
ll
=
NULL
;
rc
=
kernel_ll_addresses
(
net
->
ifname
,
net
->
ifindex
,
ll
,
32
);
if
(
rc
<
0
)
{
perror
(
"kernel_ll_addresses"
);
}
else
if
(
rc
>
0
)
{
net
->
ll
=
malloc
(
16
*
rc
);
if
(
net
->
ll
==
NULL
)
{
perror
(
"malloc(ll)"
);
}
else
{
net
->
nll
=
rc
;
memcpy
(
net
->
ll
,
ll
,
rc
*
16
);
}
}
delay_jitter
(
&
net
->
hello_time
,
&
net
->
hello_timeout
,
delay_jitter
(
&
net
->
hello_time
,
&
net
->
hello_timeout
,
net
->
hello_interval
);
net
->
hello_interval
);
delay_jitter
(
&
net
->
self_update_time
,
&
net
->
self_update_timeout
,
delay_jitter
(
&
net
->
self_update_time
,
&
net
->
self_update_timeout
,
...
@@ -291,6 +309,10 @@ network_up(struct network *net, int up)
...
@@ -291,6 +309,10 @@ network_up(struct network *net, int up)
perror
(
"setsockopt(IPV6_LEAVE_GROUP)"
);
perror
(
"setsockopt(IPV6_LEAVE_GROUP)"
);
kernel_setup_interface
(
0
,
net
->
ifname
,
net
->
ifindex
);
kernel_setup_interface
(
0
,
net
->
ifname
,
net
->
ifindex
);
}
}
if
(
net
->
ll
)
free
(
net
->
ll
);
net
->
ll
=
NULL
;
net
->
nll
=
0
;
}
}
update_network_metric
(
net
);
update_network_metric
(
net
);
...
@@ -301,6 +323,21 @@ network_up(struct network *net, int up)
...
@@ -301,6 +323,21 @@ network_up(struct network *net, int up)
return
1
;
return
1
;
}
}
int
network_ll_address
(
struct
network
*
net
,
const
unsigned
char
*
address
)
{
int
i
;
if
(
!
net
->
up
)
return
0
;
for
(
i
=
0
;
i
<
net
->
nll
;
i
++
)
if
(
memcmp
(
net
->
ll
[
i
],
address
,
16
)
==
0
)
return
1
;
return
0
;
}
void
void
check_networks
(
void
)
check_networks
(
void
)
{
{
...
...
network.h
View file @
31f695ae
...
@@ -34,6 +34,8 @@ struct network {
...
@@ -34,6 +34,8 @@ struct network {
struct
timeval
update_timeout
;
struct
timeval
update_timeout
;
char
ifname
[
IF_NAMESIZE
];
char
ifname
[
IF_NAMESIZE
];
unsigned
char
*
ipv4
;
unsigned
char
*
ipv4
;
int
nll
;
unsigned
char
(
*
ll
)[
16
];
int
buffered
;
int
buffered
;
struct
timeval
flush_timeout
;
struct
timeval
flush_timeout
;
int
bufsize
;
int
bufsize
;
...
@@ -58,4 +60,5 @@ unsigned int jitter(struct network *net, int urgent);
...
@@ -58,4 +60,5 @@ unsigned int jitter(struct network *net, int urgent);
unsigned
int
update_jitter
(
struct
network
*
net
,
int
urgent
);
unsigned
int
update_jitter
(
struct
network
*
net
,
int
urgent
);
void
delay_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
);
void
delay_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
);
int
network_up
(
struct
network
*
net
,
int
up
);
int
network_up
(
struct
network
*
net
,
int
up
);
int
network_ll_address
(
struct
network
*
net
,
const
unsigned
char
*
address
);
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