From c22d861429c57c86348dd4440012771ff8a04b34 Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 8 Mar 2021 12:18:46 +0000 Subject: [PATCH] When introducing prefix_eligible() I botched up one if statement. For nexthops it is fine if they point to NULL. This is used in local announcements. Only if they point to a real struct the state must be NEXTHOP_REACH. Bug reported by and OK florian@ --- usr.sbin/bgpd/rde_decide.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c index 7f5647ae9ea..9562c70c896 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.82 2021/03/02 09:45:07 claudio Exp $ */ +/* $OpenBSD: rde_decide.c,v 1.83 2021/03/08 12:18:46 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker @@ -423,8 +423,11 @@ prefix_eligible(struct prefix *p) /* The aspath needs to be loop and error free */ if (asp == NULL || asp->flags & (F_ATTR_LOOP|F_ATTR_PARSE_ERR)) return 0; - /* The nexthop needs to exist and be reachable */ - if (nh == NULL || nh->state != NEXTHOP_REACH) + /* + * If the nexthop exists it must be reachable. + * It is OK if the nexthop does not exist (local announcement). + */ + if (nh != NULL && nh->state != NEXTHOP_REACH) return 0; return 1; -- 2.20.1