selftests: net: add tests for PPP
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,2 @@ +noauth +noipdefault
tools/testing/selftests/net/ppp/pppoe.sh new file +40 -0
@@ -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
Quoted 1 line · Qingfang Deng
Add ping and iperf3 tests for
ppp_async.candpppoe.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 1 line
Signed-off-by Qingfang Deng <[email protected]>
Sebastian
Hi Sebastian,
Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 1 line · Qingfang Deng
Add ping and iperf3 tests for
ppp_async.candpppoe.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
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.candpppoe.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
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
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.candpppoe.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
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.candpppoe.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
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.candpppoe.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