Skip to content

Commit 337881d

Browse files
committed
Fix accounting of the pending update counter
There are two issues: - In peer_blast_upcall() pending_update must be increased for every prefix inserted. - In prefix_adjout_flush_pending() the EoR marker needs special handling. The EoR marker is not accounted but must be freed here. OK tb@
1 parent 20413e8 commit 337881d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

usr.sbin/bgpd/rde_peer.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: rde_peer.c,v 1.47 2025/02/20 19:47:31 claudio Exp $ */
1+
/* $OpenBSD: rde_peer.c,v 1.48 2025/03/14 12:39:55 claudio Exp $ */
22

33
/*
44
* Copyright (c) 2019 Claudio Jeker <[email protected]>
@@ -523,14 +523,18 @@ peer_stale(struct rde_peer *peer, uint8_t aid, int flushall)
523523
static void
524524
peer_blast_upcall(struct prefix *p, void *ptr)
525525
{
526+
struct rde_peer *peer;
527+
526528
if (p->flags & PREFIX_FLAG_DEAD) {
527529
/* ignore dead prefixes, they will go away soon */
528530
} else if ((p->flags & PREFIX_FLAG_MASK) == 0) {
531+
peer = prefix_peer(p);
529532
/* put entries on the update queue if not already on a queue */
530533
p->flags |= PREFIX_FLAG_UPDATE;
531-
if (RB_INSERT(prefix_tree, &prefix_peer(p)->updates[p->pt->aid],
534+
if (RB_INSERT(prefix_tree, &peer->updates[p->pt->aid],
532535
p) != NULL)
533536
fatalx("%s: RB tree invariant violated", __func__);
537+
peer->stats.pending_update++;
534538
}
535539
}
536540

usr.sbin/bgpd/rde_rib.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: rde_rib.c,v 1.267 2025/01/14 12:24:23 claudio Exp $ */
1+
/* $OpenBSD: rde_rib.c,v 1.268 2025/03/14 12:39:55 claudio Exp $ */
22

33
/*
44
* Copyright (c) 2003, 2004 Claudio Jeker <[email protected]>
@@ -1430,7 +1430,11 @@ prefix_adjout_flush_pending(struct rde_peer *peer)
14301430
RB_FOREACH_SAFE(p, prefix_tree, &peer->updates[aid], np) {
14311431
p->flags &= ~PREFIX_FLAG_UPDATE;
14321432
RB_REMOVE(prefix_tree, &peer->updates[aid], p);
1433-
peer->stats.pending_update--;
1433+
if (p->flags & PREFIX_FLAG_EOR) {
1434+
prefix_adjout_destroy(p);
1435+
} else {
1436+
peer->stats.pending_update--;
1437+
}
14341438
}
14351439
}
14361440
}

0 commit comments

Comments
 (0)