mirror of
https://github.com/neocturne/fastd.git
synced 2025-05-14 04:15:08 +02:00
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:
parent
0f450984e3
commit
0550601d3f
2 changed files with 6 additions and 12 deletions
|
@ -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)
|
||||
return handshake;
|
||||
size_t tlv_len = fastd_handshake_tlv_len(buffer);
|
||||
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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue