Index | Thread | Search

From:
Job Snijders <job@openbsd.org>
Subject:
Re: rpki-client: remove bird1, add bird3
To:
tech@openbsd.org
Date:
Fri, 3 Jan 2025 02:08:01 +0000

Download raw body.

Thread
On Fri, Jan 03, 2025 at 01:33:38AM +0000, Job Snijders wrote:
> On Fri, Dec 20, 2024 at 04:31:22PM +0000, Stuart Henderson wrote:
> > On 2024/12/19 16:31, Job Snijders wrote:
> > > Remove BIRD 1 output, because BIRD 1 no longer is maintained &
> > > supported. While there, add BIRD 3 support, which has ASPA.
> > 
> > 2.16 has ASPA too. For simplicity bird3/output_bird3 probably do
> > make sense, but would it be worth a quick note in the manual?
> > 
> > >  .Pa bird
> > >  (for bird2)
> > > +.Pa bird3
> > > +(for bird3)
> > 
> > (for bird 2.16 or newer)
> 
> Ok, let's simplify things and output just one BIRD file while
> documenting 2.16 or higher is required.
> 
> The below works with bird2 and bird3 in ports.

deraadt@ suggested to move faster. I too see benefits to focus on only
supporting modern versions of BIRD. -T essentially is a kludge to
support older versions, so let's remove it right away. With this, the
changes since the last portable release are:

* Remove bird1 output, BIRD v1 is deprecated
* Remove -T option which was used to customize the BIRD table names
* Add ASPA table to bird output, v2.16+ is required going forward

OK?

Kind regards,

Job


Index: extern.h
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/extern.h,v
diff -u -p -r1.235 extern.h
--- extern.h	2 Jan 2025 12:29:30 -0000	1.235
+++ extern.h	3 Jan 2025 01:59:25 -0000
@@ -969,9 +969,7 @@ int		 outputfiles(struct vrp_tree *v, st
 int		 outputheader(FILE *, struct stats *);
 int		 output_bgpd(FILE *, struct vrp_tree *, struct brk_tree *,
 		    struct vap_tree *, struct vsp_tree *, struct stats *);
-int		 output_bird2(FILE *, struct vrp_tree *, struct brk_tree *,
-		    struct vap_tree *, struct vsp_tree *, struct stats *);
-int		 output_bird3(FILE *, struct vrp_tree *, struct brk_tree *,
+int		 output_bird(FILE *, struct vrp_tree *, struct brk_tree *,
 		    struct vap_tree *, struct vsp_tree *, struct stats *);
 int		 output_csv(FILE *, struct vrp_tree *, struct brk_tree *,
 		    struct vap_tree *, struct vsp_tree *, struct stats *);
Index: main.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/main.c,v
diff -u -p -r1.277 main.c
--- main.c	2 Jan 2025 17:04:06 -0000	1.277
+++ main.c	3 Jan 2025 01:59:25 -0000
@@ -63,8 +63,6 @@ static struct filepath_tree	fpt = RB_INI
 static struct msgbuf		*procq, *rsyncq, *httpq, *rrdpq;
 static int			cachefd, outdirfd;
 
-const char	*bird_tablename = "ROAS";
-
 int	verbose;
 int	noop;
 int	excludeas0 = 1;
@@ -1016,7 +1014,7 @@ main(int argc, char *argv[])
 		err(1, "pledge");
 
 	while ((c =
-	    getopt(argc, argv, "0Ab:Bcd:e:fH:jmnoP:Rs:S:t:T:vVx")) != -1)
+	    getopt(argc, argv, "0Ab:Bcd:e:fH:jmnoP:Rs:S:t:vVx")) != -1)
 		switch (c) {
 		case '0':
 			excludeas0 = 0;
@@ -1085,11 +1083,6 @@ main(int argc, char *argv[])
 				err(1, "too many tal files specified");
 			tals[talsz++] = optarg;
 			break;
-		case 'T':
-			warnx("-T is deprecated and will be removed in version"
-			    " 9.5. See -B in the manual for table names.");
-			bird_tablename = optarg;
-			break;
 		case 'v':
 			verbose++;
 			break;
@@ -1562,8 +1555,8 @@ usage:
 	    "usage: rpki-client [-0ABcjmnoRVvx] [-b sourceaddr] [-d cachedir]"
 	    " [-e rsync_prog]\n"
 	    "                   [-H fqdn] [-P epoch] [-S skiplist] [-s timeout]"
-	    " [-T table]\n"
-	    "                   [-t tal] [outputdir]\n"
+	    " [-t tal]\n"
+	    "                   [outputdir]\n"
 	    "       rpki-client [-Vv] [-d cachedir] [-j] [-t tal] -f file ..."
 	    "\n");
 	return 1;
Index: output-bird.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/output-bird.c,v
diff -u -p -r1.20 output-bird.c
--- output-bird.c	2 Jan 2025 12:29:30 -0000	1.20
+++ output-bird.c	3 Jan 2025 01:59:25 -0000
@@ -21,70 +21,22 @@
 #include "extern.h"
 
 int
-output_bird2(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
+output_bird(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
     struct vap_tree *vaps, struct vsp_tree *vsps, struct stats *st)
 {
-	extern		const char *bird_tablename;
-	struct vrp	*v;
-	time_t		 now = get_current_time();
-
-	if (outputheader(out, st) < 0)
-		return -1;
-
-	if (fprintf(out, "\ndefine force_roa_table_update = %lld;\n\n"
-	    "roa4 table %s4;\nroa6 table %s6;\n\n"
-	    "protocol static {\n\troa4 { table %s4; };\n\n",
-	    (long long)now, bird_tablename, bird_tablename,
-	    bird_tablename) < 0)
-		return -1;
-
-	RB_FOREACH(v, vrp_tree, vrps) {
-		char buf[64];
-
-		if (v->afi == AFI_IPV4) {
-			ip_addr_print(&v->addr, v->afi, buf, sizeof(buf));
-			if (fprintf(out, "\troute %s max %u as %u;\n", buf,
-			    v->maxlength, v->asid) < 0)
-				return -1;
-		}
-	}
-
-	if (fprintf(out, "}\n\nprotocol static {\n\troa6 { table %s6; };\n\n",
-	    bird_tablename) < 0)
-		return -1;
-
-	RB_FOREACH(v, vrp_tree, vrps) {
-		char buf[64];
-
-		if (v->afi == AFI_IPV6) {
-			ip_addr_print(&v->addr, v->afi, buf, sizeof(buf));
-			if (fprintf(out, "\troute %s max %u as %u;\n", buf,
-			    v->maxlength, v->asid) < 0)
-				return -1;
-		}
-	}
-
-	if (fprintf(out, "}\n") < 0)
-		return -1;
-	return 0;
-}
-
-int
-output_bird3(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
-    struct vap_tree *vaps, struct vsp_tree *vsps, struct stats *st)
-{
-	extern		const char *bird_tablename;
 	struct vrp	*v;
 	struct vap	*vap;
 	time_t		 now = get_current_time();
 	size_t		 i;
 
+	if (fprintf(out, "# For BIRD 2.16+\n#\n") < 0)
+		return -1;
+
 	if (outputheader(out, st) < 0)
 		return -1;
 
 	if (fprintf(out, "\ndefine force_roa_table_update = %lld;\n\n"
-	    "roa4 table %s4;\nroa6 table %s6;\n", (long long)now,
-	    bird_tablename, bird_tablename) < 0)
+	    "roa4 table ROAS4;\nroa6 table ROAS6;\n", (long long)now) < 0)
 		return -1;
 
 	if (!excludeaspa) {
@@ -92,8 +44,8 @@ output_bird3(FILE *out, struct vrp_tree 
 			return -1;
 	}
 
-	if (fprintf(out, "\nprotocol static {\n\troa4 { table %s4; };\n\n",
-	    bird_tablename) < 0)
+	if (fprintf(out, "\nprotocol static {\n\troa4 { table ROAS4; };\n"
+	    "\n") < 0)
 		return -1;
 
 	RB_FOREACH(v, vrp_tree, vrps) {
@@ -107,8 +59,8 @@ output_bird3(FILE *out, struct vrp_tree 
 		}
 	}
 
-	if (fprintf(out, "}\n\nprotocol static {\n\troa6 { table %s6; };\n\n",
-	    bird_tablename) < 0)
+	if (fprintf(out, "}\n\nprotocol static {\n\troa6 { table ROAS6; };\n"
+	    "\n") < 0)
 		return -1;
 
 	RB_FOREACH(v, vrp_tree, vrps) {
Index: output.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/output.c,v
diff -u -p -r1.37 output.c
--- output.c	2 Jan 2025 12:29:30 -0000	1.37
+++ output.c	3 Jan 2025 01:59:25 -0000
@@ -67,8 +67,7 @@ static const struct outputs {
 		    struct vap_tree *, struct vsp_tree *, struct stats *);
 } outputs[] = {
 	{ FORMAT_OPENBGPD, "openbgpd", output_bgpd },
-	{ FORMAT_BIRD, "bird", output_bird2 },
-	{ FORMAT_BIRD, "bird3", output_bird3 },
+	{ FORMAT_BIRD, "bird", output_bird },
 	{ FORMAT_CSV, "csv", output_csv },
 	{ FORMAT_JSON, "json", output_json },
 	{ FORMAT_OMETRIC, "metrics", output_ometric },
Index: rpki-client.8
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/rpki-client.8,v
diff -u -p -r1.117 rpki-client.8
--- rpki-client.8	2 Jan 2025 17:08:32 -0000	1.117
+++ rpki-client.8	3 Jan 2025 01:59:25 -0000
@@ -29,7 +29,6 @@
 .Op Fl H Ar fqdn
 .Op Fl S Ar skiplist
 .Op Fl s Ar timeout
-.Op Fl T Ar table
 .Op Fl t Ar tal
 .Op Ar outputdir
 .Nm
@@ -71,13 +70,15 @@ The default is not to include them.
 Exclude the ASPA-set from the output files that support it (JSON and
 OpenBGPD).
 .It Fl B
-Create output in the files
+Create output in the file
 .Pa bird
-(for bird2)
+in the output directory suitable for BIRD internet routing daemon version
+2.16 and up.
+The validated payload table names are
+.Em ROAS4 ,
+.Em ROAS6 ,
 and
-.Pa bird3
-(for bird3)
-in the output directory which is suitable for the BIRD internet routing daemon.
+.Em ASPAS .
 .It Fl b Ar sourceaddr
 Tell the HTTP and rsync clients to use
 .Ar sourceaddr
@@ -204,16 +205,6 @@ Individual RSYNC/RRDP repositories are t
 .Em timeout .
 All network synchronisation tasks are aborted after seven eights of
 .Em timeout .
-.It Fl T Ar table
-.Em Deprecated ,
-will be removed in
-.Nm
-version 9.5.
-For BIRD output generated with the
-.Fl B
-option use
-.Ar table
-as roa table name instead of the default 'ROAS'.
 .It Fl t Ar tal
 Specify a
 .Em Trust Anchor Location Pq TAL