Skip to content

Commit

Permalink
Remove aspa feature. (#990)
Browse files Browse the repository at this point in the history
This PR removes the "aspa" Cargo feature and thus makes ASPA always available
and included in processing when enabled via the enable-aspa configuration
option.
  • Loading branch information
partim authored Jan 7, 2025
1 parent 19208cc commit fab1991
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 65 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ syslog = "6"
[features]
default = [ "socks", "ui"]
arbitrary = [ "dep:arbitrary", "chrono/arbitrary", "rpki/arbitrary" ]
aspa = []
native-tls = [ "reqwest/native-tls" ]
rta = []
socks = [ "reqwest/socks" ]
Expand Down
11 changes: 11 additions & 0 deletions doc/manual/source/manual-page.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ The available options are:
If this option is present, BGPsec router keys will be processed
during validation and included in the produced data set.

.. option:: --enable-aspa

If this option is present, ASPA assertions will be processed
during validation and included in the produced data set.

.. option:: --aspa-provider-limit

Limits the number of provider ASNs allowed in an ASPA object. If more
Expand Down Expand Up @@ -1197,6 +1202,12 @@ All values can be overridden via the command line options.
included in the published dataset. If false or missing, no router
keys will be included.


enable-aspa
A boolean value specifying whether ASPA assertions should be
included in the published dataset. If false or missing, no ASPA
assertions will be included.

aspa_provider_limit
An integer value specifying the maximum number of provider ASNs
allowed in an ASPA object. If more providers are given, all ASPA
Expand Down
7 changes: 0 additions & 7 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ impl Config {
}

// enable_aspa
#[cfg(feature = "aspa")]
if args.enable_aspa {
self.enable_aspa = true
}
Expand Down Expand Up @@ -987,12 +986,8 @@ impl Config {
},
enable_bgpsec: file.take_bool("enable-bgpsec")?.unwrap_or(false),

#[cfg(feature = "aspa")]
enable_aspa: file.take_bool("enable-aspa")?.unwrap_or(false),

#[cfg(not(feature = "aspa"))]
enable_aspa: false,

aspa_provider_limit: {
file.take_usize("aspa-provider-limit")?
.unwrap_or(DEFAULT_ASPA_PROVIDER_LIMIT)
Expand Down Expand Up @@ -1433,7 +1428,6 @@ impl Config {
);
insert_int(&mut res, "max-ca-depth", self.max_ca_depth);
insert(&mut res, "enable-bgpsec", self.enable_bgpsec);
#[cfg(feature = "aspa")]
insert(&mut res, "enable-aspa", self.enable_aspa);
insert_int(&mut res, "aspa-provider-limit", self.aspa_provider_limit);
insert(&mut res, "dirty", self.dirty_repository);
Expand Down Expand Up @@ -1892,7 +1886,6 @@ struct GlobalArgs {
enable_bgpsec: bool,

/// Include ASPA in the data set
#[cfg(feature = "aspa")]
#[arg(long)]
enable_aspa: bool,

Expand Down
46 changes: 22 additions & 24 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1448,30 +1448,28 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
&mut self, uri: &uri::Rsync, content: Bytes,
manifest: &mut ValidPointManifest,
) -> Result<(), Failed> {
#[cfg(feature = "aspa")] {
let aspa = match Aspa::decode(
content, self.run.validation.strict
) {
Ok(aspa) => aspa,
Err(err) => {
manifest.metrics.invalid_aspas += 1;
warn!("{}: failed to decode ASPA.", uri);
return Ok(())
}
};
match aspa.process(
self.cert.cert(),
self.run.validation.strict,
|cert| manifest.check_crl(cert)
) {
Ok((cert, aspa)) => {
manifest.metrics.valid_aspas += 1;
self.processor.process_aspa(uri, cert, aspa)?
}
Err(err) => {
manifest.metrics.invalid_aspas += 1;
warn!("{}: {}.", uri, err)
}
let aspa = match Aspa::decode(
content, self.run.validation.strict
) {
Ok(aspa) => aspa,
Err(err) => {
manifest.metrics.invalid_aspas += 1;
warn!("{}: failed to decode ASPA.", uri);
return Ok(())
}
};
match aspa.process(
self.cert.cert(),
self.run.validation.strict,
|cert| manifest.check_crl(cert)
) {
Ok((cert, aspa)) => {
manifest.metrics.valid_aspas += 1;
self.processor.process_aspa(uri, cert, aspa)?
}
Err(err) => {
manifest.metrics.invalid_aspas += 1;
warn!("{}: {}.", uri, err)
}
}
Ok(())
Expand Down
44 changes: 20 additions & 24 deletions src/http/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,14 @@ fn object_metrics<'a>(
.label("state", "invalid")
.value(metrics.invalid_roas);

#[cfg(feature = "aspa")] {
target.multi(metric).label(group.label(), name)
.label("type", "aspa")
.label("state", "valid")
.value(metrics.valid_aspas);
target.multi(metric).label(group.label(), name)
.label("type", "aspa")
.label("state", "invalid")
.value(metrics.invalid_aspas);
}
target.multi(metric).label(group.label(), name)
.label("type", "aspa")
.label("state", "valid")
.value(metrics.valid_aspas);
target.multi(metric).label(group.label(), name)
.label("type", "aspa")
.label("state", "invalid")
.value(metrics.invalid_aspas);

target.multi(metric).label(group.label(), name)
.label("type", "gbr")
Expand Down Expand Up @@ -419,20 +417,18 @@ fn payload_metrics<'a>(
.value(metrics.contributed);
}

#[cfg(feature = "aspa")] {
target.multi(valid_metric)
.label(group.label(), name)
.label("type", "aspas")
.value(metrics.aspas.valid);
target.multi(duplicate_metric)
.label(group.label(), name)
.label("type", "aspas")
.value(metrics.aspas.duplicate);
target.multi(contributed_metric)
.label(group.label(), name)
.label("type", "aspas")
.value(metrics.aspas.contributed);
}
target.multi(valid_metric)
.label(group.label(), name)
.label("type", "aspas")
.value(metrics.aspas.valid);
target.multi(duplicate_metric)
.label(group.label(), name)
.label("type", "aspas")
.value(metrics.aspas.duplicate);
target.multi(contributed_metric)
.label(group.label(), name)
.label("type", "aspas")
.value(metrics.aspas.contributed);
}
}

Expand Down
14 changes: 5 additions & 9 deletions src/http/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,8 @@ fn json_publication_metrics(
target.member_raw("validROAs", metrics.valid_roas);
target.member_raw("invalidROAs", metrics.invalid_roas);
target.member_raw("validGBRs", metrics.valid_gbrs);
#[cfg(feature = "aspa")] {
target.member_raw("invalidASPAs", metrics.invalid_aspas);
target.member_raw("validASPAs", metrics.valid_aspas);
}
target.member_raw("invalidASPAs", metrics.invalid_aspas);
target.member_raw("validASPAs", metrics.valid_aspas);
target.member_raw("invalidGBRs", metrics.invalid_gbrs);
target.member_raw("otherObjects", metrics.others);
}
Expand Down Expand Up @@ -630,11 +628,9 @@ fn json_payload_metrics(
target.member_object("routerKeys", |target| {
json_vrps_metrics(target, &payload.router_keys, false)
});
#[cfg(feature = "aspa")] {
target.member_object("aspas", |target| {
json_vrps_metrics(target, &payload.aspas, false)
});
}
target.member_object("aspas", |target| {
json_vrps_metrics(target, &payload.aspas, false)
});
});
}

Expand Down

0 comments on commit fab1991

Please sign in to comment.