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
da886615
Commit
da886615
authored
Jun 02, 2010
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maintain per-network channel information.
parent
6c765ce3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
network.c
network.c
+24
-0
network.h
network.h
+6
-0
No files found.
network.c
View file @
da886615
...
...
@@ -181,6 +181,28 @@ check_network_ipv4(struct network *net)
return
0
;
}
int
check_network_channel
(
struct
network
*
net
)
{
int
channel
=
NET_CONF
(
net
,
channel
);
if
(
channel
==
NET_CHANNEL_UNKNOWN
)
{
if
((
net
->
flags
&
NET_WIRED
))
{
channel
=
NET_CHANNEL_NONINTERFERING
;
}
else
{
channel
=
kernel_interface_channel
(
net
->
ifname
,
net
->
ifindex
);
if
(
channel
<=
0
)
channel
=
NET_CHANNEL_INTERFERING
;
}
}
if
(
net
->
channel
!=
channel
)
{
net
->
channel
=
channel
;
return
1
;
}
return
0
;
}
int
network_up
(
struct
network
*
net
,
int
up
)
{
...
...
@@ -363,6 +385,7 @@ network_up(struct network *net, int up)
net
->
numll
=
0
;
}
check_network_channel
(
net
);
update_network_metric
(
net
);
rc
=
check_network_ipv4
(
net
);
if
(
up
&&
rc
>
0
)
...
...
@@ -411,6 +434,7 @@ check_networks(void)
network_up
(
net
,
rc
>
0
);
}
check_network_channel
(
net
);
rc
=
check_network_ipv4
(
net
);
if
(
rc
>
0
)
{
send_request
(
net
,
NULL
,
0
);
...
...
network.h
View file @
da886615
...
...
@@ -35,6 +35,7 @@ struct network_conf {
char
wired
;
char
split_horizon
;
char
lq
;
int
channel
;
struct
network_conf
*
next
;
};
...
...
@@ -47,12 +48,17 @@ struct network_conf {
#define NET_SPLIT_HORIZON (1 << 2)
#define NET_LQ (1 << 3)
#define NET_CHANNEL_UNKNOWN 0
#define NET_CHANNEL_INTERFERING -2
#define NET_CHANNEL_NONINTERFERING -3
struct
network
{
struct
network
*
next
;
struct
network_conf
*
conf
;
unsigned
int
ifindex
;
unsigned
short
flags
;
unsigned
short
cost
;
int
channel
;
struct
timeval
hello_timeout
;
struct
timeval
update_timeout
;
struct
timeval
flush_timeout
;
...
...
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