selftests: net: add tests for PPP
PATCH v3 1/1 selftests: net: add tests for PPP
Add ping and iperf3 tests for ppp_async.c and pppoe.c.
Signed-off-by Qingfang Deng <[email protected]>
---
v3:
- run on virtme-ng and fix dependencies
- delete tmp files at cleanup
- add log_test
https://lore.kernel.org/linux-ppp/[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