1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 15:25:38 -08:00

Remove BIRD v1 output, add BIRD v3 output (which includes static ASPA entries)

OK tb@
This commit is contained in:
job 2025-01-02 12:29:30 +00:00
parent 3064edb093
commit a3ccbae723
4 changed files with 96 additions and 72 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: extern.h,v 1.234 2024/12/02 14:55:02 job Exp $ */
/* $OpenBSD: extern.h,v 1.235 2025/01/02 12:29:30 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@ -969,12 +969,10 @@ int outputfiles(struct vrp_tree *v, struct brk_tree *b,
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 *);
int output_json(FILE *, struct vrp_tree *, struct brk_tree *,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: output-bird.c,v 1.19 2024/02/22 12:49:42 job Exp $ */
/* $OpenBSD: output-bird.c,v 1.20 2025/01/02 12:29:30 job Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2020 Robert Scheck <robert@fedoraproject.org>
@ -20,64 +20,6 @@
#include "extern.h"
int
output_bird1v4(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)
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, "\troa %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)
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, "\troa %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_bird2(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
struct vap_tree *vaps, struct vsp_tree *vsps, struct stats *st)
@ -126,3 +68,88 @@ output_bird2(FILE *out, struct vrp_tree *vrps, struct brk_tree *brks,
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 (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)
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;
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, "}") < 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;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: output.c,v 1.36 2024/12/15 19:42:33 tb Exp $ */
/* $OpenBSD: output.c,v 1.37 2025/01/02 12:29:30 job Exp $ */
/*
* Copyright (c) 2019 Theo de Raadt <deraadt@openbsd.org>
*
@ -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 },

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: rpki-client.8,v 1.115 2024/12/04 16:17:31 job Exp $
.\" $OpenBSD: rpki-client.8,v 1.116 2025/01/02 12:29:30 job Exp $
.\"
.\" Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: December 4 2024 $
.Dd $Mdocdate: January 2 2025 $
.Dt RPKI-CLIENT 8
.Os
.Sh NAME
@ -72,11 +72,11 @@ Exclude the ASPA-set from the output files that support it (JSON and
OpenBGPD).
.It Fl B
Create output in the files
.Pa bird1v4 ,
.Pa bird1v6 ,
and
.Pa bird
(for bird2)
and
.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