handshake: remove support for unset tlv_len handshake field

We already only support handshakes with fastd v11 or newer, so this can
be removed as well.
This commit is contained in:
Matthias Schiffer 2020-06-15 19:48:04 +02:00
parent 0f450984e3
commit 0550601d3f
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
2 changed files with 6 additions and 12 deletions

View file

@ -301,17 +301,12 @@ static inline fastd_handshake_t parse_tlvs(const fastd_buffer_t *buffer) {
fastd_handshake_packet_t *packet = buffer->data;
size_t len = buffer->len - sizeof(fastd_handshake_packet_t);
if (packet->tlv_len) {
size_t tlv_len = fastd_handshake_tlv_len(buffer);
if (tlv_len > len)
if (buffer->len < sizeof(fastd_handshake_packet_t) + tlv_len)
return handshake;
len = tlv_len;
}
uint8_t *ptr = packet->tlv_data, *end = packet->tlv_data + len;
handshake.tlv_len = len;
uint8_t *ptr = packet->tlv_data, *end = packet->tlv_data + tlv_len;
handshake.tlv_len = tlv_len;
handshake.tlv_data = packet->tlv_data;
while (true) {

View file

@ -67,8 +67,7 @@ typedef enum fastd_reply_code {
typedef struct __attribute__((packed)) fastd_handshake_packet {
uint8_t packet_type; /**< Packet type (must be PACKET_HANDSHAKE) */
uint8_t rsv; /**< Reserved (must be 0) */
uint16_t tlv_len; /**< Length of the TLV records (before fastd v11 this was always 0, which is interpreted as
"the whole packet") */
uint16_t tlv_len; /**< Length of the TLV records */
uint8_t tlv_data[]; /**< TLV record data */
} fastd_handshake_packet_t;