Index | Thread | Search

From:
rene@sungai.nl
Subject:
bgpctl: fix network mrt import
To:
tech@openbsd.org
Date:
Fri, 23 Oct 2026 10:01:41 +0200

Download raw body.

Thread
  • rene@sungai.nl:

    bgpctl: fix network mrt import

Hi,


When importing an existing MRT file with bgpctl, the import fails because bgpd requires a filter set before accepting IMSG_NETWORK_DONE. Resulting in the following message:
bgpd[37029]: request to insert invalid network

Please see the proposed patch below. I’ve tested the change on OpenBSD 8.0, and it is working for me now.

Regards,

René Ammerlaan

Index: bgpctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/bgpctl.c,v
diff -u -p -r1.325 bgpctl.c
--- bgpctl.c	24 Sep 2026 11:41:41 -0000	1.325
+++ bgpctl.c	23 Oct 2026 07:40:52 -0000
@@ -1310,6 +1310,7 @@ network_mrt_dump(struct mrt_rib *mr, str
 {
 	struct ctl_show_rib		 ctl;
 	struct network_config		 net;
+	struct filter_set_head		 set;
 	struct ctl_show_rib_request	*req = arg;
 	struct mrt_rib_entry		*mre;
 	struct ibuf			*msg;
@@ -1319,6 +1320,8 @@ network_mrt_dump(struct mrt_rib *mr, str
 	if (mr->add_path)
 		return;
 
+	TAILQ_INIT(&set);
+
 	for (i = 0; i < mr->nentries; i++) {
 		mre = &mr->entries[i];
 		memset(&ctl, 0, sizeof(ctl));
@@ -1369,6 +1372,7 @@ network_mrt_dump(struct mrt_rib *mr, str
 
 		imsg_compose(imsgbuf, IMSG_NETWORK_ADD, 0, 0, -1,
 		    &net, sizeof(net));
+		imsg_send_filterset(imsgbuf, &set);
 		if ((msg = imsg_create(imsgbuf, IMSG_NETWORK_ASPATH,
 		    0, 0, sizeof(ctl) + mre->aspath_len)) == NULL)
 			errx(1, "imsg_create failure");