<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="3"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e., [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="info" docName="draft-huang-savnet-sav-table-01"
     ipr="trust200902">
  <front>
    <title abbrev="SAV Table">Source Address Validation Table Abstraction and Application</title>

    <author fullname="Mingqing Huang" initials="M." surname="Huang">
      <organization>Huawei</organization>
      <address>
        <postal>
          <street/>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>huangmingqing@huawei.com</email>
        <uri/>
      </address>
    </author>
    <author fullname="Weiqiang Cheng" initials="W." surname="Cheng">
      <organization>China Mobile</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>chengweiqiang@chinamobile.com</email>
      </address>
    </author>
    <author fullname="Dan Li" initials="D." surname="Li">
      <organization>Tsinghua University</organization>
      <address>
        <postal>
          <street/>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>tolidan@tsinghua.edu.cn</email>
      </address>
    </author>
    <author fullname="Nan Geng" initials="N." surname="Geng">
      <organization>Huawei</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>gengnan@huawei.com</email>
      </address>
    </author>
    <author fullname="Mingxing Liu" initials="M." surname="Liu">
      <organization>Huawei</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>liumingxing7@huawei.com</email>
      </address>
    </author>
    <author fullname="Li Chen" initials="L." surname="Chen">
      <organization>Zhongguancun Laboratory</organization>
      <address>
        <postal>
          <street/>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>lichen@zgclab.edu.cn</email>
      </address>
    </author>

    <date day="6" month="March" year="2023"/>

    <!---->

    <keyword/>

    <abstract>
      <t>Source address validation (SAV) table consists of SAV rules that are manually configured or automatically generated. The table will take effect in data plane for checking the validity of source addresses. SAV mechanisms may enable SAV tables in data plane using different methods (e.g., ACL or FIB), and these tables are suitable for different application scenarios. This document aims to provide a systematic view of existing SAV tables, which makes it convenient for engineers or operators to improve existing SAV mechanisms or properly apply SAV on routers. The document first examines existing forms of SAV tables and provides a unified abstraction. Then, three validation modes are concluded as well as suggestions for application scenarios. Finally, diversified actions for each validity state are introduced for compliance of different operation requirements. </t>
    </abstract>

    <note title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref
      target="RFC8174">RFC 8174</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>There have been many source address validation (SAV) mechanisms including ACL-based filtering <xref target="RFC3704"/>, uRPF-like mechanisms <xref
      target="RFC8704"/>, etc. They aim to manually or automatically generate SAV tables on routers for filtering unwanted source addresses. The SAV tables may be implemented in different ways in data plane and are suitable for different application scenarios. For engineers or operators, it is important to learn how a typical SAV table looks and how to properly use one. </t>

      <t>However, there is no systematic description of existing SAV tables. Existing SAV mechanisms have their own core data structures which are coupled with the corresponding underlying implementation. It is not easy to perform analysis across different SAV mechanisms. Besides, the accuracy of SAV tables varies under different application conditions. With no unified data structure of SAV table, we cannot easily express or agree on important questions such as which kind of SAV tables can be generated and enabled in the data plane. Thirdly, SAV mechanisms usually take either "permit" action or "block" action on the validated packets. It is sometimes not flexible enough for diversified operation requirements in practice. </t>

      <t>This document provides a general table abstraction. Any SAV tables of existing mechanisms can be expressed by this abstraction. Then, three validation modes are introduced together with the corresponding generation and application scenarios. Finally, diversified actions are available for each validity state. The actions can be chosen according to specific operation requirements. </t>

      <t>This document can help clarify the design goals of SAV mechanisms. It also provides guidance to operators on the choice of SAV table modes and SAV mechanisms. Note that, how to generate these SAV tables is not the focus of this document. </t>
    </section>

    <!---->

    <section title="Terminology">
      <t/>

      <t>SAV rule: The entry indicating an action for the packets matching a specific source address prefix and an incoming interface. </t>

      <t>SAV table: The data structure that stores SAV rules for the validation of source address validity. </t>

      <t>Improper block: The unwanted SAV result that the packets with legitimate source addresses are considered invalid. </t>

      <t>Improper permit: The unwanted SAV result that the packets with spoofed source addresses are considered valid. </t>

    </section>

    <!---->
    <section title="SAV Table Abstraction">

      <t>For any SAV tables, the basic idea of SAV is to check whether a source prefix arrives from a valid interface. So, there are two dimensions in a logic SAV table, i.e., source prefix and interface. For the packet whose source address and incoming interface are matched in the table, a validity state will be returned, which indicates whether the packet is valid or not. If the state is "valid", the packet is considered legitimate. If the state is "invalid", the packet is considered as carrying a spoofed source address. If the state is "unknown", the validity of the packet cannot be determined directly. </t>

      <t><xref target="sav-table-abst"/> shows the abstraction of existing SAV tables. A router will logically maintain only one such table. Each cell indicates the validity state of the corresponding source prefix and interface. For example, suppose a packet with source address P1 arrives at interface Intf1. The validity state for the packet is "state_11" after taking SAV. For the source prefix of "default" in <xref target="sav-table-abst"/>, it means all zero IP address for IPv4 or IPv6, i.e., unrecorded source addresses. The packets with unrecorded source addresses will match the default source prefix. By default, the validity states of unrecorded source addresses for different interfaces (i.e., state_*1, state_*2, state_*3, ...) are all unknown. How to treat the packets with the unrecorded source addresses depends on the configured validation modes, which will described in <xref target="sec-SAV-mode"/>. </t>

      <figure align="center" anchor="sav-table-abst">
        <name>SAV table abstraction</name>
        <artwork name="SAV table abstraction" align="center"><![CDATA[
  +-------------------------------------------------+
  +          |  Intf 1  |  Intf 2  |  Intf 3  | ... +
  +-------------------------------------------------+
  +  Prefix1 | state_11 | state_12 | state_13 | ... +
  +  Prefix2 | state_21 | state_22 | state_23 | ... +
  +  Prefix3 | state_31 | state_32 | state_33 | ... +
  +  ...     |   ...    |   ...    |   ...    | ... +
  +  Prefixn | state_n1 | state_n2 | state_n3 | ... +
  +  default | state_*1 | state_*2 | state_*3 | ... +
  +-------------------------------------------------+
  *state: valid, invalid, or unknown
  *default: all zero IP address for IPv4 or IPv6
        ]]></artwork>
      </figure>
      
      <t>The goal of existing SAV mechanisms is to fill such a table. The more accurate and complete the table is, the less improper block and improper permit will happen. </t>

    </section>

    <section title="Validation Procedure">
      <t/>
      <t>SAV can be enabled on specified interfaces or all interfaces (i.e., the whole router). Only the packets arriving at the enabled interfaces will be validated. </t>
      
      <t>The procedure of validating an incoming packet is shown in <xref target="SAV-procedure"/>. There are largely two steps in the procedure. In the first step, the router takes the source address and incoming interface of the packet as the input and looks up the SAV table to get the validity state (i.e., valid, invalid, or unknown). In the second step, one or more actions will be picked and conducted for the packet according to the validity state. </t>

      <t><xref target="sec-SAV-mode"/> will present some validations modes carried out during the process of looking up SAV table. The available actions for the validated packet are introduced in <xref target="sec-SAV-action"/>. </t>

      <figure align="center" anchor="SAV-procedure">
        <name>The procedure of validating an incoming packet</name>
        <artwork name="The procedure of validating an incoming packet" align="center"><![CDATA[
                                validity
  packet          +-----------+ state   +---------+
(src addr.,  ---->| look up   |-------->| conduct |
incoming intf.)   | SAV table |         | actions |
                  +-----------+         +---------+
        ]]></artwork>
      </figure>
    
    </section>

    <section title="Validation Modes" anchor="sec-SAV-mode">
      <t>This section describes three validation modes based on which the router looks up the SAV table. Briefly, the modes take effect in different scales and treat unknown results differently. By choosing modes in different scenarios appropriately, the network can get well protection without impacting the forwarding of normal packets. </t>

      <section title="Mode 1: Interface-based prefix allowlist">
        <t>Mode 1 is an interface-scale mode, i.e., it takes effect on a configured interface. When a packet arrives at the interface configured with Mode 1, the SAV table will be looked up to get the validity state of the packet. Particularly, only when the source address/prefix is recorded as valid for the interface in the SAV table, the valid state will be output. If the source address/prefix is not recorded and the validity state is unknown, the packet will be treated same as those with invalid state. Therefore, the interface enabling Mode 1 is equivalently maintaining an interface-based prefix allowlist. Only the source prefixes recorded in the list will be considered valid, otherwise invalid. </t>

        <t>Applying Mode 1 on an interface requires the complete knowledge of legitimate prefixes connected to the interface. If not all legitimate prefixes are included in the allowlist, packets with legitimate source addresses arriving at the interface may be improperly blocked. In many cases, it is difficult for an interface getting all the source prefixes such that Mode 1 can be taken. For example, the interface with a default route or the interface connecting to the Internet through a provider AS can hardly promise to know all the legitimate source prefixes. Mode 1 is suitable to the interfaces connecting to a subnet, a stub AS, or a customer cone. Such a mode can efficiently prevent the connected network from spoofing source prefixes of other networks. </t>

        <t>Particularly, Mode 1 can become a device-scale mode, so that all the interfaces have the same prefix allowlist. </t>
      </section>

      <section title="Mode 2: Interface-based prefix blocklist">
        <t>Mode 2 is also an interface-scale mode, i.e., it takes effect on a configured interface. When a packet arrives at the interface configured with Mode 2, the SAV table will be looked up to get the validity state of the packet. Particularly, only when the source address/prefix is recorded as invalid for the interface in the SAV table, the invalid state will be output. If the source address/prefix is not recorded and the validity state is unknown, the packet will be treated same as those with valid state. Therefore, the interface enabling Mode 2 is equivalently maintaining an interface-based prefix blocklist. Only the source prefixes recorded in the list will be considered invalid, otherwise valid. </t>

        <t>The interface enabling Mode 2 will accept any packets whose source addresses are not included in the blocklist of the interface. This mode does not require the complete blocklist. If the packets with the particular source addresses need to be discarded, Mode 2 can be taken. </t>

        <t>Mode 2 is suitable for proactive filtering and reactive filtering.  Usually the source prefixes that are sure to be invalid will be put into the blocklist, which is proactive filtering. Reactive filtering rules are usually installed in DDoS elimination for dropping specific packets. </t>

        <t>Mode 2 is complementary to Mode 1 with respect to the whole IP address space. For an interface, if the list of all the valid prefixes are known (Mode 1), all the other prefixes in the whole IP space will be invalid (Mode 2). </t>

        <t>Particularly, Mode 2 can become a device-scale mode when all the interfaces have the same prefix blocklist. </t>
      </section>

      <section title="Mode 3: Prefix-based interface allowlist">
        <t>Mode 3 is a router-scale mode, i.e., it takes effect on the whole router. When a packet arrives at the interface configured with Mode 3, the SAV table will be looked up to get the validity state of the packet. Particularly, only when the source address/prefix is recorded as invalid for the interface in the SAV table, the invalid state will be output. If the source address/prefix is not recorded and the validity state is unknown, the packet will be treated same as those with valid state. Therefore, the router enabling Mode 3 is equivalently maintaining a prefix-based interface allowlist for each recorded prefix. </t>

        <t>Under Mode 3, the router will check whether the packets with recorded source addresses arrive at expected interfaces. If the incoming interface of a packet is included in the legitimate interfaces of the matched source prefix, the validation result is valid. Otherwise, the result is invalid. For the packets with default source prefixes, the result is always valid. </t>

        <t>Mode 3 focuses on checking whether the learned source prefixes arrive at the expected interfaces. For default source prefixes, it may permit them. When Mode 1 cannot be enabled, Mode 3 can still provide some extent of protection. </t>

        <t>Note that, Mode 1 and Mode 2 are configured on an interface, while Mode 3 is for the whole router. Thus, there can be multiple modes configured on the same router. For interfaces configured with Mode 1 or Mode 2, Mode 3 will not be conducted for the packets arrving at the interface. <xref target="modes"/> shows a comparison of different validation modes. </t>

        <figure align="center" anchor="modes">
          <name>A comparison of different validation modes</name>
          <artwork name="A comparison of different validation modes" align="center"><![CDATA[
  +-----------------------------------------------------+
  + Mode | Scale     | Treatment of unrecorded prefixes +
  +-----------------------------------------------------+
  + 1    | interface | invalid                          +
  + 2    | interface | valid                            +
  + 3    | router    | valid                            +
  +-----------------------------------------------------+
          ]]></artwork>
      </figure>
      </section>
    </section>

    <section title="Available Actions" anchor="sec-SAV-action">
      <t>After doing validation, the router will update the local validation statistics and then will take actions based on the validity state of each packet. The available actions include "permit", "block", "rate limit", "traffic redirect" and "sample", etc. </t>
      <list style="symbols">
        <t>"Permit": Forward packets normally. </t>

        <t>"Block": Drop packets directly. </t>

        <t>"Rate limit": Enforce an upper bound of traffic rate for mitigation of source address spoofing attacks. Unlike "block" which drops packets directly, "rate limit" takes a safer approach. </t>

        <t>"Traffic redirect": Redirect the packets to the specified points in the network for attack elimination. </t>

        <t>"Sample": Capture the specific packets with a configurable sampling rate and reports them to remote servers (e.g., security analysis center). The sampled packets can be used for threat awareness and further analysis. "Sample" can be taken together with any one of the available actions. Note that, existing techniques like NetStream or NetFlow can be used for "Sample". </t>
      </list>

      <figure align="center" anchor="actions">
        <name>Available actions for different validity states</name>
        <artwork name="Available actions for different validity states" align="center"><![CDATA[
+------------------------------------------------------------------+
+ Validity | Available Action                    | Optional Action +
+------------------------------------------------------------------+
+ valid    | permit                              | sample          +
+ invalid  | permit, block, rate limit, redirect | sample          +
+ unknown  | permit, block, rate limit, redirect | sample          +
+------------------------------------------------------------------+
        ]]></artwork>
      </figure>

      <t><xref target="actions"/> shows the available actions for different validity states. Note that, "permit" can also be applied to "Invalid". One possible case is that network operators just want to monitor source address spoofing attacks by sampling instead of blocking them. </t>

      <t>For the state of "unknown", whether to discard packets depends on the strictness of SAV. To avoid improper block problems, it would be better not to drop "unknown" packets directly (i.e., Mode 2, Mode 3, or Mode 4). </t>

      <t>For ease of management, some management techniques should be extended to support the operations of SAV table. For example, YANG model for SAV table can be defined to manage SAV rules and collect validation statistics. </t>
    </section>

    <section title="Use Cases of SAV Table">
      <t>The SAV table described in the document supports flexible validation modes and actions. This section provides some possible use cases of the SAV table. </t>

      <list style="symbols">
        <t>Attack elimination or access control: The SAV table can be filled through routing information. If the packets with some source addresses arrives from unwanted directions, the packets are probably with spoofed/unauthorized addresses and should be dropped. Besides, some special SAV rules can also be installed in the SAV table so that the packets with specified source addresses will be blocked. </t>

        <t>Attack awareness: Conducting SAV based on the SAV table does not always mean packet filtering. The validation can also be used for attack awareness. Through SAV, the possibly malicious packets can be detected and can be reported to remote servers for visualization or further security analysis after sampling. </t>

        <t>Attack source tracing: The SAV table stores the valid incoming interfaces of source addresses. Therefore, it can help recover the real forwarding path of source address spoofed attacks. Attack source tracing helps achieve near source filtering and vulnerability discovering. </t>
      </list>
    </section>

    <section title="Security Considerations">
      <t>This document focuses on the organization of the core data structure of SAV and device-local SAV operation. The generation of SAV table is not discussed. There may be some security considerations for SAV generation, but it is not in the scope of this document. </t>

      <t>The "Sample" action pushes data to remote servers. This function can be achieved by existing techniques like NetStream or NetFlow. The "Sample" action may induce same security considerations as these techniques, and the corresponding documents have discussed them. </t>
    </section>

    <section title="IANA Considerations">
      <t>This document includes no request to IANA. </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.8174'?>

      <?rfc include='reference.RFC.3704'?>

      <?rfc include='reference.RFC.8704'?>
    </references>
  </back>
</rfc>
