Skip to main content

15. Virtual Links

    algorithm then iterates again.  It terminates when the candidate
    list becomes empty.

    The following steps describe the algorithm in detail.  Remember
    that we are computing the shortest path tree for Area A.  All
    references to link state database lookup below are from Area A's
    database.

    (1) Initialize the algorithm's data structures.  Clear the list
        of candidate vertices.  Initialize the shortest-path tree to
        only the root (which is the router doing the calculation).
        Set Area A's TransitCapability to FALSE.

    (2) Call the vertex just added to the tree vertex V.  Examine
        the LSA associated with vertex V.  This is a lookup in the
        Area A's link state database based on the Vertex ID.  If
        this is a router-LSA, and bit V of the router-LSA (see
        Section A.4.2) is set, set Area A's TransitCapability to
        TRUE.  In any case, each link described by the LSA gives the
        cost to an adjacent vertex.  For each described link, (say
        it joins vertex V to vertex W):

        (a) If this is a link to a stub network, examine the next
            link in V's LSA.  Links to stub networks will be
            considered in the second stage of the shortest path
            calculation.

        (b) Otherwise, W is a transit vertex (router or transit
            network).  Look up the vertex W's LSA (router-LSA or
            network-LSA) in Area A's link state database.  If the
            LSA does not exist, or its LS age is equal to MaxAge, or
            it does not have a link back to vertex V, examine the
            next link in V's LSA.[23]

        (c) If vertex W is already on the shortest-path tree,
            examine the next link in the LSA.

        (d) Calculate the link state cost D of the resulting path
            from the root to vertex W.  D is equal to the sum of the
            link state cost of the (already calculated) shortest
            path to vertex V and the advertised cost of the link
            between vertices V and W.  If D is:






            o   Greater than the value that already appears for
                vertex W on the candidate list, then examine the
                next link.

            o   Equal to the value that appears for vertex W on the
                candidate list, calculate the set of next hops that
                result from using the advertised link.  Input to
                this calculation is the destination (W), and its
                parent (V).  This calculation is shown in Section
                16.1.1.  This set of hops should be added to the
                next hop values that appear for W on the candidate
                list.

            o   Less than the value that appears for vertex W on the
                candidate list, or if W does not yet appear on the
                candidate list, then set the entry for W on the
                candidate list to indicate a distance of D from the
                root.  Also calculate the list of next hops that
                result from using the advertised link, setting the
                next hop values for W accordingly.  The next hop
                calculation is described in Section 16.1.1; it takes
                as input the destination (W) and its parent (V).

    (3) If at this step the candidate list is empty, the shortest-
        path tree (of transit vertices) has been completely built
        and this stage of the procedure terminates.  Otherwise,
        choose the vertex belonging to the candidate list that is
        closest to the root, and add it to the shortest-path tree
        (removing it from the candidate list in the process). Note
        that when there is a choice of vertices closest to the root,
        network vertices must be chosen before router vertices in
        order to necessarily find all equal-cost paths. This is
        consistent with the tie-breakers that were introduced in the
        modified Dijkstra algorithm used by OSPF's Multicast routing
        extensions (MOSPF).

    (4) Possibly modify the routing table.  For those routing table
        entries modified, the associated area will be set to Area A,
        the path type will be set to intra-area, and the cost will
        be set to the newly discovered shortest path's calculated
        distance.







        If the newly added vertex is an area border router or AS
        boundary router, a routing table entry is added whose
        destination type is "router".  The Options field found in
        the associated router-LSA is copied into the routing table
        entry's Optional capabilities field. Call the newly added
        vertex Router X.  If Router X is the endpoint of one of the
        calculating router's virtual links, and the virtual link
        uses Area A as Transit area:  the virtual link is declared
        up, the IP address of the virtual interface is set to the IP
        address of the outgoing interface calculated above for
        Router X, and the virtual neighbor's IP address is set to
        Router X's interface address (contained in Router X's
        router-LSA) that points back to the root of the shortest-
        path tree; equivalently, this is the interface that points
        back to Router X's parent vertex on the shortest-path tree
        (similar to the calculation in Section 16.1.1).

        If the newly added vertex is a transit network, the routing
        table entry for the network is located.  The entry's
        Destination ID is the IP network number, which can be
        obtained by masking the Vertex ID (Link State ID) with its
        associated subnet mask (found in the body of the associated
        network-LSA).  If the routing table entry already exists
        (i.e., there is already an intra-area route to the
        destination installed in the routing table), multiple
        vertices have mapped to the same IP network.  For example,
        this can occur when a new Designated Router is being
        established.  In this case, the current routing table entry
        should be overwritten if and only if the newly found path is
        just as short and the current routing table entry's Link
        State Origin has a smaller Link State ID than the newly
        added vertex' LSA.

        If there is no routing table entry for the network (the
        usual case), a routing table entry for the IP network should
        be added.  The routing table entry's Link State Origin
        should be set to the newly added vertex' LSA.

    (5) Iterate the algorithm by returning to Step 2.









    The stub networks are added to the tree in the procedure's
    second stage.  In this stage, all router vertices are again
    examined.  Those that have been determined to be unreachable in
    the above first phase are discarded.  For each reachable router
    vertex (call it V), the associated router-LSA is found in the
    link state database.  Each stub network link appearing in the
    LSA is then examined, and the following steps are executed:

    (1) Calculate the distance D of stub network from the root.  D
        is equal to the distance from the root to the router vertex
        (calculated in stage 1), plus the stub network link's
        advertised cost.  Compare this distance to the current best
        cost to the stub network.  This is done by looking up the
        stub network's current routing table entry.  If the
        calculated distance D is larger, go on to examine the next
        stub network link in the LSA.

    (2) If this step is reached, the stub network's routing table
        entry must be updated.  Calculate the set of next hops that
        would result from using the stub network link.  This
        calculation is shown in Section 16.1.1; input to this
        calculation is the destination (the stub network) and the
        parent vertex (the router vertex).  If the distance D is the
        same as the current routing table cost, simply add this set
        of next hops to the routing table entry's list of next hops.
        In this case, the routing table already has a Link State
        Origin.  If this Link State Origin is a router-LSA whose
        Link State ID is smaller than V's Router ID, reset the Link
        State Origin to V's router-LSA.

        Otherwise D is smaller than the routing table cost.
        Overwrite the current routing table entry by setting the
        routing table entry's cost to D, and by setting the entry's
        list of next hops to the newly calculated set.  Set the
        routing table entry's Link State Origin to V's router-LSA.
        Then go on to examine the next stub network link.


    For all routing table entries added/modified in the second
    stage, the associated area will be set to Area A and the path
    type will be set to intra-area.  When the list of reachable
    router-LSAs is exhausted, the second stage is completed.  At






    this time, all intra-area routes associated with Area A have
    been determined.

    The specification does not require that the above two stage
    method be used to calculate the shortest path tree.  However, if
    another algorithm is used, an identical tree must be produced.
    For this reason, it is important to note that links between
    transit vertices must be bidirectional in order to be included
    in the above tree.  It should also be mentioned that more
    efficient algorithms exist for calculating the tree; for
    example, the incremental SPF algorithm described in [Ref1].


    16.1.1.  The next hop calculation

        This section explains how to calculate the current set of
        next hops to use for a destination.  Each next hop consists
        of the outgoing interface to use in forwarding packets to
        the destination together with the IP address of the next hop
        router (if any).  The next hop calculation is invoked each
        time a shorter path to the destination is discovered.  This
        can happen in either stage of the shortest-path tree
        calculation (see Section 16.1).  In stage 1 of the
        shortest-path tree calculation a shorter path is found as
        the destination is added to the candidate list, or when the
        destination's entry on the candidate list is modified (Step
        2d of Stage 1).  In stage 2 a shorter path is discovered
        each time the destination's routing table entry is modified
        (Step 2 of Stage 2).

        The set of next hops to use for the destination may be
        recalculated several times during the shortest-path tree
        calculation, as shorter and shorter paths are discovered.
        In the end, the destination's routing table entry will
        always reflect the next hops resulting from the absolute
        shortest path(s).

        Input to the next hop calculation is a) the destination and
        b) its parent in the current shortest path between the root
        (the calculating router) and the destination.  The parent is
        always a transit vertex (i.e., always a router or a transit
        network).






        If there is at least one intervening router in the current
        shortest path between the destination and the root, the
        destination simply inherits the set of next hops from the
        parent.  Otherwise, there are two cases.  In the first case,
        the parent vertex is the root (the calculating router
        itself).  This means that the destination is either a
        directly connected network or directly connected router.
        The outgoing interface in this case is simply the OSPF
        interface connecting to the destination network/router. If
        the destination is a router which connects to the
        calculating router via a Point-to-MultiPoint network, the
        destination's next hop IP address(es) can be determined by
        examining the destination's router-LSA: each link pointing
        back to the calculating router and having a Link Data field
        belonging to the Point-to-MultiPoint network provides an IP
        address of the next hop router. If the destination is a
        directly connected network, or a router which connects to
        the calculating router via a point-to-point interface, no
        next hop IP address is required. If the destination is a
        router connected to the calculating router via a virtual
        link, the setting of the next hop should be deferred until
        the calculation in Section 16.3.

        In the second case, the parent vertex is a network that
        directly connects the calculating router to the destination
        router.  The list of next hops is then determined by
        examining the destination's router-LSA.  For each link in
        the router-LSA that points back to the parent network, the
        link's Link Data field provides the IP address of a next hop
        router.  The outgoing interface to use can then be derived
        from the next hop IP address (or it can be inherited from
        the parent network).


16.2.  Calculating the inter-area routes

    The inter-area routes are calculated by examining summary-LSAs.
    If the router has active attachments to multiple areas, only
    backbone summary-LSAs are examined.  Routers attached to a
    single area examine that area's summary-LSAs.  In either case,
    the summary-LSAs examined below are all part of a single area's
    link state database (call it Area A).