<?xml version="1.0" encoding="utf-8"?>
<!-- vim: et:ts=2:sw=2
  -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="exp" docName="draft-equinox-intarea-dhcpv4-route4via6-01" ipr="trust200902" obsoletes="" submissionType="IETF" consensus="true" xml:lang="en" version="3">
  <front>
    <title abbrev="intarea-dhcpv4-route4via6">DHCPv4 Option for IPv4 routes with IPv6 nexthops</title>
    <seriesInfo name="Internet-Draft" value="draft-equinox-intarea-dhcpv4-route4via6-01"/>
    <author fullname="David 'equinox' Lamparter" initials="D" surname="Lamparter">
      <organization>NetDEF, Inc.</organization>
      <address>
        <postal>
          <city>San Jose</city>
          <country>USA</country>
        </postal>
        <email>equinox@diac24.net</email>
        <email>equinox@opensourcerouting.org</email>
      </address>
    </author>
    <author fullname="Tobias Fiebig" initials="T." surname="Fiebig">
      <organization abbrev="MPI-INF">Max-Planck-Institut fuer Informatik</organization>
      <address>
        <postal>
          <street>Campus E14</street>
          <city>Saarbruecken</city>
          <code>66123</code>
          <country>Germany</country>
        </postal>
        <phone>+49 681 9325 3527</phone>
        <email>tfiebig@mpi-inf.mpg.de</email>
      </address>
    </author>
    <date year="2025"/>
    <area>Internet</area>
    <workgroup>Internet Area Working Group</workgroup>
    <keyword>IPv6</keyword>
    <keyword>IPv4</keyword>
    <keyword>nexthop</keyword>
    <keyword>route</keyword>
    <abstract>
      <t>
          As a result of the shortage of IPv4 addresses, installations are
          increasingly recovering IPv4 addresses from uses where they are not
          strictly necessary.  One such situation is in establishing next hops
          for IPv4 routes, replacing this use with IPv6 addresses.  This
          document describes how to provision DHCP-configured hosts with
          their routes in such a situation.
      </t>
      <t>
        <cref>
          This draft lives at <eref target="https://github.com/eqvinox/dhc-route4via6"/>
        </cref>
      </t>
    </abstract>
  </front>
  <middle>
    <section>
      <name>Introduction</name>
      <t>
          IPv4 is currently (and will likely be for some time) in a situation
          where IPv4 addresses are in short supply, but services still need to be
          made available to users that do not yet have IPv6 connectivity.  In
          some cases, even the service side may not have IPv6 support
          yet.  In other cases some aspect of the service precludes using
          proxy-style service delivery with translation technologies on either
          or both sides.  This leads to a need for fine-grained deployment of
          IPv4 connectivity with minimum wastage of addresses.
      </t>
      <t>
          A particularly interesting improvement enabled by the extension
          described here is the complete removal of IPv4 addresses from
          first-hop routers acting as DHCPv4/v6 relays, while still providing IPv4
          connectivity.  In this scenario, the relay (assumed colocated with
          the router) has no IPv4 address to use to communicate with the
          client.  An almost-working solution for this case is presented by
          <xref target="DHCPv6"/> with the <xref target="DHCP4o6"/> transport
          method.  Since this mechanism encapsulates IPv4 DHCP messages, all
          related IPv4 configuration can be carried. However, DHCPv4 does not
          support a way to encode an IPv6 default gateway or other routes,
          which is necessary in this case.
      </t>
      <t>
          If the router and relay are not co-located, the relay may have an
          IPv4 address while the router does not.  In this case, the option
          described in this document could be carried in a plain IPv4 DHCP
          message.
      </t>
      <t>
          Note that the changes described in this document are to DHCPv4, not
          DHCPv6.
      </t>
    </section>
    <section>
      <name>Requirements Language</name>
      <t>
          The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
          "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
          RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
          interpreted as described in BCP 14 <xref target="RFC2119"/>
          <xref target="RFC8174"/> when, and only when, they appear in
          all capitals, as shown here.
      </t>
    </section>

    <section anchor="semantics">
      <name>Extended static route function</name>
      <t>
          This document defines a DHCPv4 option container with 2 suboptions
          for use within it.
          The container can occur multiple times, and the suboptions can
          each occur zero, one, or multiple times in each container.  Each
          container represents one "fully-filled matrix" of destination
          prefixes and next-hops, i.e. to be interpreted as a full cartesian
          combination of the two sets.  In detail, this means:
      </t>
      <ol>
        <li>
            each option container is processed as one unit, building up
            a list of destination prefixes and next-hops.  It is expected that
            the container will in most cases present one destination prefix
            with one or two next-hops.  However, DHCPv4 clients processing the
            option <bcp14>MUST</bcp14> support processing multiple destination prefix
            suboptions.
          <cref>
            <strong>NB/TODO: this implies <xref target="DHCP-LONGOPT"/> is NOT
              applicable here. Not sure if that's a good idea.</strong>
          </cref>
        </li>
        <li>
            when multiple destination prefixes occur in the same container,
            all of the next-hops for that container <bcp14>MUST</bcp14> be processed for all
            of the destination prefixes in that container.
        </li>
        <li>
            if no destination prefix sub-option occurs in a container, the
            IPv4 default route (0.0.0.0/0) is implicitly expressed and the
            container <bcp14>MUST</bcp14> be processed as if the 0.0.0.0/0 destination prefix
            was explicitly encoded.
        </li>
        <li>
            if no next-hop sub-option occurs in a container, the "source of
            DHCP packet" function is encoded as with the unspecified-address
            (::) next-hop described below.  The container <bcp14>MUST</bcp14> be processed
            as if a :: next-hop were explicitly encoded.
        </li>
        <li>
            both sub-options may be absent, the rules in the previous two
            bullet points <bcp14>MUST</bcp14> be applied in combination.  This is in fact
            expected to be a relatively common setup and is intentionally made
            available with a space-preserving encoding.
        </li>
        <li>
            the container can be repeated an arbitrary number of times with
            different suboptions.  Any single destination prefix <bcp14>MUST NOT</bcp14> be
            expressed in more than one container.  If encountering duplicate
            destination prefixes, clients <bcp14>MAY</bcp14> pick one at random, or <bcp14>MAY</bcp14> merge
            nexthops;  but this is considered a network side configuration
            error.  However, note that this refers only to repeating the exact
            same destination prefix and prefix length. A differing prefix
            length presents a distinct destination prefix and <bcp14>MUST</bcp14> be processed
            independently.
        </li>
        <li>
            next-hops <bcp14>MUST NOT</bcp14> repeat within the same container, but the same
            next-hop <bcp14>MAY</bcp14> occur in any number of containers and <bcp14>MUST</bcp14> be
            processed normally in that case.
        </li>
        <li>
            if multiple next-hops are expressed in the same container, this
            represents equal-cost multipath routes across the set of next-hops.
            Clients processing the option <bcp14>MUST</bcp14> install at least one of the
            listed nexthops but <bcp14>MAY</bcp14> choose any subset at their discretion, e.g.
            if their capability of installing ECMP is limited to some number of
            next-hops (or is 1, i.e. no ECMP support.)
        </li>
      </ol>
      <section anchor="nexthops">
        <name>Applicable next-hop behavior</name>
        <t>
            Outlined in <xref target="IANA-IPv6"/>, not all IPv6 addresses are
            valid for use when encoded as next-hop and some have
            <xref target="IANA-IPv6-SPECIAL">specific functionality</xref>
            attached to them as follows:
        </t>
        <ol>
          <li>
              the unspecified-address nexthop (which is also implied by the
              absence of any nexthop suboption) indicates that the routes in
              the container should use the DHCP packet's source address as
              nexthop.   When <xref target="DHCP4o6"/> is in use, hosts <bcp14>MUST</bcp14>
              retrieve the IPv6 source address of the DHCPv6 packet carrying
              the DHCPV4-RESPONSE message.
            <cref>
                TODO: does it really make sense to support IPv4 here?  Maybe
                only allow this with DHCP4o6?
            </cref>
          </li>
          <li>
              the <xref target="DISCARD">Discard-Only Address block
                (0100::/64)</xref> <bcp14>MAY</bcp14> be used to express
              unreachable destinations, in particular if only limited but not
              global IPv4 connectivity is available.  If this is used, it
              <bcp14>MUST</bcp14> be the only next-hop suboption in one container, clients
              <bcp14>SHOULD</bcp14> ignore the entire container if this is not respected.  If
              a client is unable to mark destinations as unreachable in its
              routing table, it <bcp14>MAY</bcp14> ignore the container and <bcp14>SHOULD</bcp14> indicate
              a client configuration issue in its administrative interfaces.
          </li>
          <li>
              any unicast IPv6 address <bcp14>MAY</bcp14> be used as next-hop.  This
              specifically also covers link-local addresses, which the client
              <bcp14>MUST</bcp14> support and <bcp14>MUST</bcp14> associate with the link that it has
              received the DHCP packets on.
          </li>
          <li>
            <cref>
                TODO: is ::ffff:192.0.2.123 an IPv4 nexthop?  Is this worth
                supporting explicitly, and then saying that the other static
                route / default gateway options should be ignored?
            </cref>
          </li>
          <li>
            <t>
                the following types/ranges of addresses are invalid and <bcp14>MUST</bcp14>
                NOT be used;  no client behavior is specified if any are
                present in a container:
            </t>
            <ul>
              <li>the loopback address (::1)
                <cref>
                    TODO: express other directly-connected IPv4 hosts with
                    this?
                </cref>
              </li>
              <li>any multicast address (ff00::/8)</li>
              <li>any address with a reserved allocation</li>
            </ul>
          </li>
        </ol>
      </section>
      <section anchor="destinations">
        <name>Applicable destination prefix behavior</name>
        <t>
            Some IPv4 prefixes, due to their function given in
            <xref target="IANA-IPv4"/>, do not make sense to use with this
            option.  DHCPv4 servers <bcp14>MUST NOT</bcp14> encode and DHCPv4 clients <bcp14>MUST</bcp14>
            ignore the following prefixes as well as any more-specific prefixes
            within them:
        </t>
        <ul>
          <li>
              0.0.0.0/8 (note that 0.0.0.0/0 is less specific than this, and thus valid)
          </li>
          <li>127.0.0.0/8</li>
          <li>224.0.0.0/4</li>
          <li>255.255.255.255/32</li>
        </ul>
        <t>
            Behavior for 240.0.0.0/4 is outside the scope of this document.
        </t>
      </section>
    </section>

    <section anchor="behavior">
      <name>Expected host behavior</name>
      <t>
          The option described in this document is intended to be implemented
          on hosts supporting IPv4 routes with IPv6 nexthops as described
          in <xref target="v4overv6"/>.  Hosts that do not support the behavior
          described there <bcp14>MUST NOT</bcp14> request and <bcp14>MUST</bcp14> ignore the option described
          in this document.
      </t>
      <t>
          Hosts that support <xref target="v4overv6"/> behavior and acquire
          their configuration from <xref target="DHCP"/> <bcp14>SHOULD</bcp14> implement the
          option described here.
      </t>
      <section anchor="singleaddr">
        <name>Singular address assignment</name>
        <t>
            While not limited to this case, this option is expected and
            intended to be used with assigning a singular IPv4 address to a
            DHCPv4 client.  This implies that the Subnet Mask option defined
            in <xref target="DHCP-OPT"/> will have the value 255.255.255.255.
        </t>
        <t>
            DHCPv4 clients implementing the option described in this document
            <bcp14>MUST</bcp14> process such a Subnet Mask option value as assigning a single
            address.  There is no network or broadcast address for this
            "single-sized" pseudo-subnet.  No IPv4 addresses are
            expressed to be on-link for the purposes of <xref target="ARP"/>
            (though they <bcp14>MAY</bcp14> become so due to additional, e.g. local
            configuration assigning additional addresses to the interface.)
        </t>
        <t>
            Whether the address is bound to the interface or host (strong
            vs. weak host model), and whether to perform or skip
            <xref target="DADv4"/> for the address is beyond the scope of this
            document.
        </t>
      </section>
      <section anchor="overlap">
        <name>Overlapping routes from other sources</name>
        <t>
            <xref target="RFC3442"/> documents a mechanism to communicate a
            set of routes and their nexthops over DHCP.  The original DHCP
            "router" option (code 3) may communicate a default router.  If
            either of these options is used, the routes communicated may
            overlap.
        </t>
        <t>
            To get consistent and unsurprising behavior, this document places
            the follwing expectations on the host:
          <cref>
              TODO: redundant paragraph/merge with text above, needs some
              merging/editing.
          </cref>
        </t>
        <ul>
          <li>
              Routes that describe distinct destination prefixes <bcp14>MUST</bcp14> be
              handled independently.  This includes routes that differ only
              in prefix length.  As a result, the routing table <bcp14>MAY</bcp14> contain
              a mix of IPv4 routes with IPv4 nexthops as well as IPv6
              nexthops.  Standard longest prefix match behavior <bcp14>MUST</bcp14> be
              observed.
          </li>
          <li>
              If routes with the same destination prefix are described both
              with previously existing methods as well as the options
              documented here, the route described by the latter <bcp14>MUST</bcp14> be used
              and the routes with IPv4 nexthops <bcp14>MUST</bcp14> be discarded.  This
              notably includes "unreachable" routes described here;  a route
              with an IPv4 nexthop for such a destination <bcp14>MUST</bcp14> still be
              discarded.
          </li>
          <li>
              Multiple routes for the same destination prefix with different
              nexthops of the same address family <bcp14>SHOULD</bcp14> be combined into a
              single route for equal-cost multipath behavior, if the host
              supports this.  If ECMP routes are not supported, the host
              <bcp14>MUST</bcp14> deterministically choose one of the routes.  This <bcp14>MAY</bcp14>
              be done by using the first or last option as seen in DHCP
              packet order, or by choosing the numerically lowest or highest
              nexthop.
          </li>
        </ul>
      </section>
      <section anchor="default">
        <name>Default route</name>
        <t>
            The default route is expressed here as a route for 0.0.0.0/0,
            which is also implied by the absence of any destination prefix
            suboption.
            There is no distinct special encoding for a default gateway, any
            nexthop for 0.0.0.0/0 <bcp14>MUST</bcp14> be treated as if it were a default
            gateway.
        </t>
      </section>
      <section anchor="connected">
        <name>Routes clashing with the connected subnet</name>
        <t>
          <cref>
              (only applicable if NOT assigning a single IPv4 address as /32)
          </cref>
          <cref>
              TODO: determine what behavior is reasonable here.  (The client
              is likely to be given a /32 subnet mask anyway.)
          </cref>
        </t>
      </section>
    </section>

    <section anchor="encoding">
      <name>DHCP Option encoding</name>
      <artwork name="DHCP(v4) extended static route container">
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Type (TBA1)  |     Length    |          Suboptions           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
:                              ...                              :</artwork>
      <dl>
        <dt>Type</dt>
        <dd>TBA1 (field defined in <xref target="DHCP-OPT"/>)</dd>
        <dt>Length</dt>
        <dd>as defined in <xref target="DHCP-OPT"/></dd>
        <dt>Suboptions</dt>
        <dd>zero or more suboptions as defined below</dd>
      </dl>

      <section anchor="destopt">
        <name>Destination prefix</name>
        <artwork name="Destination prefix suboption">
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Type = 1   |     Length    | R | prefixlen |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    IPv4 prefix (0 - 4 octets)                 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</artwork>
        <dl>
          <dt>Type</dt>
          <dd>1</dd>
          <dt>Length</dt>
          <dd>as defined in <xref target="DHCP-OPT"/></dd>
          <dt>R</dt>
          <dd>Reserved bits.  <bcp14>MUST</bcp14> be sent as zero, <bcp14>MUST</bcp14> be ignored on receipt.</dd>
          <dt>prefixlen</dt>
          <dd>IPv4 prefix length, integer value from 0 to 32 (inclusive)</dd>
          <dt>IPv4 prefix</dt>
          <dd>
            <t>
                The route's destination prefix, encoded in as few bytes necessary
                for the given prefixlen value, i.e. calculate length as
                ceil(prefixlen / 8).
              <cref>TODO: maybe just ditch minimum length encoding, make it
                  match other DHCPv4 bits?</cref>
            </t>
            <t>
                Valid values are described in <xref target="destinations"/>.
            </t>
          </dd>
        </dl>
        <t>
            If the Length field indicates additional data past the IPv4 prefix
            value, clients <bcp14>MUST</bcp14> ignore it.  Future documents <bcp14>MAY</bcp14> introduce
            other behavior here and servers <bcp14>MUST NOT</bcp14> send any such data until
            such a point.
        </t>
      </section>
      <section anchor="nhopt">
        <name>Next-hop</name>
        <artwork name="Next-hop suboption">
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Type = 2   |     Length    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                  IPv6 addresses (n*16 octets)                 |
:                              ...                              :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</artwork>
        <dl>
          <dt>Type</dt>
          <dd>2</dd>
          <dt>Length</dt>
          <dd>as defined in <xref target="DHCP-OPT"/>, a multiple of 16.</dd>
          <dt>IPv6 addresses</dt>
          <dd>
            <t>
                One or more IPv6 addresses specifying the nexthop for this
                route.  Refer to <xref target="nexthops"/> for valid values and
                associated behavior.
              <cref>
                  TODO: is this a list, or do we just repeat the suboption?
                  In theory, this could have sub-suboptions, but unlikely to
                  need?
              </cref>
            </t>
          </dd>
        </dl>
      </section>
    </section>
    <section anchor="Security">
      <name>Security Considerations</name>
      <t>
        <em>TBD</em>
      </t>
    </section>
    <section anchor="privacy">
      <name>Privacy Considerations</name>
      <t>
        <em>TBD</em>
      </t>
    </section>
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <t>
          A codepoint from the "BOOTP Vendor Extensions and DHCP Options"
          registry is requested for use with the container option described in
          <xref target="encoding"/>.
          <cref>Editor note: 2 places of TBA1</cref>
      </t>
      <t>
          A registry is requested to be created for the sub-options in the
          option above.
          <cref>TBD: proper wording for this, and fill in values 1 &amp; 2</cref>
      </t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <reference anchor="DHCP">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2131.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DHCP-OPT">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2132.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DHCP-LONGOPT">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3396.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="v4overv6">
          <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.chroboczek-intarea-v4-via-v6" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DISCARD">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6666.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="IANA-IPv4" target="https://www.iana.org/assignments/ipv4-address-space/">
          <front>
            <title>IPv4 Address Space Registry</title>
            <author><organization>IANA</organization></author>
          </front>
        </reference>
        <reference anchor="IANA-IPv6" target="https://www.iana.org/assignments/ipv6-address-space/">
          <front>
            <title>Internet Protocol Version 6 Address Space</title>
            <author><organization>IANA</organization></author>
          </front>
        </reference>
        <reference anchor="IANA-IPv6-SPECIAL" target="https://www.iana.org/assignments/iana-ipv6-special-registry/">
          <front>
            <title>IPv6 Special-Purpose Address Registry</title>
            <author><organization>IANA</organization></author>
          </front>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3442.xml"/>
        <reference anchor="DHCPv6" target="https://www.rfc-editor.org/info/rfc8415">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8415.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DHCP4o6" target="https://www.rfc-editor.org/info/rfc7341">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7341.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="ARP">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.826.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DADv4">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5227.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
      </references>
    </references>
    <section anchor="ack" numbered="false">
      <name>Acknowledgements</name>
      <t>
          The authors would like to acknowledge and thank Tomek Mrugalski for
          very extensive comments, and in particular pointing out the proper
          way to use DHCP options.
      </t>
      <t>
          Comments and feedback has been received and appreciated from
          Ole Troan.
      </t>
    </section>
    <section anchor="examples" numbered="false">
      <name>Example encoded options</name>
      <t>
        <em>TBD: outdated examples removed, will be re-added</em>
      </t>
    </section>
    <section numbered="false">
      <name>Revision history (TO BE REMOVED)</name>
      <ul>
        <li>
            -01: scrap single-option encoding, use container instead, and
            reference special-purpose IPv6 addresses (e.g. for discard)
        </li>
        <li>
            -00: 
        </li>
      </ul>
    </section>
  </back>
</rfc>
