summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/linux/netlink.c3
-rw-r--r--sysdep/unix/krt.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 94a37a73..3443957b 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -1874,6 +1874,9 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
return;
}
+ if (nhad.ad.length)
+ ea_set_attr(&ra, EA_LITERAL_DIRECT_ADATA(&ea_gen_nexthop, 0, &nhad.ad));
+
if (i->rtm_scope != def_scope)
ea_set_attr(&ra,
EA_LITERAL_EMBEDDED(&ea_krt_scope, 0, i->rtm_scope));
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index d507c133..b0033a65 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
@@ -827,6 +835,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)
{
@@ -841,6 +853,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;
}