From a485c7fb54b90b0775ca963c6cde345cd50c687f Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 18 Jul 2022 09:42:46 +0000 Subject: [PATCH] Do not fatalx() when calculating the dmetric and the result is negative. The list of invalid prefixes is not properly sorted and when those prefixes all become valid the list is not properly sorted until the nexthop update pass is done. Found the hard way by myself. OK tb@ benno@ --- usr.sbin/bgpd/rde_decide.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c index 75614f2ff05..0a6c6b79f4b 100644 --- a/usr.sbin/bgpd/rde_decide.c +++ b/usr.sbin/bgpd/rde_decide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_decide.c,v 1.95 2022/07/11 16:46:41 claudio Exp $ */ +/* $OpenBSD: rde_decide.c,v 1.96 2022/07/18 09:42:46 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker @@ -331,8 +331,12 @@ prefix_set_dmetric(struct prefix *pp, struct prefix *np) PREFIX_DMETRIC_BEST : PREFIX_DMETRIC_INVALID; else np->dmetric = prefix_cmp(pp, np, &testall); - if (np->dmetric < 0) - fatalx("bad dmetric in decision process"); + if (np->dmetric < 0) { + struct bgpd_addr addr; + pt_getaddr(np->pt, &addr); + log_debug("bad dmetric in decision process: %s/%u", + log_addr(&addr), np->pt->prefixlen); + } } } -- 2.20.1