Commit d40e0807 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement reflect-kernel-metric.

Thanks to Pierre Pfister.
parent 0490036f
babeld-1.5.2 (unreleased):
* Added support for reflecting metrics as kernel priorities. Thanks to
Pierre Pfister.
4 July 2014: babeld-1.5.1:
* Added support for reading multiple configuration files by specifying
......
......@@ -164,6 +164,13 @@ This specifies the priority value used when installing routes into the
kernel, and is equivalent to the command-line option
.BR \-k .
.TP
.BR reflect-kernel-metric " {" true | false }
Reflect route metrics as kernel priorities. The priority effectively used
is
.B kernel-priority
+
.BR metric .
.TP
.BI allow-duplicates " priority"
This allows duplicating external routes when their kernel priority is
at least
......
......@@ -656,6 +656,8 @@ parse_option(int c, gnc_t gnc, void *closure, char *token)
random_id = b;
else if(strcmp(token, "daemonise") == 0)
do_daemonise = b;
else if(strcmp(token, "reflect-kernel-metric") == 0)
reflect_kernel_metric = b;
else
abort();
} else if(strcmp(token, "protocol-group") == 0) {
......
......@@ -42,7 +42,7 @@ THE SOFTWARE.
struct babel_route **routes = NULL;
static int route_slots = 0, max_route_slots = 0;
int kernel_metric = 0;
int kernel_metric = 0, reflect_kernel_metric = 0;
int allow_duplicates = -1;
int diversity_kind = DIVERSITY_NONE;
int diversity_factor = 256; /* in units of 1/256 */
......@@ -373,7 +373,14 @@ route_stream_done(struct route_stream *stream)
static int
metric_to_kernel(int metric)
{
return metric < INFINITY ? kernel_metric : KERNEL_INFINITY;
if(metric >= INFINITY) {
return KERNEL_INFINITY;
} else if(reflect_kernel_metric) {
int r = kernel_metric + metric;
return r >= KERNEL_INFINITY ? KERNEL_INFINITY : r;
} else {
return kernel_metric;
}
}
/* This is used to maintain the invariant that the installed route is at
......
......@@ -47,7 +47,7 @@ struct babel_route {
struct route_stream;
extern struct babel_route **routes;
extern int kernel_metric, allow_duplicates;
extern int kernel_metric, allow_duplicates, reflect_kernel_metric;
extern int diversity_kind, diversity_factor;
extern int keep_unfeasible;
......
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