Commit ac2cf59d authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Don't send UNKNOWN or NONINTERFERING channel values.

parent e45908c3
...@@ -970,8 +970,18 @@ flushupdates(struct network *net) ...@@ -970,8 +970,18 @@ flushupdates(struct network *net)
(diversity_factor * route->cost / + 128) / 256 + (diversity_factor * route->cost / + 128) / 256 +
route->add_metric; route->add_metric;
} }
channels[0] = net->channel; if(net->channel == NET_CHANNEL_NONINTERFERING) {
memcpy(channels + 1, route->channels, DIVERSITY_HOPS - 1); memcpy(channels, route->channels, DIVERSITY_HOPS);
} else {
if(net->channel == NET_CHANNEL_UNKNOWN)
channels[0] = NET_CHANNEL_INTERFERING;
else {
assert(net->channel > 0 && net->channel < 254);
channels[0] = net->channel;
}
memcpy(channels + 1, route->channels, DIVERSITY_HOPS - 1);
}
channels_len = strnlen((char*)channels, DIVERSITY_HOPS); channels_len = strnlen((char*)channels, DIVERSITY_HOPS);
really_send_update(net, route->src->id, really_send_update(net, route->src->id,
route->src->prefix, route->src->prefix,
......
...@@ -50,9 +50,10 @@ struct network_conf { ...@@ -50,9 +50,10 @@ struct network_conf {
#define NET_LQ (1 << 3) #define NET_LQ (1 << 3)
#define NET_FARAWAY (1 << 4) #define NET_FARAWAY (1 << 4)
#define NET_CHANNEL_UNKNOWN 0 /* Only INTERFERING can appear on the wire. */
#define NET_CHANNEL_INTERFERING 253 #define NET_CHANNEL_UNKNOWN -1
#define NET_CHANNEL_NONINTERFERING 254 #define NET_CHANNEL_INTERFERING 254
#define NET_CHANNEL_NONINTERFERING -2
struct network { struct network {
struct network *next; struct network *next;
...@@ -60,7 +61,7 @@ struct network { ...@@ -60,7 +61,7 @@ struct network {
unsigned int ifindex; unsigned int ifindex;
unsigned short flags; unsigned short flags;
unsigned short cost; unsigned short cost;
unsigned char channel; int channel;
struct timeval hello_timeout; struct timeval hello_timeout;
struct timeval update_timeout; struct timeval update_timeout;
struct timeval flush_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