Revision 600998fc nest/rt-table.c

View differences:

nest/rt-table.c
1315 1315
void
1316 1316
rt_refresh_begin(rtable *t, struct announce_hook *ah)
1317 1317
{
1318
  net *n;
1319
  rte *e;
1320

  
1321
  FIB_WALK(&t->fib, fn)
1318
  FIB_WALK(&t->fib, net, n)
1322 1319
    {
1323
      n = (net *) fn;
1320
      rte *e;
1324 1321
      for (e = n->routes; e; e = e->next)
1325 1322
	if (e->sender == ah)
1326 1323
	  e->flags |= REF_STALE;
......
1340 1337
rt_refresh_end(rtable *t, struct announce_hook *ah)
1341 1338
{
1342 1339
  int prune = 0;
1343
  net *n;
1344
  rte *e;
1345 1340

  
1346
  FIB_WALK(&t->fib, fn)
1341
  FIB_WALK(&t->fib, net, n)
1347 1342
    {
1348
      n = (net *) fn;
1343
      rte *e;
1349 1344
      for (e = n->routes; e; e = e->next)
1350 1345
	if ((e->sender == ah) && (e->flags & REF_STALE))
1351 1346
	  {
......
1387 1382
void
1388 1383
rt_dump(rtable *t)
1389 1384
{
1390
  rte *e;
1391
  net *n;
1392
  struct announce_hook *a;
1393

  
1394 1385
  debug("Dump of routing table <%s>\n", t->name);
1395 1386
#ifdef DEBUGGING
1396 1387
  fib_check(&t->fib);
1397 1388
#endif
1398
  FIB_WALK(&t->fib, fn)
1389
  FIB_WALK(&t->fib, net, n)
1399 1390
    {
1400
      n = (net *) fn;
1391
      rte *e;
1401 1392
      for(e=n->routes; e; e=e->next)
1402 1393
	rte_dump(e);
1403 1394
    }
1404 1395
  FIB_WALK_END;
1396

  
1397
  struct announce_hook *a;
1405 1398
  WALK_LIST(a, t->hooks)
1406 1399
    debug("\tAnnounces routes to protocol %s\n", a->proto->name);
1407 1400
  debug("\n");
......
1471 1464

  
1472 1465
  FIB_ITERATE_INIT(&fit, &tab->fib);
1473 1466
again:
1474
  FIB_ITERATE_START(&tab->fib, &fit, f)
1467
  FIB_ITERATE_START(&tab->fib, &fit, net, n)
1475 1468
    {
1476
      net *n = (net *) f;
1477 1469
      ncnt++;
1478 1470
      if (!n->routes)		/* Orphaned FIB entry */
1479 1471
	{
1480
	  FIB_ITERATE_PUT(&fit, f);
1481
	  fib_delete(&tab->fib, f);
1472
	  FIB_ITERATE_PUT(&fit);
1473
	  fib_delete(&tab->fib, n);
1482 1474
	  ndel++;
1483 1475
	  goto again;
1484 1476
	}
1485 1477
    }
1486
  FIB_ITERATE_END(f);
1478
  FIB_ITERATE_END;
1487 1479
  DBG("Pruned %d of %d networks\n", ndel, ncnt);
1488 1480

  
1489 1481
  tab->gc_counter = 0;
......
1572 1564
    }
1573 1565

  
1574 1566
again:
1575
  FIB_ITERATE_START(&tab->fib, fit, fn)
1567
  FIB_ITERATE_START(&tab->fib, fit, net, n)
1576 1568
    {
1577
      net *n = (net *) fn;
1578 1569
      rte *e;
1579 1570

  
1580 1571
    rescan:
......
1583 1574
	  {
1584 1575
	    if (*limit <= 0)
1585 1576
	      {
1586
		FIB_ITERATE_PUT(fit, fn);
1577
		FIB_ITERATE_PUT(fit);
1587 1578
		return 0;
1588 1579
	      }
1589 1580

  
......
1594 1585
	  }
1595 1586
      if (!n->routes)		/* Orphaned FIB entry */
1596 1587
	{
1597
	  FIB_ITERATE_PUT(fit, fn);
1598
	  fib_delete(&tab->fib, fn);
1588
	  FIB_ITERATE_PUT(fit);
1589
	  fib_delete(&tab->fib, n);
1599 1590
	  goto again;
1600 1591
	}
1601 1592
    }
1602
  FIB_ITERATE_END(fn);
1593
  FIB_ITERATE_END;
1603 1594

  
1604 1595
#ifdef DEBUGGING
1605 1596
  fib_check(&tab->fib);
......
1791 1782
      tab->nhu_state = 2;
1792 1783
    }
1793 1784

  
1794
  FIB_ITERATE_START(&tab->fib, fit, fn)
1785
  FIB_ITERATE_START(&tab->fib, fit, net, n)
1795 1786
    {
1796 1787
      if (max_feed <= 0)
1797 1788
	{
1798
	  FIB_ITERATE_PUT(fit, fn);
1789
	  FIB_ITERATE_PUT(fit);
1799 1790
	  ev_schedule(tab->rt_event);
1800 1791
	  return;
1801 1792
	}
1802
      max_feed -= rt_next_hop_update_net(tab, (net *) fn);
1793
      max_feed -= rt_next_hop_update_net(tab, n);
1803 1794
    }
1804
  FIB_ITERATE_END(fn);
1795
  FIB_ITERATE_END;
1805 1796

  
1806 1797
  /* state change 2->0, 3->1 */
1807 1798
  tab->nhu_state &= 1;
......
1971 1962

  
1972 1963
again:
1973 1964
  h = p->feed_ahook;
1974
  FIB_ITERATE_START(&h->table->fib, fit, fn)
1965
  FIB_ITERATE_START(&h->table->fib, fit, net, n)
1975 1966
    {
1976
      net *n = (net *) fn;
1977 1967
      rte *e = n->routes;
1978 1968
      if (max_feed <= 0)
1979 1969
	{
1980
	  FIB_ITERATE_PUT(fit, fn);
1970
	  FIB_ITERATE_PUT(fit);
1981 1971
	  return 0;
1982 1972
	}
1983 1973

  
......
2008 1998
	    max_feed--;
2009 1999
	  }
2010 2000
    }
2011
  FIB_ITERATE_END(fn);
2001
  FIB_ITERATE_END;
2012 2002
  p->feed_ahook = h->next;
2013 2003
  if (!p->feed_ahook)
2014 2004
    {
......
2534 2524
  struct fib *fib = &d->table->fib;
2535 2525
  struct fib_iterator *it = &d->fit;
2536 2526

  
2537
  FIB_ITERATE_START(fib, it, f)
2527
  FIB_ITERATE_START(fib, it, net, n)
2538 2528
    {
2539
      net *n = (net *) f;
2540 2529
      if (d->running_on_config && d->running_on_config != config)
2541 2530
	{
2542 2531
	  cli_printf(c, 8004, "Stopped due to reconfiguration");
......
2549 2538
	}
2550 2539
      if (!max--)
2551 2540
	{
2552
	  FIB_ITERATE_PUT(it, f);
2541
	  FIB_ITERATE_PUT(it);
2553 2542
	  return;
2554 2543
	}
2555 2544
      rt_show_net(c, n, d);
2556 2545
    }
2557
  FIB_ITERATE_END(f);
2546
  FIB_ITERATE_END;
2558 2547
  if (d->stats)
2559 2548
    cli_printf(c, 14, "%d of %d routes for %d networks", d->show_counter, d->rt_counter, d->net_counter);
2560 2549
  else

Also available in: Unified diff