summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2021-06-17 08:45:38 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2021-06-17 08:45:38 +0000
commit044e952a1b023a55bd5aacf087f38c38ebcde0a1 (patch)
treece3857a7b76a1d305ccc1b4bbd9f970f8a50426c
parent967b10683d7e76230662f645b5d677f853b52118 (diff)
Add a bit of extra paranoia befor the up_generate_updates() call in
rde_up_dump_upcall(). This is the 4th place up_generate_updates() is called.
-rw-r--r--usr.sbin/bgpd/rde_peer.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde_peer.c b/usr.sbin/bgpd/rde_peer.c
index 904fd92848e..23ec2f7a6bd 100644
--- a/usr.sbin/bgpd/rde_peer.c
+++ b/usr.sbin/bgpd/rde_peer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_peer.c,v 1.9 2021/05/27 14:32:08 claudio Exp $ */
+/* $OpenBSD: rde_peer.c,v 1.10 2021/06/17 08:45:37 claudio Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
@@ -298,11 +298,19 @@ rde_up_dump_upcall(struct rib_entry *re, void *ptr)
{
struct rde_peer *peer = ptr;
+ if (peer->state != PEER_UP)
+ return;
if (re->rib_id != peer->loc_rib_id)
fatalx("%s: Unexpected RIB %u != %u.", __func__, re->rib_id,
peer->loc_rib_id);
+ if (peer->capa.mp[re->prefix->aid] == 0)
+ fatalx("%s: Unexpected %s prefix", __func__,
+ aid2str(re->prefix->aid));
+
+ /* no eligible prefix, not even for 'evaluate all' */
if (re->active == NULL)
return;
+
up_generate_updates(out_rules, peer, re->active, NULL);
}