#include "routing_table.h"
#include "mid_set.h"
#include "hna_set.h"
-#include "lq_list.h"
-#include "lq_avl.h"
+#include "common/list.h"
+#include "common/avl.h"
#include "lq_route.h"
#include "net_olsr.h"
#include "lq_plugin.h"
{
#if !defined(NODEBUG) && defined(DEBUG)
struct ipaddr_str buf;
+ struct lqtextbuffer lqbuffer;
#endif
tc->cand_tree_node.key = &tc->path_cost;
- tc->cand_tree_node.data = tc;
#ifdef DEBUG
OLSR_PRINTF(2, "SPF: insert candidate %s, cost %s\n",
olsr_ip_to_string(&buf, &tc->addr),
- get_linkcost_text(tc->path_cost, OLSR_FALSE));
+ get_linkcost_text(tc->path_cost, OLSR_FALSE, &lqbuffer));
#endif
avl_insert(tree, &tc->cand_tree_node, AVL_DUP);
#ifdef DEBUG
#ifndef NODEBUG
struct ipaddr_str buf;
+ struct lqtextbuffer lqbuffer;
#endif
OLSR_PRINTF(2, "SPF: delete candidate %s, cost %s\n",
olsr_ip_to_string(&buf, &tc->addr),
- get_linkcost_text(tc->path_cost, OLSR_FALSE));
+ get_linkcost_text(tc->path_cost, OLSR_FALSE, &lqbuffer));
#endif
avl_delete(tree, &tc->cand_tree_node);
{
#if !defined(NODEBUG) && defined(DEBUG)
struct ipaddr_str pathbuf, nbuf;
+ struct lqtextbuffer lqbuffer;
#endif
- tc->path_list_node.data = tc;
#ifdef DEBUG
OLSR_PRINTF(2, "SPF: append path %s, cost %s, via %s\n",
olsr_ip_to_string(&pathbuf, &tc->addr),
- get_linkcost_text(tc->path_cost, OLSR_FALSE),
+ get_linkcost_text(tc->path_cost, OLSR_FALSE, &lqbuffer),
tc->next_hop ? olsr_ip_to_string(
&nbuf, &tc->next_hop->neighbor_iface_addr) : "-");
#endif
{
struct avl_node *node = avl_walk_first(tree);
- return (node ? node->data : NULL);
+ return (node ? cand_tree2tc(node) : NULL);
}
#ifdef DEBUG
#ifndef NODEBUG
struct ipaddr_str buf, nbuf;
+ struct lqtextbuffer lqbuffer;
#endif
OLSR_PRINTF(2, "SPF: exploring node %s, cost %s\n",
olsr_ip_to_string(&buf, &tc->addr),
- get_linkcost_text(tc->path_cost, OLSR_FALSE));
+ get_linkcost_text(tc->path_cost, OLSR_FALSE, &lqbuffer));
#endif
/*
edge_node = avl_walk_next(edge_node)) {
struct tc_entry *new_tc;
- struct tc_edge_entry *tc_edge = edge_node->data;
+ struct tc_edge_entry *tc_edge = edge_tree2tc_edge(edge_node);
/*
* We are not interested in dead-end or dying edges.
*/
- if (!tc_edge->edge_inv || (tc_edge->flags & OLSR_TC_EDGE_DOWN)) {
+ if (!tc_edge->edge_inv ||
+ ((tc_edge->flags | tc_edge->edge_inv->flags) & OLSR_TC_EDGE_DOWN)) {
#ifdef DEBUG
OLSR_PRINTF(2, "SPF: ignoring edge %s\n",
olsr_ip_to_string(&buf, &tc_edge->T_dest_addr));
+ if (!tc_edge->edge_inv) {
+ OLSR_PRINTF(2, "SPF: no inverse edge\n");
+ }
+
if (tc_edge->flags & OLSR_TC_EDGE_DOWN) {
OLSR_PRINTF(2, "SPF: edge down\n");
}
if (!tc_edge->edge_inv) {
OLSR_PRINTF(2, "SPF: no inverse edge\n");
+ } else if (tc_edge->edge_inv->flags & OLSR_TC_EDGE_DOWN){
+ OLSR_PRINTF(2, "SPF: inverse edge down\n");
}
#endif
continue;
#ifdef DEBUG
OLSR_PRINTF(2, "SPF: exploring edge %s, cost %s\n",
olsr_ip_to_string(&buf, &tc_edge->T_dest_addr),
- get_linkcost_text(new_cost, OLSR_TRUE));
+ get_linkcost_text(new_cost, OLSR_TRUE, &lqbuffer));
#endif
/*
#ifdef DEBUG
OLSR_PRINTF(2, "SPF: better path to %s, cost %s, via %s, hops %u\n",
olsr_ip_to_string(&buf, &new_tc->addr),
- get_linkcost_text(new_cost, OLSR_TRUE),
+ get_linkcost_text(new_cost, OLSR_TRUE, &lqbuffer),
tc->next_hop ? olsr_ip_to_string(
&nbuf, &tc->next_hop->neighbor_iface_addr) : "<none>",
new_tc->hops);
*/
for (; !list_is_empty(&path_list); list_remove(path_list.next)) {
- tc = path_list.next->data;
+ tc = pathlist2tc(path_list.next);
link = tc->next_hop;
if (!link) {
rtp_tree_node;
rtp_tree_node = avl_walk_next(rtp_tree_node)) {
- rtp = rtp_tree_node->data;
+ rtp = rtp_prefix_tree2rtp(rtp_tree_node);
if (rtp->rtp_rt) {