Fix typo in 'feasible' ...
This commit is contained in:
parent
4cf3389fcf
commit
39df74a428
4 changed files with 12 additions and 12 deletions
|
@ -28,15 +28,15 @@
|
||||||
#include "neigh.h"
|
#include "neigh.h"
|
||||||
|
|
||||||
|
|
||||||
bool ffd_is_feasable(const ffd_announce_t *announce, ffd_metric_seqno_t ms) {
|
bool ffd_is_feasible(const ffd_announce_t *announce, ffd_metric_seqno_t ms) {
|
||||||
if (FFD_IS_INFINITY(ms) || FFD_IS_INFINITY(announce->feasability_distance))
|
if (FFD_IS_INFINITY(ms) || FFD_IS_INFINITY(announce->feasibility_distance))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int16_t seqno_diff = ms.seqno - announce->feasability_distance.seqno;
|
int16_t seqno_diff = ms.seqno - announce->feasibility_distance.seqno;
|
||||||
|
|
||||||
if (seqno_diff < 0)
|
if (seqno_diff < 0)
|
||||||
return true;
|
return true;
|
||||||
if (seqno_diff == 0 && ms.metric < announce->feasability_distance.metric)
|
if (seqno_diff == 0 && ms.metric < announce->feasibility_distance.metric)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -48,7 +48,7 @@ static ffd_nexthop_t* select_nexthop(const ffd_announce_t *announce) {
|
||||||
|
|
||||||
ffd_nexthop_t *nexthop;
|
ffd_nexthop_t *nexthop;
|
||||||
for (nexthop = announce->nexthop_list; nexthop; nexthop = nexthop->next) {
|
for (nexthop = announce->nexthop_list; nexthop; nexthop = nexthop->next) {
|
||||||
if (!ffd_is_feasable(announce, nexthop->metric_seqno))
|
if (!ffd_is_feasible(announce, nexthop->metric_seqno))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32_t metric = nexthop->metric_seqno.metric + ffd_neigh_get_cost(nexthop->neigh);
|
uint32_t metric = nexthop->metric_seqno.metric + ffd_neigh_get_cost(nexthop->neigh);
|
||||||
|
@ -80,7 +80,7 @@ void ffd_announce_update_nexthop(ffd_announce_t *announce) {
|
||||||
ffd_announce_t* ffd_announce_new(void) {
|
ffd_announce_t* ffd_announce_new(void) {
|
||||||
ffd_announce_t *a = calloc(1, sizeof(ffd_announce_t));
|
ffd_announce_t *a = calloc(1, sizeof(ffd_announce_t));
|
||||||
|
|
||||||
a->feasability_distance.metric = 0xffff;
|
a->feasibility_distance.metric = 0xffff;
|
||||||
|
|
||||||
a->next = announce_list;
|
a->next = announce_list;
|
||||||
announce_list = a;
|
announce_list = a;
|
||||||
|
|
|
@ -341,19 +341,19 @@ static void handle_tlv_update(const ffd_tlv_update_t *tlv_update, size_t len, ha
|
||||||
|
|
||||||
ffd_announce_t *announce = get_announce(&arg->node_id, ntohs(tlv_update->type), ntohs(tlv_update->key));
|
ffd_announce_t *announce = get_announce(&arg->node_id, ntohs(tlv_update->type), ntohs(tlv_update->key));
|
||||||
ffd_metric_seqno_t ms = { ntohs(tlv_update->metric), ntohs(tlv_update->seqno) };
|
ffd_metric_seqno_t ms = { ntohs(tlv_update->metric), ntohs(tlv_update->seqno) };
|
||||||
bool feasable = ffd_is_feasable(announce, ms);
|
bool feasible = ffd_is_feasible(announce, ms);
|
||||||
|
|
||||||
ffd_neigh_t *neigh = get_tlv_neigh(arg);
|
ffd_neigh_t *neigh = get_tlv_neigh(arg);
|
||||||
ffd_nexthop_t *nexthop = find_nexthop(announce, neigh);
|
ffd_nexthop_t *nexthop = find_nexthop(announce, neigh);
|
||||||
|
|
||||||
if (!nexthop) {
|
if (!nexthop) {
|
||||||
if (!feasable || tlv_update->metric == 0xffff /* no need to ntohs */)
|
if (!feasible || tlv_update->metric == 0xffff /* no need to ntohs */)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nexthop = new_nexthop(announce, neigh);
|
nexthop = new_nexthop(announce, neigh);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!feasable && nexthop == announce->selected)
|
if (!feasible && nexthop == announce->selected)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ typedef struct _ffd_announce_t {
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
uint16_t key;
|
uint16_t key;
|
||||||
|
|
||||||
ffd_metric_seqno_t feasability_distance;
|
ffd_metric_seqno_t feasibility_distance;
|
||||||
|
|
||||||
ffd_nexthop_t *selected;
|
ffd_nexthop_t *selected;
|
||||||
ffd_nexthop_t *nexthop_list;
|
ffd_nexthop_t *nexthop_list;
|
||||||
|
@ -147,7 +147,7 @@ extern int sockfd;
|
||||||
extern struct timespec now;
|
extern struct timespec now;
|
||||||
|
|
||||||
|
|
||||||
bool ffd_is_feasable(const ffd_announce_t *announce, ffd_metric_seqno_t ms);
|
bool ffd_is_feasible(const ffd_announce_t *announce, ffd_metric_seqno_t ms);
|
||||||
ffd_metric_seqno_t ffd_announce_get_metric(const ffd_announce_t *announce);
|
ffd_metric_seqno_t ffd_announce_get_metric(const ffd_announce_t *announce);
|
||||||
void ffd_announce_update_nexthop(ffd_announce_t *announce);
|
void ffd_announce_update_nexthop(ffd_announce_t *announce);
|
||||||
ffd_announce_t* ffd_announce_new(void);
|
ffd_announce_t* ffd_announce_new(void);
|
||||||
|
|
|
@ -182,7 +182,7 @@ static bool add_update(ffd_packet_t *packet, size_t max_len, ffd_node_id_t *node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
announce->feasability_distance = metric;
|
announce->feasibility_distance = metric;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue