rpki-client: handle {0} ASPAs up front
The semantics of merging mean that merging {0} into an already existing
CAS does nothing, so if aspa->providers[] is the set {0}, we can return
early. If v->providers[] is the set {0}, drop the 0 and adjust counters
then copy aspa->providers[] into it.
This approach would have worked before, but it's now a bit easier to see
why it works.
ok claudio
rpki-client: rework aspa_insert_vaps()
The merge loop in aspa_insert_vaps() is too smart and has tripped us all up
repeatedly. While it won't matter much due to size constraints, its worst
case is O(n*m), which isn't great.
Let's make this easier to follow and reason about. A linear sweep merges
and deduplicates the two arrays question until one of them is consumed,
then fill in the tail of the one that remains non-empty. Both arrays are
strictly monotonic, and this property is clearly preserved by the new
approach.
The other bit that is obvious is that the merge loop is O(n + m). The price
we pay is a bit more code and an extra allocation.
ok claudio job
In tlv_decode_fec_elm add missing initial len and prefixlen check
Ensure that fec_elm have at least the one byte needed for the type
and also check that the encoded prefixlen actually matches with the
address family.
Reported by Yang Hailong
OK deraadt@ tb@