Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: net: add socat syslog for PPPoL2TP
@ 2026-05-26  1:41 Qingfang Deng
  2026-05-26  8:10 ` Matthieu Baerts
  0 siblings, 1 reply; 3+ messages in thread
From: Qingfang Deng @ 2026-05-26  1:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Qingfang Deng, linux-ppp, netdev,
	linux-kselftest, linux-kernel
  Cc: Matthieu Baerts

As done in pppoe.sh, start socat as the syslog listener. In case the
test fails, dump its log to see what's going on.

Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
---
 tools/testing/selftests/net/ppp/pppol2tp.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/testing/selftests/net/ppp/pppol2tp.sh b/tools/testing/selftests/net/ppp/pppol2tp.sh
index 5b592785f1f9..96786267ccc7 100755
--- a/tools/testing/selftests/net/ppp/pppol2tp.sh
+++ b/tools/testing/selftests/net/ppp/pppol2tp.sh
@@ -9,10 +9,12 @@ OUTER_IP_SERVER="172.16.1.1"
 OUTER_IP_CLIENT="172.16.1.2"
 
 PPPOL2TP_DIR=$(mktemp -d /tmp/pppol2tp.XXXXXX)
+PPPOL2TP_LOG="$PPPOL2TP_DIR/l2tp.log"
 
 # shellcheck disable=SC2329
 cleanup() {
 	cleanup_all_ns
+	[ -n "$SOCAT_PID" ] && kill_process "$SOCAT_PID"
 	rm -rf "$PPPOL2TP_DIR"
 }
 
@@ -31,6 +33,10 @@ ip -netns "$NS_CLIENT" link set "$VETH_CLIENT" up
 ip -netns "$NS_SERVER" address add dev "$VETH_SERVER" "$OUTER_IP_SERVER" peer "$OUTER_IP_CLIENT"
 ip -netns "$NS_CLIENT" address add dev "$VETH_CLIENT" "$OUTER_IP_CLIENT" peer "$OUTER_IP_SERVER"
 
+# Start socat as syslog listener
+socat -v -u UNIX-RECV:/dev/log OPEN:/dev/null > "$PPPOL2TP_LOG" 2>&1 &
+SOCAT_PID=$!
+
 # Generate configuration files
 cat > "$PPPOL2TP_DIR/l2tp-server.conf" <<EOF
 [global]
@@ -80,6 +86,15 @@ ppp_test_connectivity
 
 log_test "PPPoL2TP"
 
+# Dump syslog messages if the test failed
+if [ "$RET" -ne 0 ]; then
+	while read -r _sign _date _time len _from _to
+	do      len=${len##*=}
+		read -n "$len" -r LINE
+		echo "$LINE"
+	done < "$PPPOL2TP_LOG"
+fi
+
 # Recursion test
 RET=0
 # Delete route to LNS IP
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] selftests: net: add socat syslog for PPPoL2TP
  2026-05-26  1:41 [PATCH net-next] selftests: net: add socat syslog for PPPoL2TP Qingfang Deng
@ 2026-05-26  8:10 ` Matthieu Baerts
  2026-05-26 15:23   ` Qingfang Deng
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Baerts @ 2026-05-26  8:10 UTC (permalink / raw)
  To: Qingfang Deng
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, linux-ppp, netdev, linux-kselftest,
	linux-kernel

Hi Qingfang,

On 26/05/2026 11:41, Qingfang Deng wrote:
> As done in pppoe.sh, start socat as the syslog listener. In case the
> test fails, dump its log to see what's going on.

(...)

> diff --git a/tools/testing/selftests/net/ppp/pppol2tp.sh b/tools/testing/selftests/net/ppp/pppol2tp.sh
> index 5b592785f1f9..96786267ccc7 100755
> --- a/tools/testing/selftests/net/ppp/pppol2tp.sh
> +++ b/tools/testing/selftests/net/ppp/pppol2tp.sh

(...)

> +# Dump syslog messages if the test failed
> +if [ "$RET" -ne 0 ]; then

This only checks for errors with the first test, not with the second one
below. Should you create a new helper and call it here and below? Or
only once at the end, using ${EXIT_STATUS} instead?

> +	while read -r _sign _date _time len _from _to
> +	do      len=${len##*=}
> +		read -n "$len" -r LINE
> +		echo "$LINE"
> +	done < "$PPPOL2TP_LOG"
> +fi
> +
>  # Recursion test
>  RET=0
>  # Delete route to LNS IP

Cheers,
Matt


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] selftests: net: add socat syslog for PPPoL2TP
  2026-05-26  8:10 ` Matthieu Baerts
@ 2026-05-26 15:23   ` Qingfang Deng
  0 siblings, 0 replies; 3+ messages in thread
From: Qingfang Deng @ 2026-05-26 15:23 UTC (permalink / raw)
  To: Matthieu Baerts
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, linux-ppp, netdev, linux-kselftest,
	linux-kernel

On 5/26/2026 4:10 PM, Matthieu Baerts wrote:
> Hi Qingfang,
> 
> On 26/05/2026 11:41, Qingfang Deng wrote:
>> As done in pppoe.sh, start socat as the syslog listener. In case the
>> test fails, dump its log to see what's going on.
> 
> (...)
> 
>> diff --git a/tools/testing/selftests/net/ppp/pppol2tp.sh b/tools/testing/selftests/net/ppp/pppol2tp.sh
>> index 5b592785f1f9..96786267ccc7 100755
>> --- a/tools/testing/selftests/net/ppp/pppol2tp.sh
>> +++ b/tools/testing/selftests/net/ppp/pppol2tp.sh
> 
> (...)
> 
>> +# Dump syslog messages if the test failed
>> +if [ "$RET" -ne 0 ]; then
> 
> This only checks for errors with the first test, not with the second one
> below. Should you create a new helper and call it here and below? Or
> only once at the end, using ${EXIT_STATUS} instead?

I'll move it to the end, thanks.

>> +	while read -r _sign _date _time len _from _to
>> +	do      len=${len##*=}
>> +		read -n "$len" -r LINE
>> +		echo "$LINE"
>> +	done < "$PPPOL2TP_LOG"
>> +fi
>> +
>>   # Recursion test
>>   RET=0
>>   # Delete route to LNS IP
> 
> Cheers,
> Matt
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-26 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26  1:41 [PATCH net-next] selftests: net: add socat syslog for PPPoL2TP Qingfang Deng
2026-05-26  8:10 ` Matthieu Baerts
2026-05-26 15:23   ` Qingfang Deng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox