1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 15:23:33 +02:00

Rework the re-evaluation of a prefix if PREFIX_FLAG_FILTERED changed.

The fix committed in rev 1.291 is not quite right. The problem is that
prefix_evaluate() uses prefix_best() which calls prefix_eligible().
It is wrong to alter the eligible state of a prefix while it is still
on the rib list.

Instead remove the prefix first, toggle the state, then readd it again.
Even though prefix_evaluate() is called twice the code complexity is
about the same since the 2 calls only do half the work.

OK tb@
This commit is contained in:
claudio
2026-05-14 18:47:32 +00:00
parent 3e6d065e20
commit 42dace0dca
+6 -4
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: rde_rib.c,v 1.293 2026/05/13 14:06:24 claudio Exp $ */
/* $OpenBSD: rde_rib.c,v 1.294 2026/05/14 18:47:32 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -890,11 +890,13 @@ prefix_update(struct rib *rib, struct rde_peer *peer, uint32_t path_id,
if (p_filtered != filtered) {
struct rib_entry *re;
re = rib_get_addr(rib, prefix, prefixlen);
/* remove prefix from rib */
prefix_evaluate(re, NULL, p);
/* toggle filtered flag */
p->flags ^= PREFIX_FLAG_FILTERED;
/* make route decision */
re = rib_get_addr(rib, prefix, prefixlen);
prefix_evaluate(re, p, p);
/* redo route decision */
prefix_evaluate(re, p, NULL);
}
return (0);
}