summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2021-03-08 12:18:46 +0000
committerclaudio <claudio@openbsd.org>2021-03-08 12:18:46 +0000
commitc22d861429c57c86348dd4440012771ff8a04b34 (patch)
treed8ddab1d5ba06fb5240c4e8805338b7098335d0f
parentRevise the ASID allocation sheme to avoid a hang when running out of free (diff)
downloadwireguard-openbsd-c22d861429c57c86348dd4440012771ff8a04b34.tar.xz
wireguard-openbsd-c22d861429c57c86348dd4440012771ff8a04b34.zip
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@
-rw-r--r--usr.sbin/bgpd/rde_decide.c9
1 files 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 <claudio@openbsd.org>
@@ -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;