summaryrefslogtreecommitdiff
path: root/sysdep/unix/krt.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-10-04 15:53:12 +0200
committerMaria Matejka <mq@ucw.cz>2022-10-04 15:53:12 +0200
commit4e1c582caddb6876b9fcbdc29b8bad5ab0b09ee7 (patch)
treec46d8e5337bc12ec01e3d91b9c2f5f6dd61eb8ad /sysdep/unix/krt.c
parentbecca314e2546d6005a23398ce2d3012d4b396cb (diff)
parent71b434a987067475b517792360f58dbe03bfee9e (diff)
Merge commit '71b434a9' into HEAD
Diffstat (limited to 'sysdep/unix/krt.c')
-rw-r--r--sysdep/unix/krt.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index dd2c63c4..471efeba 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -314,6 +314,7 @@ krt_learn_scan(struct krt_proto *p, rte *e)
ea_set_attr_u32(&e0.attrs, &ea_gen_preference, 0, p->p.main_channel->preference);
rte_update(p->p.main_channel, e->net, &e0, e0.src);
+ rt_unlock_source(e0.src);
}
static void
@@ -322,9 +323,9 @@ krt_learn_async(struct krt_proto *p, rte *e, int new)
if (new)
return krt_learn_scan(p, e);
- struct rte_src *src = rt_find_source(&p->p, krt_metric(e));
- if (src)
- rte_update(p->p.main_channel, e->net, NULL, src);
+ struct rte_src *src = rt_get_source(&p->p, krt_metric(e));
+ rte_update(p->p.main_channel, e->net, NULL, src);
+ rt_unlock_source(src);
}
#endif
@@ -683,7 +684,7 @@ krt_scan_timer_kick(struct krt_proto *p)
static int
krt_preexport(struct channel *C, rte *e)
{
- if (e->src->proto == C->proto)
+ if (e->src->owner == &C->proto->sources)
return -1;
if (!krt_capable(e))
@@ -811,6 +812,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)
{
@@ -824,7 +829,8 @@ 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;
+
+ p->p.sources.class = &krt_rte_owner_class;
krt_sys_init(p);
return &p->p;