Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc925dc

Browse files
Briastanneberger
authored andcommitted
rtr: Respond with error if ASPA announcement PDU contains no providers
- Draft `8210bis` version 21; Section 5.12. states that an ASPA announcement PDU must always contain at least one provider autonomous system number - If an announcement doesn't contain any provider autonomous system numbers an error `ASPA Provider List Error (9)` is sent to the cache server and the transport connection is closed
1 parent a170175 commit fc925dc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

rtrlib/rtr/packets.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,18 @@ static int rtr_compute_update_aspa_table(struct rtr_socket *rtr_socket, struct a
10901090
}
10911091

10921092
for (size_t i = 0; i < pdu_count; i++) {
1093+
struct pdu_aspa *pdu = aspa_pdus[i];
1094+
bool is_announcement = pdu->flags & 1;
1095+
1096+
// TODO: Add test
1097+
if (is_announcement && rtr_aspa_provider_count(pdu) == 0) {
1098+
RTR_DBG1("ASPA announcement doesn't contain any provider autonomous system numbers");
1099+
rtr_send_error_pdu_from_host(rtr_socket, pdu, pdu->len, INCORRECT_ASPA_PROVIDER_LIST, NULL, 0);
1100+
rtr_change_socket_state(rtr_socket, RTR_ERROR_FATAL);
1101+
1102+
return RTR_ERROR;
1103+
}
1104+
10931105
rtr_aspa_pdu_2_aspa_operation(aspa_pdus[i], &operations[i]);
10941106
operations[i].index = i;
10951107
}

rtrlib/rtr/rtr_pdus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ enum pdu_error_type {
1212
WITHDRAWAL_OF_UNKNOWN_RECORD = 6,
1313
DUPLICATE_ANNOUNCEMENT = 7,
1414
UNEXPECTED_PROTOCOL_VERSION = 8,
15+
INCORRECT_ASPA_PROVIDER_LIST = 9,
1516
PDU_TOO_BIG = 32
1617
};
1718

0 commit comments

Comments
 (0)