diff options
Diffstat (limited to 'ffd/ffd.c')
-rw-r--r-- | ffd/ffd.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -191,6 +191,17 @@ static inline ffd_neigh_t* get_tlv_neigh(handle_tlv_arg_t *arg) { return ffd_neigh_get(arg->iface, arg->addr); } +static void handle_tlv_ack_req(const ffd_tlv_ack_req_t *tlv_req, size_t len, handle_tlv_arg_t *arg) { + if (len < sizeof(ffd_tlv_ack_req_t)) { + fprintf(stderr, "warn: received short acknowledement request TLV.\n"); + return; + } + + ffd_neigh_t *neigh = get_tlv_neigh(arg); + + ffd_send_ack(arg->iface, neigh, ntohs(tlv_req->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"); @@ -392,6 +403,14 @@ static void handle_tlv_announce_req(const ffd_tlv_announce_req_t *tlv_req, size_ static void handle_tlv(ffd_tlv_type_t type, const void *data, size_t len, void *arg) { switch (type) { + case TLV_ACK_REQ: + handle_tlv_ack_req(data, len, arg); + return; + + case TLV_ACK: + /* we don't send ack reqs */ + return; + case TLV_HELLO: handle_tlv_hello(data, len, arg); return; |