Revision a7a7372a proto/ospf/rt.c
proto/ospf/rt.c | ||
---|---|---|
557 | 557 |
|
558 | 558 |
/* Errata 2078 to RFC 5340 4.8.1 - skip links from non-routing nodes */ |
559 | 559 |
if (ospf_is_v3(p) && (act != oa->rt) && !(rt->options & OPT_R)) |
560 |
break;
|
|
560 |
return;
|
|
561 | 561 |
|
562 | 562 |
/* Now process Rt links */ |
563 | 563 |
for (lsa_walk_rt_init(p, act, &rtl), i = 0; lsa_walk_rt(&rtl); i++) |
... | ... | |
688 | 688 |
|
689 | 689 |
if (oa->rt == NULL) |
690 | 690 |
return; |
691 |
if (oa->rt->lsa.age == LSA_MAXAGE) |
|
692 |
return; |
|
691 | 693 |
|
692 | 694 |
OSPF_TRACE(D_EVENTS, "Starting routing table calculation for area %R", oa->areaid); |
693 | 695 |
|
... | ... | |
1087 | 1089 |
struct area_net *anet = NULL; |
1088 | 1090 |
struct ospf_area *anet_oa = NULL; |
1089 | 1091 |
|
1090 |
/* RT entry marked as area network */ |
|
1091 |
if (nf->fn.flags & OSPF_RT_PERSISTENT) |
|
1092 |
if (nf->area_net) |
|
1092 | 1093 |
{ |
1093 | 1094 |
/* It is a default route for stub areas, handled entirely in ospf_rt_abr() */ |
1094 | 1095 |
if (nf->fn.pxlen == 0) |
... | ... | |
1162 | 1163 |
if (nf->external_rte) |
1163 | 1164 |
return; |
1164 | 1165 |
|
1165 |
/* RT entry marked as area network */ |
|
1166 |
if (nf->fn.flags & OSPF_RT_PERSISTENT) |
|
1166 |
if (nf->area_net) |
|
1167 | 1167 |
{ |
1168 | 1168 |
/* Find that area network */ |
1169 | 1169 |
WALK_LIST(oa, p->area_list) |
... | ... | |
1176 | 1176 |
|
1177 | 1177 |
/* RFC 3103 3.2 (3) - originate the aggregated address range */ |
1178 | 1178 |
if (anet && anet->active && !anet->hidden && oa->translate) |
1179 |
ospf_originate_ext_lsa(p, NULL, nf, LSA_RTCALC, anet->metric, |
|
1179 |
ospf_originate_ext_lsa(p, NULL, nf, LSA_M_RTCALC, anet->metric,
|
|
1180 | 1180 |
(anet->metric & LSA_EXT3_EBIT), IPA_NONE, anet->tag, 0); |
1181 | 1181 |
|
1182 | 1182 |
/* RFC 3103 3.2 (2) - originate the same network */ |
1183 | 1183 |
else if (decide_nssa_lsa(p, nf, &rt)) |
1184 |
ospf_originate_ext_lsa(p, NULL, nf, LSA_RTCALC, rt.metric, rt.ebit, rt.fwaddr, rt.tag, 0); |
|
1184 |
ospf_originate_ext_lsa(p, NULL, nf, LSA_M_RTCALC, rt.metric, rt.ebit, rt.fwaddr, rt.tag, 0);
|
|
1185 | 1185 |
} |
1186 | 1186 |
|
1187 | 1187 |
/* RFC 2328 16.7. p2 - find new/lost vlink endpoints */ |
... | ... | |
1273 | 1273 |
|
1274 | 1274 |
/* Get a RT entry and mark it to know that it is an area network */ |
1275 | 1275 |
ort *nfi = (ort *) fib_get(&p->rtf, &anet->fn.prefix, anet->fn.pxlen); |
1276 |
nfi->fn.flags |= OSPF_RT_PERSISTENT; /* mark persistent, to have stable UID */
|
|
1276 |
nfi->area_net = 1;
|
|
1277 | 1277 |
|
1278 | 1278 |
/* 16.2. (3) */ |
1279 | 1279 |
if (nfi->n.type == RTS_OSPF_IA) |
... | ... | |
1289 | 1289 |
|
1290 | 1290 |
ip_addr addr = IPA_NONE; |
1291 | 1291 |
default_nf = (ort *) fib_get(&p->rtf, &addr, 0); |
1292 |
default_nf->fn.flags |= OSPF_RT_PERSISTENT; /* keep persistent */
|
|
1292 |
default_nf->area_net = 1;
|
|
1293 | 1293 |
|
1294 | 1294 |
struct ospf_area *oa; |
1295 | 1295 |
WALK_LIST(oa, p->area_list) |
... | ... | |
1309 | 1309 |
*/ |
1310 | 1310 |
|
1311 | 1311 |
if (oa_is_nssa(oa) && oa->ac->default_nssa) |
1312 |
ospf_originate_ext_lsa(p, oa, default_nf, LSA_RTCALC, oa->ac->default_cost, |
|
1312 |
ospf_originate_ext_lsa(p, oa, default_nf, LSA_M_RTCALC, oa->ac->default_cost,
|
|
1313 | 1313 |
(oa->ac->default_cost & LSA_EXT3_EBIT), IPA_NONE, 0, 0); |
1314 | 1314 |
|
1315 | 1315 |
/* RFC 2328 16.4. (3) - precompute preferred ASBR entries */ |
... | ... | |
1348 | 1348 |
return; |
1349 | 1349 |
|
1350 | 1350 |
oa->translate = TRANS_OFF; |
1351 |
schedule_rtcalc(oa->po); |
|
1351 |
ospf_schedule_rtcalc(oa->po);
|
|
1352 | 1352 |
} |
1353 | 1353 |
|
1354 | 1354 |
static void |
... | ... | |
1431 | 1431 |
|
1432 | 1432 |
/* Get a RT entry and mark it to know that it is an area network */ |
1433 | 1433 |
nf2 = (ort *) fib_get(&p->rtf, &anet->fn.prefix, anet->fn.pxlen); |
1434 |
nf2->fn.flags |= OSPF_RT_PERSISTENT; /* keep persistent */
|
|
1434 |
nf2->area_net = 1;
|
|
1435 | 1435 |
} |
1436 | 1436 |
|
1437 | 1437 |
u32 metric = (nf->n.type == RTS_OSPF_EXT1) ? |
... | ... | |
1634 | 1634 |
FIB_WALK(&p->rtf, nftmp) |
1635 | 1635 |
{ |
1636 | 1636 |
ri = (ort *) nftmp; |
1637 |
ri->fn.flags &= ~OSPF_RT_PERSISTENT;
|
|
1637 |
ri->area_net = 0;
|
|
1638 | 1638 |
reset_ri(ri); |
1639 | 1639 |
} |
1640 | 1640 |
FIB_WALK_END; |
... | ... | |
1647 | 1647 |
en->nhs = NULL; |
1648 | 1648 |
en->lb = IPA_NONE; |
1649 | 1649 |
|
1650 |
if (en->rtcalc == LSA_RTCALC)
|
|
1651 |
en->rtcalc = LSA_STALE;
|
|
1650 |
if (en->mode == LSA_M_RTCALC)
|
|
1651 |
en->mode = LSA_M_STALE;
|
|
1652 | 1652 |
} |
1653 | 1653 |
|
1654 | 1654 |
WALK_LIST(oa, p->area_list) |
... | ... | |
1683 | 1683 |
} |
1684 | 1684 |
} |
1685 | 1685 |
|
1686 |
static void |
|
1687 |
ospf_flush_stale(struct ospf_proto *p) |
|
1688 |
{ |
|
1689 |
} |
|
1690 |
|
|
1691 | 1686 |
/** |
1692 | 1687 |
* ospf_rt_spf - calculate internal routes |
1693 |
* @p: OSPF protocol |
|
1688 |
* @p: OSPF protocol instance
|
|
1694 | 1689 |
* |
1695 | 1690 |
* Calculation of internal paths in an area is described in 16.1 of RFC 2328. |
1696 | 1691 |
* It's based on Dijkstra's shortest path tree algorithms. |
... | ... | |
2064 | 2059 |
rte_update(&p->p, ne, NULL); |
2065 | 2060 |
} |
2066 | 2061 |
|
2067 |
/* Remove unused rt entry. Entries with any flags are persistent. */
|
|
2068 |
if (!nf->n.type && !nf->external_rte) // XXXX
|
|
2062 |
/* Remove unused rt entry, some special entries are persistent */
|
|
2063 |
if (!nf->n.type && !nf->external_rte && !nf->area_net)
|
|
2069 | 2064 |
{ |
2070 | 2065 |
FIB_ITERATE_PUT(&fit, nftmp); |
2071 | 2066 |
fib_delete(fib, nftmp); |
... | ... | |
2096 | 2091 |
|
2097 | 2092 |
/* Cleanup stale LSAs */ |
2098 | 2093 |
WALK_SLIST(en, p->lsal) |
2099 |
if (en->rtcalc == LSA_STALE)
|
|
2094 |
if (en->mode == LSA_M_STALE)
|
|
2100 | 2095 |
ospf_flush_lsa(p, en); |
2101 | 2096 |
} |
Also available in: Unified diff