Revision 600998fc proto/ospf/rt.c

View differences:

proto/ospf/rt.c
1158 1158
ospf_rt_abr1(struct ospf_proto *p)
1159 1159
{
1160 1160
  struct area_net *anet;
1161
  ort *nf, *default_nf;
1161
  ort *default_nf;
1162 1162
  net_addr default_net;
1163 1163

  
1164 1164
  /* RFC 2328 G.3 - incomplete resolution of virtual next hops - routers */
1165
  FIB_WALK(&p->backbone->rtr, nftmp)
1165
  FIB_WALK(&p->backbone->rtr, ort, nf)
1166 1166
  {
1167
    nf = (ort *) nftmp;
1168

  
1169 1167
    if (nf->n.type && unresolved_vlink(nf))
1170 1168
      reset_ri(nf);
1171 1169
  }
1172 1170
  FIB_WALK_END;
1173 1171

  
1174 1172

  
1175
  FIB_WALK(&p->rtf, nftmp)
1173
  FIB_WALK(&p->rtf, ort, nf)
1176 1174
  {
1177
    nf = (ort *) nftmp;
1178

  
1179

  
1180 1175
    /* RFC 2328 G.3 - incomplete resolution of virtual next hops - networks */
1181 1176
    if (nf->n.type && unresolved_vlink(nf))
1182 1177
      reset_ri(nf);
......
1241 1236
    /* RFC 2328 16.4. (3) - precompute preferred ASBR entries */
1242 1237
    if (oa_is_ext(oa))
1243 1238
    {
1244
      FIB_WALK(&oa->rtr, nftmp)
1239
      FIB_WALK(&oa->rtr, ort, nf)
1245 1240
      {
1246
	nf = (ort *) nftmp;
1247 1241
	if (nf->n.options & ORTA_ASBR)
1248 1242
	  ri_install_asbr(p, rid_from_net(nf->fn.addr), &nf->n);
1249 1243
      }
......
1253 1247

  
1254 1248

  
1255 1249
  /* Originate or flush ASBR summary LSAs */
1256
  FIB_WALK(&p->backbone->rtr, nftmp)
1250
  FIB_WALK(&p->backbone->rtr, ort, nf)
1257 1251
  {
1258
    check_sum_rt_lsa(p, (ort *) nftmp);
1252
    check_sum_rt_lsa(p, nf);
1259 1253
  }
1260 1254
  FIB_WALK_END;
1261 1255

  
......
1282 1276
{
1283 1277
  struct ospf_area *oa;
1284 1278
  struct top_hash_entry *en;
1285
  ort *nf, *nf2;
1286

  
1287 1279

  
1288 1280
  /* RFC 3103 3.1 - type-7 translator election */
1289 1281
  struct ospf_area *bb = p->backbone;
......
1295 1287
      if (oa->ac->translator)
1296 1288
	goto decided;
1297 1289

  
1298
      FIB_WALK(&oa->rtr, nftmp)
1290
      FIB_WALK(&oa->rtr, ort, nf)
1299 1291
      {
1300
	nf = (ort *) nftmp;
1301 1292
	if (!nf->n.type || !(nf->n.options & ORTA_ABR))
1302 1293
	  continue;
1303 1294

  
1304
	nf2 = fib_find(&bb->rtr, nf->fn.addr);
1295
	ort *nf2 = fib_find(&bb->rtr, nf->fn.addr);
1305 1296
	if (!nf2 || !nf2->n.type || !(nf2->n.options & ORTA_ABR))
1306 1297
	  continue;
1307 1298

  
......
1341 1332

  
1342 1333

  
1343 1334
  /* Compute condensed external networks */
1344
  FIB_WALK(&p->rtf, nftmp)
1335
  FIB_WALK(&p->rtf, ort, nf)
1345 1336
  {
1346
    nf = (ort *) nftmp;
1347 1337
    if (rt_is_nssa(nf) && (nf->n.options & ORTA_PROP))
1348 1338
    {
1349
      struct area_net *anet = (struct area_net *)
1350
	fib_route(&nf->n.oa->enet_fib, nf->fn.addr);
1339
      struct area_net *anet = fib_route(&nf->n.oa->enet_fib, nf->fn.addr);
1351 1340

  
1352 1341
      if (anet)
1353 1342
      {
......
1356 1345
	  anet->active = 1;
1357 1346

  
1358 1347
	  /* Get a RT entry and mark it to know that it is an area network */
1359
	  nf2 = fib_get(&p->rtf, anet->fn.addr);
1348
	  ort *nf2 = fib_get(&p->rtf, anet->fn.addr);
1360 1349
	  nf2->area_net = 1;
1361 1350
	}
1362 1351

  
......
1371 1360
  FIB_WALK_END;
1372 1361

  
1373 1362

  
1374
  FIB_WALK(&p->rtf, nftmp)
1363
  FIB_WALK(&p->rtf, ort, nf)
1375 1364
  {
1376
    nf = (ort *) nftmp;
1377

  
1378 1365
    check_sum_net_lsa(p, nf);
1379 1366
    check_nssa_lsa(p, nf);
1380 1367
  }
......
1586 1573
{
1587 1574
  struct ospf_area *oa;
1588 1575
  struct top_hash_entry *en;
1589
  struct area_net *anet;
1590
  ort *ri;
1591 1576

  
1592 1577
  /* Reset old routing table */
1593
  FIB_WALK(&p->rtf, nftmp)
1578
  FIB_WALK(&p->rtf, ort, ri)
1594 1579
  {
1595
    ri = (ort *) nftmp;
1596 1580
    ri->area_net = 0;
1597 1581
    reset_ri(ri);
1598 1582
  }
......
1613 1597
  WALK_LIST(oa, p->area_list)
1614 1598
  {
1615 1599
    /* Reset ASBR routing tables */
1616
    FIB_WALK(&oa->rtr, nftmp)
1600
    FIB_WALK(&oa->rtr, ort, ri)
1617 1601
    {
1618
      ri = (ort *) nftmp;
1619 1602
      reset_ri(ri);
1620 1603
    }
1621 1604
    FIB_WALK_END;
......
1623 1606
    /* Reset condensed area networks */
1624 1607
    if (p->areano > 1)
1625 1608
    {
1626
      FIB_WALK(&oa->net_fib, nftmp)
1609
      FIB_WALK(&oa->net_fib, struct area_net, anet)
1627 1610
      {
1628
	anet = (struct area_net *) nftmp;
1629 1611
	anet->active = 0;
1630 1612
	anet->metric = 0;
1631 1613
      }
1632 1614
      FIB_WALK_END;
1633 1615

  
1634
      FIB_WALK(&oa->enet_fib, nftmp)
1616
      FIB_WALK(&oa->enet_fib, struct area_net, anet)
1635 1617
      {
1636
	anet = (struct area_net *) nftmp;
1637 1618
	anet->active = 0;
1638 1619
	anet->metric = 0;
1639 1620
      }
......
1935 1916
  struct top_hash_entry *en;
1936 1917
  struct fib_iterator fit;
1937 1918
  struct fib *fib = &p->rtf;
1938
  ort *nf;
1939 1919
  struct ospf_area *oa;
1940 1920

  
1941 1921
  /* This is used for forced reload of routes */
......
1946 1926
  DBG("Now syncing my rt table with nest's\n");
1947 1927
  FIB_ITERATE_INIT(&fit, fib);
1948 1928
again1:
1949
  FIB_ITERATE_START(fib, &fit, nftmp)
1929
  FIB_ITERATE_START(fib, &fit, ort, nf)
1950 1930
  {
1951
    nf = (ort *) nftmp;
1952

  
1953 1931
    /* Sanity check of next-hop addresses, failure should not happen */
1954 1932
    if (nf->n.type)
1955 1933
    {
......
2027 2005
    /* Remove unused rt entry, some special entries are persistent */
2028 2006
    if (!nf->n.type && !nf->external_rte && !nf->area_net)
2029 2007
    {
2030
      FIB_ITERATE_PUT(&fit, nftmp);
2031
      fib_delete(fib, nftmp);
2008
      FIB_ITERATE_PUT(&fit);
2009
      fib_delete(fib, nf);
2032 2010
      goto again1;
2033 2011
    }
2034 2012
  }
2035
  FIB_ITERATE_END(nftmp);
2013
  FIB_ITERATE_END;
2036 2014

  
2037 2015

  
2038 2016
  WALK_LIST(oa, p->area_list)
......
2040 2018
    /* Cleanup ASBR hash tables */
2041 2019
    FIB_ITERATE_INIT(&fit, &oa->rtr);
2042 2020
again2:
2043
    FIB_ITERATE_START(&oa->rtr, &fit, nftmp)
2021
    FIB_ITERATE_START(&oa->rtr, &fit, ort, nf)
2044 2022
    {
2045
      nf = (ort *) nftmp;
2046

  
2047 2023
      if (!nf->n.type)
2048 2024
      {
2049
	FIB_ITERATE_PUT(&fit, nftmp);
2050
	fib_delete(&oa->rtr, nftmp);
2025
	FIB_ITERATE_PUT(&fit);
2026
	fib_delete(&oa->rtr, nf);
2051 2027
	goto again2;
2052 2028
      }
2053 2029
    }
2054
    FIB_ITERATE_END(nftmp);
2030
    FIB_ITERATE_END;
2055 2031
  }
2056 2032

  
2057 2033
  /* Cleanup stale LSAs */

Also available in: Unified diff