Serial Number Arithmetic
RFC 1982

Document Type RFC - Proposed Standard (August 1996; No errata)
Updates RFC 1034, RFC 1035
Authors Randy Bush  , Robert Elz 
Last updated 2013-03-02
Stream IETF
Formats plain text html pdf htmlized bibtex
Stream WG state (None)
Document shepherd No shepherd assigned
IESG IESG state RFC 1982 (Proposed Standard)
Consensus Boilerplate Unknown
Telechat date
Responsible AD (None)
Send notices to (None)
Network Working Group                                             R. Elz
Request for Comments: 1982                       University of Melbourne
Updates: 1034, 1035                                              R. Bush
Category: Standards Track                                    RGnet, Inc.
                                                             August 1996

                        Serial Number Arithmetic

Status of this Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.


   This memo defines serial number arithmetic, as used in the Domain
   Name System.  The DNS has long relied upon serial number arithmetic,
   a concept which has never really been defined, certainly not in an
   IETF document, though which has been widely understood.  This memo
   supplies the missing definition.  It is intended to update RFC1034
   and RFC1035.

1. Introduction

   The serial number field of the SOA resource record is defined in
   RFC1035 as

   SERIAL   The unsigned 32 bit version number of the original copy of
            the zone.  Zone transfers preserve this value.  This value
            wraps and should be compared using sequence space

   RFC1034 uses the same terminology when defining secondary server zone
   consistency procedures.

   Unfortunately the term "sequence space arithmetic" is not defined in
   either RFC1034 or RFC1035, nor do any of their references provide
   further information.

   This phrase seems to have been intending to specify arithmetic as
   used in TCP sequence numbers [RFC793], and defined in [IEN-74].

   Unfortunately, the arithmetic defined in [IEN-74] is not adequate for
   the purposes of the DNS, as no general comparison operator is

Elz & Bush                  Standards Track                     [Page 1]
RFC 1982                Serial Number Arithmetic             August 1996


   To avoid further problems with this simple field, this document
   defines the field and the operations available upon it.  This
   definition is intended merely to clarify the intent of RFC1034 and
   RFC1035, and is believed to generally agree with current
   implementations.  However, older, superseded, implementations are
   known to have treated the serial number as a simple unsigned integer,
   with no attempt to implement any kind of "sequence space arithmetic",
   however that may have been interpreted, and further, ignoring the
   requirement that the value wraps.  Nothing can be done with these
   implementations, beyond extermination.

2. Serial Number Arithmetic

   Serial numbers are formed from non-negative integers from a finite
   subset of the range of all integer values.  The lowest integer in
   every subset used for this purpose is zero, the maximum is always one
   less than a power of two.

   When considered as serial numbers however no value has any particular
   significance, there is no minimum or maximum serial number, every
   value has a successor and predecessor.

   To define a serial number to be used in this way, the size of the
   serial number space must be given.  This value, called "SERIAL_BITS",
   gives the power of two which results in one larger than the largest
   integer corresponding to a serial number value.  This also specifies
   the number of bits required to hold every possible value of a serial
   number of the defined type.  The operations permitted upon serial
   numbers are defined in the following section.

3. Operations upon the serial number

   Only two operations are defined upon serial numbers, addition of a
   positive integer of limited range, and comparison with another serial

3.1. Addition

   Serial numbers may be incremented by the addition of a positive
   integer n, where n is taken from the range of integers
   [0 .. (2^(SERIAL_BITS - 1) - 1)].  For a sequence number s, the
   result of such an addition, s', is defined as

                   s' = (s + n) modulo (2 ^ SERIAL_BITS)

Elz & Bush                  Standards Track                     [Page 2]
RFC 1982                Serial Number Arithmetic             August 1996

   where the addition and modulus operations here act upon values that
   are non-negative values of unbounded size in the usual ways of
   integer arithmetic.

   Addition of a value outside the range
   [0 .. (2^(SERIAL_BITS - 1) - 1)] is undefined.

3.2. Comparison

   Any two serial numbers, s1 and s2, may be compared.  The definition
   of the result of this comparison is as follows.

   For the purposes of this definition, consider two integers, i1 and
   i2, from the unbounded set of non-negative integers, such that i1 and
Show full document text