When an OSPF router installs a changed LSA, which changes force a full SPF run and which allow a cheaper recalculation?
answer
- topology versus reachability
- contents, not sequence numbers
- every attached area, not one
- one destination for summaries
- incremental SPF is out of scope
basics
~20 sUnder RFC 2328, a changed router-LSA or network-LSA forces a full recalculation that includes SPF for every attached area. A changed summary-LSA or AS-external-LSA normally recomputes just its destination. Incremental SPF, which repairs part of the tree, is an implementation feature.
solid answer
~50 sRFC 2328 Section 13.2 first asks whether the LSA's **contents** changed: its options, its length, its MaxAge status or its body. A periodic refresh that only bumps the sequence number and checksum triggers nothing. A changed **router-LSA or network-LSA** alters topology, so the whole routing table is rebuilt, starting with SPF for **every attached area**, because an AS boundary router may be reachable through several areas. A changed **summary-LSA** reruns the inter-area calculation for its one destination (Section 16.5). If that changes the path to an ASBR, external routes are re-examined too, and on an area border router a cost increase in a transit area forces a full run. A changed **AS-external-LSA** recomputes one prefix, or nothing if an internal route exists (Section 16.6). **Incremental SPF** repairs only the affected part of a tree, and RFC 2328 leaves it out of scope as an implementation optimisation.
go deeper
Recall that a change in a router's links makes routers recompute their shortest-path trees, while changes to routes from outside the area are cheaper to absorb.
Explain RFC 2328's contents comparison, why a refresh triggers nothing, and how a router- or network-LSA change differs from a summary- or external-LSA change.
State exactly when a full run is required, including every attached area on an area border router and the transit-area cost increase, and label incremental SPF as an implementation feature.
Connect the cost ladder to design: area size, which prefixes ride in router-LSAs versus summaries, and how much churn each choice exposes the control plane to.
## Why the cost of a change matters A full SPF run is one of the most expensive things an OSPF router does in steady operation. It rebuilds the shortest-path tree of every attached area, then every route that depends on those trees. In a large area that changes often, a full run and a single-prefix update are the difference between a busy control plane and a quiet one. RFC 2328 (OSPFv2) states which change costs what, and OSPF for IPv6 (RFC 5340) applies the same rules to its own LSA types. ## Step one: did the contents change? When a new LSA instance is installed, whether it arrived by flooding or the router originated it, Section 13.2 compares it with the old instance. Only these count as a change in contents: - the **Options** field changed; - one instance has reached **MaxAge** and the other has not; - the **length** field in the LSA header changed; - the **body**, meaning anything after the 20-byte header, changed. A new **LS sequence number** and **LS checksum** on their own are not a change. So the refresh a router performs on each of its own LSAs every 30 minutes triggers no recalculation anywhere. ## The ladder RFC 2328 sets | Changed LSA | What must be recalculated | RFC 2328 section | |---|---|---| | Router-LSA (type 1) or network-LSA (type 2) | The entire routing table, starting with SPF for each attached area | 13.2, 16 | | Summary-LSA, type 3 (network) | The best route to that one destination | 16.5 | | Summary-LSA, type 4 (AS boundary router) | The route to that ASBR, then possibly every AS-external route | 16.5 | | AS-external-LSA (type 5) | The best route to that one prefix, or nothing if an internal route exists | 16.6 | | Refresh with unchanged contents | Nothing | 13.2 | ## Why a topology change rebuilds every area A router-LSA or network-LSA describes links, so changing one can change any distance in its area's tree. RFC 2328 goes further and requires SPF for **every** area the router is attached to, not only the area whose database changed. The reason is that an **AS boundary router** can sit in more than one area. A change in the area that currently gives the best route can make an intra-area route through a different area the better one. A note in RFC 2328 adds that an implementation keeping more state can recalculate just one area. That is an optimisation, not a requirement. A full rebuild runs in this order: 1. Invalidate the routing table and keep the old one for comparison. 2. Build each attached area's tree: transit vertices first, stub networks second. 3. Add inter-area routes from summary-LSAs. 4. On an area border router attached to a transit area, check that area's summary-LSAs for better paths. 5. Compute external routes from AS-external-LSAs. ## The cheaper recalculations A **summary-LSA** (Section 16.5) describes a destination outside the area as a cost from an area border router, so a changed one rarely needs the tree. - On a router that is not an area border router, or for a backbone summary-LSA, the router invalidates that destination's inter-area route and reruns the inter-area calculation for that destination only. - If the result changes the path to an ASBR (a type 4 summary) or to a forwarding address, **all** AS-external-LSAs are re-examined. If the destination has become unreachable, external routes are rechecked for that one destination. - On an area border router, for a summary-LSA in a **transit area** (an area that a virtual link crosses), a **cost increase** forces the complete calculation, starting with SPF. For an **AS-external-LSA** (Section 16.6), nothing is recomputed if an intra-area or inter-area route to the prefix already exists, because internal routes take precedence. Otherwise the external calculation runs for that prefix only. ## Incremental and partial computation: implementation territory - **Incremental SPF** repairs only the part of a tree a change affects, such as re-parenting the subtree behind a failed link, instead of rebuilding from the root. RFC 2328 mentions such algorithms as more efficient, citing 1978 ARPANET work, and calls them **beyond the scope** of the specification. Whatever method is used must produce the identical tree. - **Partial route computation** recomputes routes for changed prefixes without rebuilding the tree. RFC 8405 names full SPF, incremental SPF and partial route computation side by side and calls the choice among them "a local consideration". - Some implementations handle a router-LSA change that touches only **stub-network links** as a stage-2 update, because stub links never alter the transit tree. RFC 2328 itself still lists any change to a router-LSA's body as a full recalculation. - OSPF for IPv6 moves prefixes out of router-LSAs and network-LSAs into separate LSAs, which makes a prefix-only change easy for an implementation to isolate. Even so, RFC 5340 lists changes to Intra-Area-Prefix-LSAs and Link-LSAs among those that recalculate the entire routing table. ## What it means in operation - A flapping **transit** link in a big area is expensive everywhere in that area. Every router's tree changes, and every area border router reruns SPF for all of its areas. - A flapping prefix that other areas see only as a **summary**, or that enters as an **external** route, costs far less per event. That is one argument for summarising at area borders. - How often these runs happen is controlled separately: SPF throttling batches a burst of changes into fewer runs.
- What is incremental SPF, and is it part of the OSPF specification?Incremental SPF updates only the part of a shortest-path tree a change affects, instead of rebuilding from the root. RFC 2328 notes such algorithms are more efficient and cites 1978 ARPANET work, but calls them beyond the scope of the specification. It requires only that any method produce the identical tree, so incremental SPF is an implementation feature.
- Why does a router-LSA change in one area make an OSPF area border router rerun SPF for all its areas?RFC 2328 Section 13.2 gives the reason: an AS boundary router may belong to several areas. A change in the area that currently gives the best route can make an intra-area route through a different area the better one, so every area's tree is recomputed. Implementations that keep extra state can avoid this; the RFC does not require it.
- Does OSPFv3's move of prefixes out of router-LSAs let the standard skip SPF when a prefix changes?No. RFC 5340 Section 4.5.3 lists changes to Intra-Area-Prefix-LSAs and Link-LSAs among those that recalculate the entire routing table, alongside router-LSAs and network-LSAs. The separation makes a prefix-only change easy for an implementation to isolate, but skipping the tree build is the implementation's optimisation, not the standard's rule.
saying these in an interview costs you the question
- A router-LSA change only triggers SPF in the area that LSA belongs to.
- Every newer LSA instance, even a pure 30-minute refresh, triggers an SPF run.
- Incremental SPF is a mandatory part of RFC 2328.
- A changed AS-external-LSA requires rebuilding the shortest-path tree.
- A changed summary-LSA can never force a full SPF run.