Skip to contentSkip to conversation

selftests: net: add tests for PPP

PATCH Applied Qingfang Deng 3 participants 3 messages Apr 3 – Apr 7

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v8 1/1 selftests: net: add tests for PPP

Add ping and iperf3 tests for ppp_async.c and pppoe.c.

---
v8:
- locate pppoe.so and pass it to pppoe-server
- start socat as a syslog listener and dump the log messages if the test fails
https://lore.kernel.org/netdev/[email protected]/

 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 | 45 +++++++++++++
 .../selftests/net/ppp/pppoe-server-options    |  2 +
 tools/testing/selftests/net/ppp/pppoe.sh      | 65 +++++++++++++++++++
 8 files changed, 181 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
MAINTAINERS +1 -0
index c583c5478ef6..c92bfed47ead 100644
@@ -21089,6 +21089,7 @@ PPP PROTOCOL DRIVERS AND COMPRESSORS
 L:	[email protected]
 S:	Orphan
 F:	drivers/net/ppp/ppp_*
+F:	tools/testing/selftests/net/ppp/
 
 PPS SUPPORT
 M:	Rodolfo Giometti <[email protected]>
tools/testing/selftests/Makefile +1 -0
index 450f13ba4cca..65f84e8a0cf0 100644
@@ -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
tools/testing/selftests/net/ppp/Makefile new file +15 -0
new file mode 100644
index 000000000000..b39b0abadde6
@@ -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
tools/testing/selftests/net/ppp/config new file +9 -0
new file mode 100644
index 000000000000..b45d25c5b970
@@ -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
tools/testing/selftests/net/ppp/ppp_async.sh new file +43 -0

43 lines not on this page · raw message

tools/testing/selftests/net/ppp/ppp_common.sh new file +45 -0

45 lines not on this page · raw message

tools/testing/selftests/net/ppp/pppoe-server-options new file +2 -0
new file mode 100644
index 000000000000..66c8c9d319e9
@@ -0,0 +1,2 @@
+noauth
+noipdefault
tools/testing/selftests/net/ppp/pppoe.sh new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 20 lines · Qingfang Deng
tools/testing/selftests/net/ppp/pppoe.sh new file +14 -0
new file mode 100755
index 000000000000..f67b51df7490
@@ -0,0 +1,65 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+source ppp_common.sh
+
+VETH_SERVER="veth-server"
+VETH_CLIENT="veth-client"
+PPPOE_LOG=$(mktemp /tmp/pppoe.XXXXXX)
+
+# shellcheck disable=SC2329
+cleanup() {
+	cleanup_all_ns
+	[ -n "$SOCAT_PID" ] && kill_process "$SOCAT_PID"
+	rm -f "$PPPOE_LOG"

tools/testing/selftests/net/ppp/pppoe.sh line 24

Quoted 10 lines
tools/testing/selftests/net/ppp/pppoe.sh new file +10 -0
+}
+
+trap cleanup EXIT
+
+require_command pppoe-server
+ppp_common_init
+modprobe -q pppoe
+
+# Try to locate pppoe.so plugin
+PPPOE_PLUGIN=$(find /usr/{lib,lib64,lib32}/pppd/ -name pppoe.so -type f -print -quit)

Minor nit: here stderr could be redirected to /dev/null, since the command will likely emit at least an error message on most systems.

Could be a follow-up or added if/when you will expand the self-tests.

/P

#2 lore raw
In reply to Qingfang Deng
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 10 lines · On Fri, 3 Apr 2026 11:48:47 +0800 you wrote:

Add ping and iperf3 tests for ppp_async.c and pppoe.c.

---
v8:
- locate pppoe.so and pass it to pppoe-server
- start socat as a syslog listener and dump the log messages if the test fails
https://lore.kernel.org/netdev/[email protected]/

[...]

Here is the summary with links:
- [net-next,v8] selftests: net: add tests for PPP
https://git.kernel.org/netdev/net-next/c/dfecb0c5af3b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html