tools/testing/selftests/net/bareudp.sh

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

File Facts

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

# Test various bareudp tunnel configurations.
#
# The bareudp module allows to tunnel network protocols like IP or MPLS over
# UDP, without adding any intermediate header. This scripts tests several
# configurations of bareudp (using IPv4 or IPv6 as underlay and transporting
# IPv4, IPv6 or MPLS packets on the overlay).
#
# Network topology:
#
#   * A chain of 4 network namespaces, connected with veth pairs. Each veth
#     is assigned an IPv4 and an IPv6 address. A host-route allows a veth to
#     join its peer.
#
#   * NS0 and NS3 are at the extremities of the chain. They have additional
#     IPv4 and IPv6 addresses on their loopback device. Routes are added in NS0
#     and NS3, so that they can communicate using these overlay IP addresses.
#     For IPv4 and IPv6 reachability tests, the route simply sets the peer's
#     veth address as gateway. For MPLS reachability tests, an MPLS header is
#     also pushed before the IP header.
#
#   * NS1 and NS2 are the intermediate namespaces. They use a bareudp device to
#     encapsulate the traffic into UDP.
#
# +-----------------------------------------------------------------------+
# |                                  NS0                                  |
# |                                                                       |
# |   lo:                                                                 |
# |      * IPv4 address: 192.0.2.100/32                                   |
# |      * IPv6 address: 2001:db8::100/128                                |
# |      * IPv6 address: 2001:db8::200/128                                |
# |      * IPv4 route: 192.0.2.103/32 reachable via 192.0.2.11            |
# |      * IPv6 route: 2001:db8::103/128 reachable via 2001:db8::11       |
# |      * IPv6 route: 2001:db8::203/128 reachable via 2001:db8::11       |
# |                    (encapsulated with MPLS label 203)                 |
# |                                                                       |
# |   veth01:                                                             |
# |   ^  * IPv4 address: 192.0.2.10, peer 192.0.2.11/32                   |
# |   |  * IPv6 address: 2001:db8::10, peer 2001:db8::11/128              |
# |   |                                                                   |
# +---+-------------------------------------------------------------------+
#     |
#     | Traffic type: IP or MPLS (depending on test)
#     |
# +---+-------------------------------------------------------------------+
# |   |                              NS1                                  |
# |   |                                                                   |
# |   v                                                                   |
# |   veth10:                                                             |
# |      * IPv4 address: 192.0.2.11, peer 192.0.2.10/32                   |
# |      * IPv6 address: 2001:db8::11, peer 2001:db8::10/128              |
# |                                                                       |
# |   bareudp_ns1:                                                        |
# |      * Encapsulate IP or MPLS packets received on veth10 into UDP     |
# |        and send the resulting packets through veth12.                 |
# |      * Decapsulate bareudp packets (either IP or MPLS, over UDP)      |
# |        received on veth12 and send the inner packets through veth10.  |
# |                                                                       |
# |   veth12:                                                             |
# |   ^  * IPv4 address: 192.0.2.21, peer 192.0.2.22/32                   |
# |   |  * IPv6 address: 2001:db8::21, peer 2001:db8::22/128              |
# |   |                                                                   |
# +---+-------------------------------------------------------------------+
#     |
#     | Traffic type: IP or MPLS (depending on test), over UDP
#     |
# +---+-------------------------------------------------------------------+
# |   |                              NS2                                  |

Annotation

Implementation Notes