tools/testing/selftests/net/srv6_end_flavors_test.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/srv6_end_flavors_test.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/srv6_end_flavors_test.sh- Extension
.sh- Size
- 24123 bytes
- Lines
- 870
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# author: Andrea Mayer <andrea.mayer@uniroma2.it>
# author: Paolo Lungaroni <paolo.lungaroni@uniroma2.it>
#
# This script is designed to test the support for "flavors" in the SRv6 End
# behavior.
#
# Flavors defined in RFC8986 [1] represent additional operations that can modify
# or extend the existing SRv6 End, End.X and End.T behaviors. For the sake of
# convenience, we report the list of flavors described in [1] hereafter:
# - Penultimate Segment Pop (PSP);
# - Ultimate Segment Pop (USP);
# - Ultimate Segment Decapsulation (USD).
#
# The End, End.X, and End.T behaviors can support these flavors either
# individually or in combinations.
# Currently in this selftest we consider only the PSP flavor for the SRv6 End
# behavior. However, it is possible to extend the script as soon as other
# flavors will be supported in the kernel.
#
# The purpose of the PSP flavor consists in instructing the penultimate node
# listed in the SRv6 policy to remove (i.e. pop) the outermost SRH from the IPv6
# header.
# A PSP enabled SRv6 End behavior instance processes the SRH by:
# - decrementing the Segment Left (SL) value from 1 to 0;
# - copying the last SID from the SID List into the IPv6 Destination Address
# (DA);
# - removing the SRH from the extension headers following the IPv6 header.
#
# Once the SRH is removed, the IPv6 packet is forwarded to the destination using
# the IPv6 DA updated during the PSP operation (i.e. the IPv6 DA corresponding
# to the last SID carried by the removed SRH).
#
# Although the PSP flavor can be set for any SRv6 End behavior instance on any
# SR node, it will be active only on such behaviors bound to a penultimate SID
# for a given SRv6 policy.
# 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/rfc8986
#
# Network topology
# ================
#
# The network topology used in this selftest is depicted hereafter, composed by
# two hosts (hs-1, hs-2) and four routers (rt-1, rt-2, rt-3, rt-4).
# Hosts hs-1 and hs-2 are connected to routers rt-1 and rt-2, respectively,
# allowing them to communicate with each other.
# Traffic exchanged between hs-1 and hs-2 can follow different network paths.
# The network operator, through specific SRv6 Policies can steer traffic to one
# path rather than another. In this selftest this is implemented as follows:
#
# i) The SRv6 H.Insert behavior applies SRv6 Policies on traffic received by
# connected hosts. It pushes the Segment Routing Header (SRH) after the
# IPv6 header. The SRH contains the SID List (i.e. SRv6 Policy) needed for
# steering traffic across the segments/waypoints specified in that list;
#
# ii) The SRv6 End behavior advances the active SID in the SID List carried by
# the SRH;
#
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.