summaryrefslogtreecommitdiff
path: root/sysdep/unix/krt.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-09-29 10:00:32 +0200
committerMaria Matejka <mq@ucw.cz>2022-09-29 10:00:32 +0200
commit67256d50359d42aca4e64bb1cb5dcb3c63669578 (patch)
treeb2acdb4d35fac2093539644155b1018f6f15950f /sysdep/unix/krt.c
parent7901c40500af1749848b79833ddfe66c22e81f50 (diff)
parent61c127c021ac34eba25d3245ccf8f9eb9dd352f5 (diff)
Merge branch 'tmp-bad-learn' into thread-next
Diffstat (limited to 'sysdep/unix/krt.c')
-rw-r--r--sysdep/unix/krt.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index d507c133..080c3a03 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -786,6 +786,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
@@ -840,6 +848,7 @@ krt_init(struct proto_config *CF)
p->p.if_notify = krt_if_notify;
p->p.reload_routes = krt_reload_routes;
p->p.feed_end = krt_feed_end;
+ p->p.rte_better = krt_rte_better;
krt_sys_init(p);
return &p->p;