Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Qingfang Deng <qingfang.deng@linux.dev>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
	Shuah Khan <shuah@kernel.org>, Felix Maurer <fmaurer@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Petr Machata <petrm@nvidia.com>,
	linux-kernel@vger.kernel.org, linux-ppp@vger.kernel.org,
	netdev@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next] selftests: net: add tests for PPPoL2TP
Date: Tue, 12 May 2026 10:00:03 +0200	[thread overview]
Message-ID: <05927f32-8df5-4a78-a188-5a4c2b82a85a@redhat.com> (raw)
In-Reply-To: <20260508032158.67887-1-qingfang.deng@linux.dev>

On 5/8/26 5:21 AM, Qingfang Deng wrote:
> diff --git a/tools/testing/selftests/net/ppp/pppol2tp.sh b/tools/testing/selftests/net/ppp/pppol2tp.sh
> new file mode 100755
> index 000000000000..5ddcc6c41c33
> --- /dev/null
> +++ b/tools/testing/selftests/net/ppp/pppol2tp.sh
> @@ -0,0 +1,93 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +source ppp_common.sh
> +
> +NK_SERVER="nk0"
> +NK_CLIENT="nk1"
> +OUTER_IP_SERVER="172.16.1.1"
> +OUTER_IP_CLIENT="172.16.1.2"
> +
> +PPPOL2TP_DIR=$(mktemp -d /tmp/pppol2tp.XXXXXX)

Sashiko (gemini) reports an unhandled error condition here. AFAICS that
is irrelevant as it could happen only on a broken system.

> +
> +# shellcheck disable=SC2329
> +cleanup() {
> +	cleanup_all_ns
> +	rm -rf "$PPPOL2TP_DIR"
> +}
> +
> +trap cleanup EXIT
> +
> +require_command xl2tpd
> +ppp_common_init
> +modprobe -q l2tp_ppp
> +
> +# Create the netkit pair
> +ip -netns "$NS_CLIENT" link add "$NK_CLIENT" type netkit
> +ip -netns "$NS_CLIENT" link set "$NK_SERVER" netns "$NS_SERVER"
> +ip -netns "$NS_SERVER" link set "$NK_SERVER" up
> +ip -netns "$NS_CLIENT" link set "$NK_CLIENT" up
> +ip -netns "$NS_SERVER" address add dev "$NK_SERVER" "$OUTER_IP_SERVER" peer "$OUTER_IP_CLIENT"
> +ip -netns "$NS_CLIENT" address add dev "$NK_CLIENT" "$OUTER_IP_CLIENT" peer "$OUTER_IP_SERVER"
> +
> +# 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
> +ip netns exec "$NS_SERVER" xl2tpd -D -c "$PPPOL2TP_DIR/l2tp-server.conf" \
> +	-p "$PPPOL2TP_DIR/l2tp-server.pid" -C "$PPPOL2TP_DIR/l2tp-server.control" &
> +
> +# Start the L2TP Client
> +ip netns exec "$NS_CLIENT" xl2tpd -D -c "$PPPOL2TP_DIR/l2tp-client.conf" \
> +	-p "$PPPOL2TP_DIR/l2tp-client.pid" -C "$PPPOL2TP_DIR/l2tp-client.control" &
> +
> +# Wait for xl2tpd to start and open their control pipes
> +slowwait 2 [ -p "$PPPOL2TP_DIR/l2tp-server.control" ]
> +slowwait 2 [ -p "$PPPOL2TP_DIR/l2tp-client.control" ]
> +
> +# Connect LAC to LNS
> +echo "c server" > "$PPPOL2TP_DIR/l2tp-client.control"
> +
> +ppp_test_connectivity
> +
> +log_test "PPPoL2TP"
> +
> +# Recursion test
> +# Delete route to LNS IP
> +ip -netns "$NS_CLIENT" route del "$OUTER_IP_SERVER"
> +# Add default route through ppp0
> +ip -netns "$NS_CLIENT" route add default dev ppp0
> +# ping (we expect the ping to fail but not deadlock the system)
> +ip netns exec "$NS_CLIENT" ping -c 1 "$IP_SERVER" -w 1
> +check_fail $?

Sashiko notes you should clear the RET global variable before any direct
or indirect invocation of check_err

/P


      parent reply	other threads:[~2026-05-12  8:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08  3:21 [PATCH net-next] selftests: net: add tests for PPPoL2TP Qingfang Deng
2026-05-08 17:26 ` Felix Maurer
2026-05-09  1:13   ` Qingfang Deng
2026-05-12  8:00 ` Paolo Abeni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=05927f32-8df5-4a78-a188-5a4c2b82a85a@redhat.com \
    --to=pabeni@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fmaurer@redhat.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    --cc=qingfang.deng@linux.dev \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox