Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: rpki-client: remove bird1, add bird3
To:
Job Snijders <job@openbsd.org>
Cc:
tech@openbsd.org
Date:
Tue, 31 Dec 2024 18:58:54 +0100

Download raw body.

Thread
  • Theo Buehler:

    rpki-client: remove bird1, add bird3

  • On Thu, Dec 19, 2024 at 04:31:52PM +0000, Job Snijders wrote:
    > Remove BIRD 1 output, because BIRD 1 no longer is maintained &
    > supported. While there, add BIRD 3 support, which has ASPA.
    > 
    > OK?
    
    I'm ok with this, but please do consider the doc tweaks sthen suggested.
    
    > 
    > Index: extern.h
    > ===================================================================
    > RCS file: /cvs/src/usr.sbin/rpki-client/extern.h,v
    > diff -u -p -r1.234 extern.h
    > --- extern.h	2 Dec 2024 14:55:02 -0000	1.234
    > +++ extern.h	19 Dec 2024 16:24:16 -0000
    > @@ -969,11 +969,9 @@ 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_bird1v4(FILE *, struct vrp_tree *, struct brk_tree *,
    > -		    struct vap_tree *, struct vsp_tree *, struct stats *);
    > -int		 output_bird1v6(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 *,
    >  		    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: output-bird.c
    > ===================================================================
    > RCS file: /cvs/src/usr.sbin/rpki-client/output-bird.c,v
    > diff -u -p -r1.19 output-bird.c
    > --- output-bird.c	22 Feb 2024 12:49:42 -0000	1.19
    > +++ output-bird.c	19 Dec 2024 16:24:16 -0000
    > @@ -21,16 +21,21 @@
    >  #include "extern.h"
    >  
    >  int
    > -output_bird1v4(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
    > +output_bird2(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, "\nroa table %s {\n", bird_tablename) < 0)
    > +	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) {
    > @@ -38,28 +43,14 @@ output_bird1v4(FILE *out, struct vrp_tre
    >  
    >  		if (v->afi == AFI_IPV4) {
    >  			ip_addr_print(&v->addr, v->afi, buf, sizeof(buf));
    > -			if (fprintf(out, "\troa %s max %u as %u;\n", 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_bird1v6(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;
    > -
    > -	if (outputheader(out, st) < 0)
    > -		return -1;
    > -
    > -	if (fprintf(out, "\nroa table %s {\n", bird_tablename) < 0)
    > +	if (fprintf(out, "}\n\nprotocol static {\n\troa6 { table %s6; };\n\n",
    > +	    bird_tablename) < 0)
    >  		return -1;
    >  
    >  	RB_FOREACH(v, vrp_tree, vrps) {
    > @@ -67,7 +58,7 @@ output_bird1v6(FILE *out, struct vrp_tre
    >  
    >  		if (v->afi == AFI_IPV6) {
    >  			ip_addr_print(&v->addr, v->afi, buf, sizeof(buf));
    > -			if (fprintf(out, "\troa %s max %u as %u;\n", buf,
    > +			if (fprintf(out, "\troute %s max %u as %u;\n", buf,
    >  			    v->maxlength, v->asid) < 0)
    >  				return -1;
    >  		}
    > @@ -79,20 +70,29 @@ output_bird1v6(FILE *out, struct vrp_tre
    >  }
    >  
    >  int
    > -output_bird2(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
    > +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 (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,
    > +	    "roa4 table %s4;\nroa6 table %s6;\n", (long long)now,
    > +	    bird_tablename, bird_tablename) < 0)
    > +		return -1;
    > +
    > +	if (!excludeaspa) {
    > +		if (fprintf(out, "aspa table ASPAS;\n") < 0)
    > +			return -1;
    > +	}
    > +
    > +	if (fprintf(out, "\nprotocol static {\n\troa4 { table %s4; };\n\n",
    >  	    bird_tablename) < 0)
    >  		return -1;
    >  
    > @@ -122,7 +122,34 @@ output_bird2(FILE *out, struct vrp_tree 
    >  		}
    >  	}
    >  
    > +	if (fprintf(out, "}") < 0)
    > +		return -1;
    > +
    > +	if (excludeaspa)
    > +		return 0;
    > +
    > +	if (fprintf(out, "\n\nprotocol static {\n\taspa { table ASPAS; "
    > +	    "};\n\n") < 0)
    > +		return -1;
    > +
    > +	RB_FOREACH(vap, vap_tree, vaps) {
    > +		if (vap->overflowed)
    > +			continue;
    > +		if (fprintf(out, "\troute aspa %d providers ", vap->custasid) <0)
    > +			return -1;
    > +		for (i = 0; i < vap->num_providers; i++) {
    > +			if (fprintf(out, "%u", vap->providers[i]) < 0)
    > +				return -1;
    > +			if (i + 1 < vap->num_providers)
    > +				if (fprintf(out, ", ") < 0)
    > +					return -1;
    > +		}
    > +		if (fprintf(out, ";\n") < 0)
    > +			return -1;
    > +	}
    > +
    >  	if (fprintf(out, "}\n") < 0)
    >  		return -1;
    > +
    >  	return 0;
    >  }
    > Index: output.c
    > ===================================================================
    > RCS file: /cvs/src/usr.sbin/rpki-client/output.c,v
    > diff -u -p -r1.36 output.c
    > --- output.c	15 Dec 2024 19:42:33 -0000	1.36
    > +++ output.c	19 Dec 2024 16:24:16 -0000
    > @@ -67,9 +67,8 @@ static const struct outputs {
    >  		    struct vap_tree *, struct vsp_tree *, struct stats *);
    >  } outputs[] = {
    >  	{ FORMAT_OPENBGPD, "openbgpd", output_bgpd },
    > -	{ FORMAT_BIRD, "bird1v4", output_bird1v4 },
    > -	{ FORMAT_BIRD, "bird1v6", output_bird1v6 },
    >  	{ FORMAT_BIRD, "bird", output_bird2 },
    > +	{ FORMAT_BIRD, "bird3", output_bird3 },
    >  	{ 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.115 rpki-client.8
    > --- rpki-client.8	4 Dec 2024 16:17:31 -0000	1.115
    > +++ rpki-client.8	19 Dec 2024 16:24:16 -0000
    > @@ -72,11 +72,10 @@ Exclude the ASPA-set from the output fil
    >  OpenBGPD).
    >  .It Fl B
    >  Create output in the files
    > -.Pa bird1v4 ,
    > -.Pa bird1v6 ,
    > -and
    >  .Pa bird
    >  (for bird2)
    > +.Pa bird3
    > +(for bird3)
    >  in the output directory which is suitable for the BIRD internet routing daemon.
    >  .It Fl b Ar sourceaddr
    >  Tell the HTTP and rsync clients to use
    > 
    
    
    
  • Theo Buehler:

    rpki-client: remove bird1, add bird3