tools/testing/selftests/net/ppp/pppol2tp.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/ppp/pppol2tp.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/ppp/pppol2tp.sh- Extension
.sh- Size
- 2879 bytes
- Lines
- 111
- 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
source ppp_common.sh
VETH_SERVER="veth-server"
VETH_CLIENT="veth-client"
OUTER_IP_SERVER="172.16.1.1"
OUTER_IP_CLIENT="172.16.1.2"
PPPOL2TP_DIR=$(mktemp -d /tmp/pppol2tp.XXXXXX)
PPPOL2TP_LOG="$PPPOL2TP_DIR/l2tp.log"
# shellcheck disable=SC2329
cleanup() {
cleanup_all_ns
[ -n "$SOCAT_PID" ] && kill_process "$SOCAT_PID"
rm -rf "$PPPOL2TP_DIR"
}
trap cleanup EXIT
require_command xl2tpd
ppp_common_init
modprobe -q l2tp_ppp
# Create the veth pair
ip link add "$VETH_SERVER" type veth peer name "$VETH_CLIENT"
ip link set "$VETH_SERVER" netns "$NS_SERVER"
ip link set "$VETH_CLIENT" netns "$NS_CLIENT"
ip -netns "$NS_SERVER" link set "$VETH_SERVER" up
ip -netns "$NS_CLIENT" link set "$VETH_CLIENT" up
ip -netns "$NS_SERVER" address add dev "$VETH_SERVER" "$OUTER_IP_SERVER" peer "$OUTER_IP_CLIENT"
ip -netns "$NS_CLIENT" address add dev "$VETH_CLIENT" "$OUTER_IP_CLIENT" peer "$OUTER_IP_SERVER"
# Start socat as syslog listener
socat -v -u UNIX-RECV:/dev/log OPEN:/dev/null > "$PPPOL2TP_LOG" 2>&1 &
SOCAT_PID=$!
# Generate configuration files
cat > "$PPPOL2TP_DIR/l2tp-server.conf" <<EOF
[global]
listen-addr = $OUTER_IP_SERVER
access control = no
[lns default]
ip range = $IP_CLIENT
local ip = $IP_SERVER
require authentication = no
require chap = no
require pap = no
ppp debug = yes
pppoptfile = $(pwd)/pppoe-server-options
EOF
cat > "$PPPOL2TP_DIR/l2tp-client.conf" <<EOF
[global]
listen-addr = $OUTER_IP_CLIENT
access control = no
[lac server]
lns = $OUTER_IP_SERVER
require authentication = no
require chap = no
require pap = no
ppp debug = yes
pppoptfile = $(pwd)/pppoe-server-options
EOF
# Start the L2TP Server
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.