From 42dace0dca9da05fa32680d4405da0033a820892 Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 14 May 2026 18:47:32 +0000 Subject: [PATCH] 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@ --- usr.sbin/bgpd/rde_rib.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index 58f32a96e57..6873ab07a71 100644 --- a/usr.sbin/bgpd/rde_rib.c +++ b/usr.sbin/bgpd/rde_rib.c @@ -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 @@ -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); }