Commit 4635314c authored by Maria Matejka's avatar Maria Matejka
Browse files

Routing tables list iteration should use explicit node struct position

parent 7a74ad5a
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1741,8 +1741,9 @@ void
rt_dump_all(void)
rt_dump_all(void)
{
{
  rtable *t;
  rtable *t;
  node *n;


  WALK_LIST(t, routing_tables)
  WALK_LIST2(t, n, routing_tables, n)
    rt_dump(t);
    rt_dump(t);
}
}


+6 −3
Original line number Original line Diff line number Diff line
@@ -224,12 +224,15 @@ mrt_next_table_(rtable *tab, rtable *tab_ptr, const char *pattern)
    return !tab ? tab_ptr : NULL;
    return !tab ? tab_ptr : NULL;


  /* Walk routing_tables list, starting after tab (if non-NULL) */
  /* Walk routing_tables list, starting after tab (if non-NULL) */
  for (tab = !tab ? HEAD(routing_tables) : NODE_NEXT(tab);
  for (node *tn = tab ? tab->n.next : HEAD(routing_tables);
       NODE_VALID(tab);
       NODE_VALID(tn);
       tab = NODE_NEXT(tab))
       tn = tn->next)
  {
    tab = SKIP_BACK(struct rtable, n, tn);
    if (patmatch(pattern, tab->name) &&
    if (patmatch(pattern, tab->name) &&
	((tab->addr_type == NET_IP4) || (tab->addr_type == NET_IP6)))
	((tab->addr_type == NET_IP4) || (tab->addr_type == NET_IP6)))
      return tab;
      return tab;
  }


  return NULL;
  return NULL;
}
}