Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
bgpd: remove unnecessary checks
To:
tech@openbsd.org
Date:
Wed, 5 Nov 2025 14:57:41 +0100

Download raw body.

Thread
The asp passed to prefix_add() and prefix_move() must not be NULL.
So there is no need to check for that before looking at asp->pftableid.
I think this was needed some long time ago when that code was somewhere
else.

Reported by CID 492349, 492350
-- 
:wq Claudio

Index: rde_rib.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v
diff -u -p -r1.273 rde_rib.c
--- rde_rib.c	29 Oct 2025 10:34:23 -0000	1.273
+++ rde_rib.c	5 Nov 2025 13:46:02 -0000
@@ -1060,7 +1060,7 @@ prefix_add(struct bgpd_addr *prefix, int
 		p->flags |= PREFIX_FLAG_FILTERED;
 
 	/* add possible pftable reference form aspath */
-	if (asp && asp->pftableid)
+	if (asp->pftableid)
 		rde_pftable_add(asp->pftableid, p);
 	/* make route decision */
 	prefix_evaluate(re, p, NULL);
@@ -1092,7 +1092,7 @@ prefix_move(struct prefix *p, struct rde
 		np->flags |= PREFIX_FLAG_FILTERED;
 
 	/* add possible pftable reference from new aspath */
-	if (asp && asp->pftableid)
+	if (asp->pftableid)
 		rde_pftable_add(asp->pftableid, np);
 
 	/*