summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-08-05 11:14:33 +0200
committerMaria Matejka <mq@ucw.cz>2022-08-05 11:14:33 +0200
commit95d970d7a0e7bd6cab03f3b8535eed031c43773c (patch)
treecfade37b47a0b3b486884cab16f2d8607c06569b
parente9e6baae3756a80a581391eec6dcbda866fe769d (diff)
parentbc4ad83dacb07ad6bb454b75d78daa2f9c953088 (diff)
Merge branch 'backport' into thread-next
-rw-r--r--proto/rip/rip.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index ab0e3f4b..183fc265 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -1121,24 +1121,18 @@ rip_rte_proto(struct rte *rte)
SKIP_BACK(struct rip_proto, p.sources, rte->src->owner) : NULL;
}
-static int
-rip_rte_better(struct rte *new, struct rte *old)
-{
- ASSERT_DIE(new->src == old->src);
- struct rip_proto *p = rip_rte_proto(new);
-
- u32 new_metric = ea_get_int(new->attrs, &ea_rip_metric, p->infinity);
- u32 old_metric = ea_get_int(old->attrs, &ea_rip_metric, p->infinity);
-
- return new_metric < old_metric;
-}
-
static u32
rip_rte_igp_metric(const rte *rt)
{
return ea_get_int(rt->attrs, &ea_rip_metric, IGP_METRIC_UNKNOWN);
}
+static int
+rip_rte_better(struct rte *new, struct rte *old)
+{
+ return rip_rte_igp_metric(new) < rip_rte_igp_metric(old);
+}
+
static void
rip_postconfig(struct proto_config *CF)
{