-/* $OpenBSD: rtr_proto.c,v 1.39 2024/08/20 11:59:39 claudio Exp $ */
+/* $OpenBSD: rtr_proto.c,v 1.40 2024/09/10 08:41:13 claudio Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
/* followed by Subject Public Key Info */
} __packed;
-#define FLAG_AFI_V6 0x1
-#define FLAG_AFI_MASK FLAG_AFI_V6
struct rtr_aspa {
struct rtr_header hdr;
uint32_t cas;
char descr[PEER_DESCR_LEN];
struct roa_tree roa_set;
struct aspa_tree aspa;
- struct aspa_tree aspa_oldv6;
struct ibuf_read r;
struct msgbuf w;
struct timer_head timers;
timer_stop(&rs->timers, Timer_Rtr_Expire);
free_roatree(&rs->roa_set);
free_aspatree(&rs->aspa);
- free_aspatree(&rs->aspa_oldv6);
}
static struct ibuf *
flags = rtr_aspa.hdr.flags;
cnt = ibuf_size(pdu) / sizeof(uint32_t);
+ if ((flags & FLAG_ANNOUNCE) && cnt == 0) {
+ rtr_send_error(rs, pdu, CORRUPT_DATA, "%s: "
+ "announce with empty SPAS", log_rtr_type(ASPA));
+ return -1;
+ }
+ if ((flags & FLAG_ANNOUNCE) == 0 && cnt != 0) {
+ rtr_send_error(rs, pdu, CORRUPT_DATA, "%s: "
+ "withdraw with non-empty SPAS", log_rtr_type(ASPA));
+ return -1;
+ }
+
if (rs->state != RTR_STATE_EXCHANGE) {
rtr_send_error(rs, pdu, CORRUPT_DATA, "%s: out of context",
log_rtr_type(ASPA));
RB_INIT(&rs->roa_set);
RB_INIT(&rs->aspa);
- RB_INIT(&rs->aspa_oldv6);
TAILQ_INIT(&rs->timers);
msgbuf_init(&rs->w);
TAILQ_FOREACH(rs, &rtrs, entry) {
RB_FOREACH(aspa, aspa_tree, &rs->aspa)
rtr_aspa_insert(at, aspa);
- RB_FOREACH(aspa, aspa_tree, &rs->aspa_oldv6)
- rtr_aspa_insert(at, aspa);
}
}