summaryrefslogtreecommitdiff
path: root/proto/rpki/packets.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2020-10-11 00:53:19 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2020-10-11 01:00:54 +0200
commitfc1e3211b109400c0e96f889829c9f5145ac7226 (patch)
tree3419096c119b0f8146f165e91d4b399eb854b920 /proto/rpki/packets.c
parent6c11dbcf28faa145cfb7310310a2a261fd4dd1f2 (diff)
RPKI: Add 'ignore max length' option
Add 'ignore max length' option to RPKI protocol, which ignores received max length in ROA records and instead uses max value (32 or 128). This may be useful for implementing loose RPKI check for blackholes.
Diffstat (limited to 'proto/rpki/packets.c')
-rw-r--r--proto/rpki/packets.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/proto/rpki/packets.c b/proto/rpki/packets.c
index e9d24fb8..dd11f997 100644
--- a/proto/rpki/packets.c
+++ b/proto/rpki/packets.c
@@ -729,12 +729,22 @@ rpki_prefix_pdu_2_net_addr(const struct pdu_header *pdu, net_addr_union *n)
static int
rpki_handle_prefix_pdu(struct rpki_cache *cache, const struct pdu_header *pdu)
{
+ const struct rpki_config *cf = (void *) cache->p->p.cf;
+
const enum pdu_type type = pdu->type;
ASSERT(type == IPV4_PREFIX || type == IPV6_PREFIX);
net_addr_union addr = {};
rpki_prefix_pdu_2_net_addr(pdu, &addr);
+ if (cf->ignore_max_length)
+ {
+ if (type == IPV4_PREFIX)
+ addr.roa4.max_pxlen = IP4_MAX_PREFIX_LENGTH;
+ else
+ addr.roa6.max_pxlen = IP6_MAX_PREFIX_LENGTH;
+ }
+
struct channel *channel = NULL;
if (type == IPV4_PREFIX)