mirror of
				https://gitlab.labs.nic.cz/labs/bird.git
				synced 2024-05-11 16:54:54 +00:00 
			
		
		
		
	Modify FIB_WALK() and FIB_ITERATE() to work with new FIB code
Returned user data pointers have offset relative to fib_node.
This commit is contained in:
		@@ -417,10 +417,8 @@ rip_send_response(struct rip_proto *p, struct rip_iface *ifa)
 | 
			
		||||
  pkt->unused = 0;
 | 
			
		||||
  pos += rip_pkt_hdrlen(ifa);
 | 
			
		||||
 | 
			
		||||
  FIB_ITERATE_START(&p->rtable, &ifa->tx_fit, z)
 | 
			
		||||
  FIB_ITERATE_START(&p->rtable, &ifa->tx_fit, struct rip_entry, en)
 | 
			
		||||
  {
 | 
			
		||||
    struct rip_entry *en = (struct rip_entry *) z;
 | 
			
		||||
 | 
			
		||||
    /* Dummy entries */
 | 
			
		||||
    if (!en->valid)
 | 
			
		||||
      goto next_entry;
 | 
			
		||||
@@ -437,7 +435,7 @@ rip_send_response(struct rip_proto *p, struct rip_iface *ifa)
 | 
			
		||||
    /* Not enough space for current entry */
 | 
			
		||||
    if (pos > max)
 | 
			
		||||
    {
 | 
			
		||||
      FIB_ITERATE_PUT(&ifa->tx_fit, z);
 | 
			
		||||
      FIB_ITERATE_PUT(&ifa->tx_fit);
 | 
			
		||||
      goto break_loop;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -490,7 +488,7 @@ rip_send_response(struct rip_proto *p, struct rip_iface *ifa)
 | 
			
		||||
 | 
			
		||||
  next_entry: ;
 | 
			
		||||
  }
 | 
			
		||||
  FIB_ITERATE_END(z);
 | 
			
		||||
  FIB_ITERATE_END;
 | 
			
		||||
  ifa->tx_active = 0;
 | 
			
		||||
 | 
			
		||||
  /* Do not send empty packet */
 | 
			
		||||
 
 | 
			
		||||
@@ -823,9 +823,8 @@ rip_timer(timer *t)
 | 
			
		||||
  FIB_ITERATE_INIT(&fit, &p->rtable);
 | 
			
		||||
 | 
			
		||||
  loop:
 | 
			
		||||
  FIB_ITERATE_START(&p->rtable, &fit, node)
 | 
			
		||||
  FIB_ITERATE_START(&p->rtable, &fit, struct rip_entry, en)
 | 
			
		||||
  {
 | 
			
		||||
    struct rip_entry *en = (struct rip_entry *) node;
 | 
			
		||||
    struct rip_rte *rt, **rp;
 | 
			
		||||
    int changed = 0;
 | 
			
		||||
 | 
			
		||||
@@ -852,7 +851,7 @@ rip_timer(timer *t)
 | 
			
		||||
       * rip_rt_notify() -> p->rtable change, invalidating hidden variables.
 | 
			
		||||
       */
 | 
			
		||||
 | 
			
		||||
      FIB_ITERATE_PUT_NEXT(&fit, &p->rtable, node);
 | 
			
		||||
      FIB_ITERATE_PUT_NEXT(&fit, &p->rtable);
 | 
			
		||||
      rip_announce_rte(p, en);
 | 
			
		||||
      goto loop;
 | 
			
		||||
    }
 | 
			
		||||
@@ -874,12 +873,12 @@ rip_timer(timer *t)
 | 
			
		||||
    /* Remove empty nodes */
 | 
			
		||||
    if (!en->valid && !en->routes)
 | 
			
		||||
    {
 | 
			
		||||
      FIB_ITERATE_PUT(&fit, node);
 | 
			
		||||
      fib_delete(&p->rtable, node);
 | 
			
		||||
      FIB_ITERATE_PUT(&fit);
 | 
			
		||||
      fib_delete(&p->rtable, en);
 | 
			
		||||
      goto loop;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  FIB_ITERATE_END(node);
 | 
			
		||||
  FIB_ITERATE_END;
 | 
			
		||||
 | 
			
		||||
  p->rt_reload = 0;
 | 
			
		||||
 | 
			
		||||
@@ -1248,9 +1247,8 @@ rip_dump(struct proto *P)
 | 
			
		||||
  int i;
 | 
			
		||||
 | 
			
		||||
  i = 0;
 | 
			
		||||
  FIB_WALK(&p->rtable, e)
 | 
			
		||||
  FIB_WALK(&p->rtable, struct rip_entry, en)
 | 
			
		||||
  {
 | 
			
		||||
    struct rip_entry *en = (struct rip_entry *) e;
 | 
			
		||||
    debug("RIP: entry #%d: %N via %I dev %s valid %d metric %d age %d s\n",
 | 
			
		||||
	  i++, en->n.addr, en->next_hop, en->iface->name,
 | 
			
		||||
	  en->valid, en->metric, now - en->changed);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user