* [PATCH net-next v4] selftests: net: add tests for PPP
@ 2026-03-26 2:16 Qingfang Deng
2026-03-26 8:13 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 5+ messages in thread
From: Qingfang Deng @ 2026-03-26 2:16 UTC (permalink / raw)
To: Shuah Khan, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Felix Maurer,
Sebastian Andrzej Siewior, Antonio Quartulli, linux-kernel,
linux-kselftest, linux-ppp, netdev
Cc: Paul Mackerras
Add ping and iperf3 tests for ppp_async.c and pppoe.c.
Signed-off-by: Qingfang Deng <dqfext@gmail.com>
---
v4: double quote $EXIT_STATUS (SC2086)
https://lore.kernel.org/netdev/20260325014411.3596-1-dqfext@gmail.com/
MAINTAINERS | 1 +
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/net/ppp/Makefile | 15 +++++++
tools/testing/selftests/net/ppp/config | 9 ++++
tools/testing/selftests/net/ppp/ppp_async.sh | 43 ++++++++++++++++++
tools/testing/selftests/net/ppp/ppp_common.sh | 44 +++++++++++++++++++
.../selftests/net/ppp/pppoe-server-options | 2 +
tools/testing/selftests/net/ppp/pppoe.sh | 40 +++++++++++++++++
8 files changed, 155 insertions(+)
create mode 100644 tools/testing/selftests/net/ppp/Makefile
create mode 100644 tools/testing/selftests/net/ppp/config
create mode 100755 tools/testing/selftests/net/ppp/ppp_async.sh
create mode 100644 tools/testing/selftests/net/ppp/ppp_common.sh
create mode 100644 tools/testing/selftests/net/ppp/pppoe-server-options
create mode 100755 tools/testing/selftests/net/ppp/pppoe.sh
diff --git a/MAINTAINERS b/MAINTAINERS
index a09bf30a057d..d553437d5ac1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21078,6 +21078,7 @@ PPP PROTOCOL DRIVERS AND COMPRESSORS
L: linux-ppp@vger.kernel.org
S: Orphan
F: drivers/net/ppp/ppp_*
+F: tools/testing/selftests/net/ppp/
PPS SUPPORT
M: Rodolfo Giometti <giometti@enneenne.com>
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 450f13ba4cca..65f84e8a0cf0 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -78,6 +78,7 @@ TARGETS += net/netfilter
TARGETS += net/openvswitch
TARGETS += net/ovpn
TARGETS += net/packetdrill
+TARGETS += net/ppp
TARGETS += net/rds
TARGETS += net/tcp_ao
TARGETS += nolibc
diff --git a/tools/testing/selftests/net/ppp/Makefile b/tools/testing/selftests/net/ppp/Makefile
new file mode 100644
index 000000000000..b39b0abadde6
--- /dev/null
+++ b/tools/testing/selftests/net/ppp/Makefile
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0
+
+top_srcdir = ../../../../..
+
+TEST_PROGS := \
+ ppp_async.sh \
+ pppoe.sh \
+# end of TEST_PROGS
+
+TEST_FILES := \
+ ppp_common.sh \
+ pppoe-server-options \
+# end of TEST_FILES
+
+include ../../lib.mk
diff --git a/tools/testing/selftests/net/ppp/config b/tools/testing/selftests/net/ppp/config
new file mode 100644
index 000000000000..b45d25c5b970
--- /dev/null
+++ b/tools/testing/selftests/net/ppp/config
@@ -0,0 +1,9 @@
+CONFIG_IPV6=y
+CONFIG_PACKET=y
+CONFIG_PPP=m
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_BSDCOMP=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPPOE=m
+CONFIG_PPPOE_HASH_BITS_4=y
+CONFIG_VETH=y
diff --git a/tools/testing/selftests/net/ppp/ppp_async.sh b/tools/testing/selftests/net/ppp/ppp_async.sh
new file mode 100755
index 000000000000..c47a6f5c02dd
--- /dev/null
+++ b/tools/testing/selftests/net/ppp/ppp_async.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+source ppp_common.sh
+
+# Temporary files for PTY symlinks
+TTY_DIR=$(mktemp -d /tmp/ppp.XXXXXX)
+TTY_SERVER="$TTY_DIR"/server
+TTY_CLIENT="$TTY_DIR"/client
+
+cleanup() {
+ cleanup_all_ns
+ [ -n "$SOCAT_PID" ] && kill_process "$SOCAT_PID"
+ rm -fr "$TTY_DIR"
+}
+
+trap cleanup EXIT
+
+require_command socat
+ppp_common_init
+modprobe -q ppp_async
+
+# Create the virtual serial device
+socat -d PTY,link="$TTY_SERVER",rawer PTY,link="$TTY_CLIENT",rawer &
+SOCAT_PID=$!
+
+# Wait for symlinks to be created
+slowwait 5 [ -L "$TTY_SERVER" ]
+
+# Start the PPP Server
+ip netns exec "$NS_SERVER" pppd "$TTY_SERVER" 115200 \
+ "$IP_SERVER":"$IP_CLIENT" \
+ local noauth nodefaultroute debug
+
+# Start the PPP Client
+ip netns exec "$NS_CLIENT" pppd "$TTY_CLIENT" 115200 \
+ local noauth updetach nodefaultroute debug
+
+ppp_test_connectivity
+
+log_test "PPP async"
+
+exit "$EXIT_STATUS"
diff --git a/tools/testing/selftests/net/ppp/ppp_common.sh b/tools/testing/selftests/net/ppp/ppp_common.sh
new file mode 100644
index 000000000000..c72218813f95
--- /dev/null
+++ b/tools/testing/selftests/net/ppp/ppp_common.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# shellcheck disable=SC2153
+
+source ../lib.sh
+
+IP_SERVER="192.168.200.1"
+IP_CLIENT="192.168.200.2"
+
+ppp_common_init() {
+ # Package requirements
+ require_command pppd
+ require_command iperf3
+
+ # Check for root privileges
+ if [ "$(id -u)" -ne 0 ];then
+ echo "SKIP: Need root privileges"
+ exit $ksft_skip
+ fi
+
+ # Namespaces
+ setup_ns NS_SERVER NS_CLIENT
+}
+
+ppp_check_addr() {
+ dev=$1
+ addr=$2
+ ns=$3
+ ip -netns "$ns" -4 addr show dev "$dev" 2>/dev/null | grep -q "$addr"
+ return $?
+}
+
+ppp_test_connectivity() {
+ slowwait 10 ppp_check_addr "ppp0" "$IP_CLIENT" "$NS_CLIENT"
+
+ ip netns exec "$NS_CLIENT" ping -c 3 "$IP_SERVER"
+ check_err $?
+
+ ip netns exec "$NS_SERVER" iperf3 -s -1 -D
+ wait_local_port_listen "$NS_SERVER" 5201 tcp
+
+ ip netns exec "$NS_CLIENT" iperf3 -c "$IP_SERVER" -Z -t 2
+ check_err $?
+}
diff --git a/tools/testing/selftests/net/ppp/pppoe-server-options b/tools/testing/selftests/net/ppp/pppoe-server-options
new file mode 100644
index 000000000000..66c8c9d319e9
--- /dev/null
+++ b/tools/testing/selftests/net/ppp/pppoe-server-options
@@ -0,0 +1,2 @@
+noauth
+noipdefault
diff --git a/tools/testing/selftests/net/ppp/pppoe.sh b/tools/testing/selftests/net/ppp/pppoe.sh
new file mode 100755
index 000000000000..d5d9b898d537
--- /dev/null
+++ b/tools/testing/selftests/net/ppp/pppoe.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+source ppp_common.sh
+
+VETH_SERVER="veth-server"
+VETH_CLIENT="veth-client"
+
+cleanup() {
+ cleanup_all_ns
+}
+
+trap cleanup EXIT
+
+require_command pppoe-server
+ppp_common_init
+modprobe -q pppoe
+
+# 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
+
+# Start the PPP Server
+ip netns exec "$NS_SERVER" pppoe-server -I "$VETH_SERVER" \
+ -L "$IP_SERVER" -R "$IP_CLIENT" -N 1 -q "$(command -v pppd)" \
+ -k -O "$(pwd)/pppoe-server-options"
+
+# Start the PPP Client
+ip netns exec "$NS_CLIENT" pppd \
+ local debug updetach noipdefault noauth nodefaultroute \
+ plugin pppoe.so nic-"$VETH_CLIENT"
+
+ppp_test_connectivity
+
+log_test "PPPoE"
+
+exit "$EXIT_STATUS"
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next v4] selftests: net: add tests for PPP
2026-03-26 2:16 [PATCH net-next v4] selftests: net: add tests for PPP Qingfang Deng
@ 2026-03-26 8:13 ` Sebastian Andrzej Siewior
2026-03-26 8:26 ` Qingfang Deng
0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-03-26 8:13 UTC (permalink / raw)
To: Qingfang Deng
Cc: Shuah Khan, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Felix Maurer, Antonio Quartulli,
linux-kernel, linux-kselftest, linux-ppp, netdev, Paul Mackerras
On 2026-03-26 10:16:24 [+0800], Qingfang Deng wrote:
> Add ping and iperf3 tests for ppp_async.c and pppoe.c.
Oh thank you for doing this.
I haven't look in detail but this cover the "invalid loop" cases that
ppp tries to catch?
> Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Sebastian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4] selftests: net: add tests for PPP
2026-03-26 8:13 ` Sebastian Andrzej Siewior
@ 2026-03-26 8:26 ` Qingfang Deng
2026-03-26 8:30 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 5+ messages in thread
From: Qingfang Deng @ 2026-03-26 8:26 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Shuah Khan, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Felix Maurer, Antonio Quartulli,
linux-kernel, linux-kselftest, linux-ppp, netdev, Paul Mackerras,
Guillaume Nault
Hi Sebastian,
On Thu, Mar 26, 2026 at 4:13 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> On 2026-03-26 10:16:24 [+0800], Qingfang Deng wrote:
> > Add ping and iperf3 tests for ppp_async.c and pppoe.c.
>
> Oh thank you for doing this.
> I haven't look in detail but this cover the "invalid loop" cases that
> ppp tries to catch?
By "invalid loop", do you mean transmit recursion?
https://lore.kernel.org/all/20250715150806.700536-2-bigeasy@linutronix.de/
AFAIK, this can only happen with PPTP or L2TP, which were not included
in this patch.
Add Cc: Guillaume Nault
Regards,
Qingfang
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4] selftests: net: add tests for PPP
2026-03-26 8:26 ` Qingfang Deng
@ 2026-03-26 8:30 ` Sebastian Andrzej Siewior
2026-03-26 9:08 ` Qingfang Deng
0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-03-26 8:30 UTC (permalink / raw)
To: Qingfang Deng
Cc: Shuah Khan, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Felix Maurer, Antonio Quartulli,
linux-kernel, linux-kselftest, linux-ppp, netdev, Paul Mackerras,
Guillaume Nault
On 2026-03-26 16:26:23 [+0800], Qingfang Deng wrote:
> Hi Sebastian,
Hi Qingfang,
> On Thu, Mar 26, 2026 at 4:13 PM Sebastian Andrzej Siewior
> <bigeasy@linutronix.de> wrote:
> >
> > On 2026-03-26 10:16:24 [+0800], Qingfang Deng wrote:
> > > Add ping and iperf3 tests for ppp_async.c and pppoe.c.
> >
> > Oh thank you for doing this.
> > I haven't look in detail but this cover the "invalid loop" cases that
> > ppp tries to catch?
>
> By "invalid loop", do you mean transmit recursion?
> https://lore.kernel.org/all/20250715150806.700536-2-bigeasy@linutronix.de/
>
> AFAIK, this can only happen with PPTP or L2TP, which were not included
> in this patch.
Yeah, that one. I was sort of looking into but gave up after a while
digging through code, since I had no idea how to setup that up…
> Add Cc: Guillaume Nault
>
>
> Regards,
> Qingfang
Sebastian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4] selftests: net: add tests for PPP
2026-03-26 8:30 ` Sebastian Andrzej Siewior
@ 2026-03-26 9:08 ` Qingfang Deng
0 siblings, 0 replies; 5+ messages in thread
From: Qingfang Deng @ 2026-03-26 9:08 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Shuah Khan, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Felix Maurer, Antonio Quartulli,
linux-kernel, linux-kselftest, linux-ppp, netdev, Paul Mackerras,
Guillaume Nault
On Thu, Mar 26, 2026 at 4:30 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> > AFAIK, this can only happen with PPTP or L2TP, which were not included
> > in this patch.
>
> Yeah, that one. I was sort of looking into but gave up after a while
> digging through code, since I had no idea how to setup that up…
I used Google's Antigravity to generate the skeleton of the test, and
the rest was some manual tweak and trial and error.
Regards,
Qingfang
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-26 9:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 2:16 [PATCH net-next v4] selftests: net: add tests for PPP Qingfang Deng
2026-03-26 8:13 ` Sebastian Andrzej Siewior
2026-03-26 8:26 ` Qingfang Deng
2026-03-26 8:30 ` Sebastian Andrzej Siewior
2026-03-26 9:08 ` Qingfang Deng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox