rde_dump_adjout_upcall() and rde_dump_adjout_prefix_upcall() work only
on prefixes that belong to the Adj-RIB-Out so check for the
PREFIX_FLAG_ADJOUT to make sure it is set.

Other code has the same 'assert' in rde_rib.c and I think it makes most
sense to put it here as well.
-- 
:wq Claudio

Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.537
diff -u -p -r1.537 rde.c
--- rde.c       26 Feb 2022 11:48:50 -0000      1.537
+++ rde.c       28 Feb 2022 08:24:17 -0000
@@ -2574,6 +2574,8 @@ rde_dump_adjout_upcall(struct prefix *p,
 {
        struct rde_dump_ctx     *ctx = ptr;
 
+       if ((p->flags & PREFIX_FLAG_ADJOUT) == 0)
+               fatalx("%s: prefix without PREFIX_FLAG_ADJOUT hit", __func__);
        if (p->flags & (PREFIX_FLAG_WITHDRAW | PREFIX_FLAG_DEAD))
                return;
        rde_dump_filter(p, &ctx->req, 1);
@@ -2585,6 +2587,8 @@ rde_dump_adjout_prefix_upcall(struct pre
        struct rde_dump_ctx     *ctx = ptr;
        struct bgpd_addr         addr;
 
+       if ((p->flags & PREFIX_FLAG_ADJOUT) == 0)
+               fatalx("%s: prefix without PREFIX_FLAG_ADJOUT hit", __func__);
        if (p->flags & (PREFIX_FLAG_WITHDRAW | PREFIX_FLAG_DEAD))
                return;
 

Reply via email to