NetworkSherpa

OSPF – LSInfinity != LSInfinity

LSInfinity has two different values

I have mentioned ‘LSInfinity’ in the max-metric post and in an earlier post on withdrawing OSPF routes.   However if you look closely at each post you’ll see that LSinfinity had a different value in each of those posts .   What gives?  It turns out that the term LSinfinity has been overloaded somewhat in the RFCs and has different values and meanings for different LSAs.

LSInfinity for summary and AS-External LSA

RFC 2328 is the most recent RFC addressing the core functionality of OSPF.  It gives a definition of LSInfinity as follows: 

LSInfinity
  The metric value indicating that the destination described
  by an LSA is unreachable.  Used in summary-LSAs and
  AS-external-LSAs as an alternative to premature aging
  (see Section 14.1). It is defined to be the 24-bit binary
  value of all ones: 0xffffff.

(source: RFC 2328 Page 271)
Okay that’s cool, OSPF 2328 describes the value of LSInfinity for Summary and External LSAs as a 24-bit binary value of all ones.  RFC 2328 also says clearly that LSinfinity means ‘unreachable’.
However RFC 2328 doesn’t mention LSInfinity for Router LSAs at all.  That definition doesn’t come until the ‘Stub Router’ RFC 3137.

LSInfinity for the Router LSA

RFC 3137 indirectly defines LSInfinity:

To address both problems, router X announces its router-LSA to the
neighbors as follows.
  costs of all non-stub links (links of the types other than 3)
  are set to LSInfinity (16-bit value 0xFFFF, rather than 24-bit
  value 0xFFFFFF used in summary and AS-external LSAs).

RFC 3137 says that LSInfinity for a router LSA is a 16-bit value of all-ones, and differentiates from the 24-bit LSInfinity values used for summaries and externals as defined in RFC2328.

LSInfinity has two different meanings

Okay, so now we know that LSInfinity has two different values;

However the key point here is that LSInfinity has two different meanings.  For summaries and externals LSInfinity means ‘unreachable’.    We’ve already seen an example of LSInfinite Type-3’s being used to mark a prefix as unreachable. The same behavior holds for a Type-5 LSA.
For router LSAs LSInfinity means ‘least desirable’.   As we saw in the final example of the ‘how max-metric works‘ post, it’s possible to have a valid route via an LSInfinite costed transit link.

Packet Header Limitations

If you’re wondering where these maximum values come from the answer lies in the LSA headers. I recently discovered that the Type-1 LSA header had only 16-bits for metric, whereas the Type-3 and Type-5 headers have a 24-bit field.  Have a look at the ‘metric’ value in the LSA headers below.
Type-1 LSA 16-bit metric

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            LS age             |     Options   |       1       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Link State ID                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Advertising Router                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     LS sequence number                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         LS checksum           |             length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    0    |V|E|B|        0      |            # links            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          Link ID                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         Link Data                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     # TOS     |            metric             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type 3 LSA – 24-bit metric

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| LS age                        |    Options    |    3 or 4     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Link State ID                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Advertising Router                     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        LS sequence number                     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         LS checksum           |            length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          Network Mask                         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         0     |                   metric                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        TOS    |                 TOS metric                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ...

Wrap up

I hope this post helps clarify the meaning of LSInfinity and the different contexts in which it is used. Let me know in the comments if I’ve missed something or if you’ve got a perspective on this topic. I’d love to hear from you.