diff options
Diffstat (limited to 'ffd/ffd.c')
-rw-r--r-- | ffd/ffd.c | 30 |
1 files changed, 11 insertions, 19 deletions
@@ -347,28 +347,14 @@ static void handle_tlv_update(const ffd_tlv_update_t *tlv_update, size_t len, ha ffd_nexthop_t *nexthop = find_nexthop(announce, neigh); if (!nexthop) { - if (!feasible || tlv_update->metric == 0xffff /* no need to ntohs */) - return; - - nexthop = new_nexthop(announce, neigh); + if (feasible && tlv_update->metric != 0xffff /* no need to ntohs */) + nexthop = new_nexthop(announce, neigh); } else { if (!feasible && nexthop == announce->selected) - return; + nexthop = NULL; } - nexthop->metric_seqno.metric = ntohs(tlv_update->metric); - nexthop->metric_seqno.seqno = ntohs(tlv_update->seqno); - nexthop->interval = ntohs(tlv_update->interval); - - fprintf(stderr, "debug: the update was accepted.\n"); - - if (nexthop->metric_seqno.metric == 0xffff) - return; - - /* only update the timestamp for finite metrics */ - nexthop->last_update = now; - if ((tlv_update->flags & FFD_UPDATE_WITH_DATA) && !announce->data) { if (len > sizeof(ffd_tlv_update_t)) { announce->len = len - sizeof(ffd_tlv_update_t); @@ -379,11 +365,17 @@ static void handle_tlv_update(const ffd_tlv_update_t *tlv_update, size_t len, ha announce->len = 0xff; /* request data */ - ffd_send_announce_request(arg->iface, neigh, announce->node, announce->type, announce->key, true); + if (nexthop) + ffd_send_announce_request(arg->iface, neigh, announce->node, announce->type, announce->key, true); } } - ffd_announce_update_nexthop(announce); + if (!nexthop) + return; + + fprintf(stderr, "debug: the update was accepted.\n"); + + ffd_announce_update(announce, nexthop, ms, ntohs(tlv_update->interval)); } static void handle_tlv_announce_req(const ffd_tlv_announce_req_t *tlv_req, size_t len, handle_tlv_arg_t *arg) { |