diff options
Diffstat (limited to 'sysdep/unix/krt.c')
-rw-r--r-- | sysdep/unix/krt.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index cfa9b1ee..cd44a1e5 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -771,6 +771,14 @@ krt_feed_end(struct channel *C) krt_scan_timer_kick(p); } +static int +krt_rte_better(rte *new, rte *old) +{ + u32 n = ea_get_int(new->attrs, &ea_krt_metric, IGP_METRIC_UNKNOWN); + u32 o = ea_get_int(old->attrs, &ea_krt_metric, IGP_METRIC_UNKNOWN); + + return (n < o); +} /* * Protocol glue @@ -812,6 +820,10 @@ krt_postconfig(struct proto_config *CF) krt_sys_postconfig(cf); } +struct rte_owner_class krt_rte_owner_class = { + .rte_better = krt_rte_better, +}; + static struct proto * krt_init(struct proto_config *CF) { @@ -826,6 +838,8 @@ krt_init(struct proto_config *CF) p->p.reload_routes = krt_reload_routes; p->p.feed_end = krt_feed_end; + p->p.sources.class = &krt_rte_owner_class; + krt_sys_init(p); return &p->p; } |