Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
pt_writebuf: fatal if the aid is not known
To:
tech@openbsd.org
Date:
Tue, 10 Dec 2024 14:12:35 +0100

Download raw body.

Thread
Don't ask how but I managed to corrupt the RIB while working on something
and this would have saved me some time to find the cause.

Panic if pt_writebuf() tries to dump a prefix that has an unknown AID.
This happens e.g. on refcnt errors where the prefix->pt pointer points
to freed memory.

-- 
:wq Claudio

Index: rde_prefix.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_prefix.c,v
diff -u -p -r1.54 rde_prefix.c
--- rde_prefix.c	21 Nov 2024 13:26:49 -0000	1.54
+++ rde_prefix.c	10 Dec 2024 13:09:02 -0000
@@ -564,7 +564,7 @@ pt_writebuf(struct ibuf *buf, struct pt_
 			goto fail;
 		break;
 	default:
-		goto fail;
+		fatalx("%s: unknown aid %d", __func__, pte->aid);
 	}
 
 	/* keep 2 bytes reserved in the withdraw case for IPv4 encoding */