diff options
Diffstat (limited to 'ffd/ffd.c')
-rw-r--r-- | ffd/ffd.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -203,6 +203,15 @@ static void handle_tlv_ack_req(const ffd_tlv_ack_req_t *tlv_req, size_t len, han ffd_send_ack(neigh, ntohs(tlv_req->nonce)); } +static void handle_tlv_ack(const ffd_tlv_ack_t *tlv_ack, size_t len, handle_tlv_arg_t *arg) { + if (len < sizeof(ffd_tlv_ack_t)) { + fprintf(stderr, "warn: received short acknowledement TLV.\n"); + return; + } + + ffd_ack_handle(ntohs(tlv_ack->nonce)); +} + static void handle_tlv_hello(const ffd_tlv_hello_t *tlv_hello, size_t len, handle_tlv_arg_t *arg) { if (len < sizeof(ffd_tlv_hello_t)) { fprintf(stderr, "warn: received short hello TLV.\n"); @@ -425,7 +434,7 @@ static void handle_tlv(ffd_tlv_type_t type, const void *data, size_t len, void * return; case TLV_ACK: - /* we don't send ack reqs */ + handle_tlv_ack(data, len, arg); return; case TLV_HELLO: @@ -617,10 +626,11 @@ int main() { while (true) { ffd_queue_run(&tasks); ffd_update_run(); + ffd_ack_run(); struct pollfd fds[1]; - int timeout = 10*timeout_min(ffd_queue_timeout(&tasks), ffd_update_timeout()); + int timeout = 10*timeout_min(timeout_min(ffd_queue_timeout(&tasks), ffd_update_timeout()), ffd_ack_timeout()); if (timeout < 0) timeout = -1; |