tools/testing/selftests/net/srv6_iptunnel_cache.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/srv6_iptunnel_cache.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/srv6_iptunnel_cache.sh
Extension
.sh
Size
6617 bytes
Lines
198
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.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# author: Andrea Mayer <andrea.mayer@uniroma2.it>

# This test verifies that the seg6 lwtunnel does not share the dst_cache
# between the input (forwarding) and output (locally generated) paths.
#
# A shared dst_cache allows a forwarded packet to populate the cache and a
# subsequent locally generated packet to silently reuse that entry, bypassing
# its own route lookup. To expose this, the SID is made reachable only for
# forwarded traffic (via an ip rule matching iif) and blackholed for everything
# else. A local ping on ns_router must always hit the blackhole;
# if it succeeds after a forwarded packet has populated the
# cache, the bug is confirmed.
#
# Both forwarded and local packets are pinned to the same CPU with taskset,
# since dst_cache is per-cpu.
#
#
# +--------------------+                        +--------------------+
# |      ns_src        |                        |      ns_dst        |
# |                    |                        |                    |
# |  veth-s0           |                        |           veth-d0  |
# |  fd00::1/64        |                        |        fd01::2/64  |
# +-------+------------+                        +----------+---------+
#         |                                                |
#         |            +--------------------+              |
#         |            |     ns_router      |              |
#         |            |                    |              |
#         +------------+ veth-r0    veth-r1 +--------------+
#                      | fd00::2    fd01::1 |
#                      +--------------------+
#
#
# ns_router: encap (main table)
# +---------+---------------------------------------+
# | dst     | action                                |
# +---------+---------------------------------------+
# | cafe::1 | encap seg6 mode encap segs fc00::100  |
# +---------+---------------------------------------+
#
# ns_router: post-encap SID resolution
# +-------+------------+----------------------------+
# | table | dst        | action                     |
# +-------+------------+----------------------------+
# | 100   | fc00::100  | via fd01::2 dev veth-r1    |
# +-------+------------+----------------------------+
# | main  | fc00::100  | blackhole                  |
# +-------+------------+----------------------------+
#
# ns_router: ip rule
# +------------------+------------------------------+
# | match            | action                       |
# +------------------+------------------------------+
# | iif veth-r0      | lookup 100                   |
# +------------------+------------------------------+
#
# ns_dst: SRv6 decap (main table)
# +--------------+----------------------------------+
# | SID          | action                           |
# +--------------+----------------------------------+
# | fc00::100    | End.DT6 table 255 (local)        |
# +--------------+----------------------------------+

source lib.sh

readonly SID="fc00::100"
readonly DEST="cafe::1"

Annotation

Implementation Notes