• Andrea Mayer's avatar
    seg6: add PSP flavor support for SRv6 End behavior · bdf3c0b9
    Andrea Mayer authored
    The "flavors" framework defined in RFC8986 [1] represents additional
    operations that can modify or extend a subset of existing behaviors such as
    SRv6 End, End.X and End.T. We report these flavors hereafter:
     - Penultimate Segment Pop (PSP);
     - Ultimate Segment Pop (USP);
     - Ultimate Segment Decapsulation (USD).
    
    Depending on how the Segment Routing Header (SRH) has to be handled, an
    SRv6 End* behavior can support these flavors either individually or in
    combinations.
    In this patch, we only consider the PSP flavor for the SRv6 End behavior.
    
    A PSP enabled SRv6 End behavior is used by the Source/Ingress SR node
    (i.e., the one applying the SRv6 Policy) when it needs to instruct the
    penultimate SR Endpoint node listed in the SID List (carried by the SRH) to
    remove the SRH from the IPv6 header.
    
    Specifically, a PSP enabled SRv6 End behavior processes the SRH by:
       i) decreasing the Segment Left (SL) from 1 to 0;
      ii) copying the Last Segment IDentifier (SID) into the IPv6 Destination
          Address (DA);
     iii) removing (i.e., popping) the outer SRH from the extension headers
          following the IPv6 header.
    
    It is important to note that PSP operation (steps i, ii, iii) takes place
    only at a penultimate SR Segment Endpoint node (i.e., when the SL=1) and
    does not happen at non-penultimate Endpoint nodes. Indeed, when a SID of
    PSP flavor is processed at a non-penultimate SR Segment Endpoint node, the
    PSP operation is not performed because it would not be possible to decrease
    the SL from 1 to 0.
    
                                                     SL=2 SL=1 SL=0
                                                       |    |    |
    For example, given the SRv6 policy (SID List := <  X,   Y,   Z  >):
     - a PSP enabled SRv6 End behavior bound to SID "Y" will apply the PSP
       operation as Segment Left (SL) is 1, corresponding to the Penultimate
       Segment of the SID List;
     - a PSP enabled SRv6 End behavior bound to SID "X" will *NOT* apply the
       PSP operation as the Segment Left is 2. This behavior instance will
       apply the "standard" End packet processing, ignoring the configured PSP
       flavor at all.
    
    [1] - RFC8986: https://datatracker.ietf.org/doc/html/rfc8986Signed-off-by: default avatarAndrea Mayer <andrea.mayer@uniroma2.it>
    Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    bdf3c0b9
seg6_local.c 66 KB