Commit da886615 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Maintain per-network channel information.

parent 6c765ce3
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment