Skip to contentSkip to conversation

selftests: net: add tests for PPP

PATCH Superseded Qingfang Deng 3 participants 8 messages Mar 26 – Mar 27

Subsystems (4)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

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

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

---
v4: double quote $EXIT_STATUS (SC2086)
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 | 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
MAINTAINERS +1 -0
index a09bf30a057d..d553437d5ac1 100644
@@ -21078,6 +21078,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 +44 -0

44 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 +40 -0
new file mode 100755
index 000000000000..d5d9b898d537
@@ -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"
Signature · 1 line
2.43.0
#2 lore raw

Hi Sebastian,

Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 1 line · Qingfang Deng

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/[email protected]/

AFAIK, this can only happen with PPTP or L2TP, which were not included in this patch.

Add Cc: Guillaume Nault

Regards,
Qingfang

#3 lore raw
Quoted 1 line · Qingfang Deng

Hi Sebastian,

Hi Qingfang,

Quoted 10 lines
Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 1 line · Qingfang Deng

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?

Quoted 5 lines

By "invalid loop", do you mean transmit recursion?
https://lore.kernel.org/all/[email protected]/

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…

Quoted 5 lines

Add Cc: Guillaume Nault

Regards,
Qingfang

Sebastian

#4 lore raw
Quoted 6 lines · Sebastian Andrzej Siewior
Quoted 3 lines

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

#5 lore raw
In reply to Qingfang Deng
Quoted 12 lines · Qingfang Deng

Hi Sebastian,

Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 1 line · Qingfang Deng

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?

Quoted 5 lines

By "invalid loop", do you mean transmit recursion?
https://lore.kernel.org/all/[email protected]/

AFAIK, this can only happen with PPTP or L2TP, which were not included in this patch.

The problem was originally reproduced using L2TP, indeed. But I guess that it could also be reproduced with PPPoE by using a UDP tunnel device like VXLAN (like sending a packet through a PPP interface, handled by PPPoE, running on top of a VXLAN device, that routes the UDP encapsulated packet back to the original PPP interface).

Quoted 6 lines

Add Cc: Guillaume Nault

Regards,
Qingfang

#6 lore raw
Quoted 17 lines · Guillaume Nault
Quoted 15 lines · Qingfang Deng

Hi Sebastian,

Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 1 line · Qingfang Deng

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/[email protected]/

Quoted 8 lines
Quoted 2 lines

AFAIK, this can only happen with PPTP or L2TP, which were not included in this patch.

The problem was originally reproduced using L2TP, indeed. But I guess that it could also be reproduced with PPPoE by using a UDP tunnel device like VXLAN (like sending a packet through a PPP interface, handled by PPPoE, running on top of a VXLAN device, that routes the UDP encapsulated packet back to the original PPP interface).

Yeah I've thought of that also. It can technically happen, though there's no practical use. For self tests purpose, I may just add the recursion test into PPTP or L2TP tests.

Regards,
Qingfang

#7 lore raw
Quoted 27 lines · Qingfang Deng
Quoted 17 lines · Guillaume Nault
Quoted 15 lines · Qingfang Deng

Hi Sebastian,

Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 1 line · Qingfang Deng

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/[email protected]/

Quoted 8 lines
Quoted 2 lines

AFAIK, this can only happen with PPTP or L2TP, which were not included in this patch.

The problem was originally reproduced using L2TP, indeed. But I guess that it could also be reproduced with PPPoE by using a UDP tunnel device like VXLAN (like sending a packet through a PPP interface, handled by PPPoE, running on top of a VXLAN device, that routes the UDP encapsulated packet back to the original PPP interface).

Quoted 3 lines

Yeah I've thought of that also. It can technically happen, though there's no practical use. For self tests purpose, I may just add the recursion test into PPTP or L2TP tests.

Yes, no problem.

Quoted 3 lines

Regards,
Qingfang