Skip to content

Commit ae4ef72

Browse files
LGA1150kuba-moo
authored andcommitted
selftests: net: add socat syslog for PPPoL2TP
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> Reviewed-by: Matthieu Baerts <matttbe@kernel.org> Link: https://patch.msgid.link/20260529021146.5739-1-qingfang.deng@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent dae8931 commit ae4ef72

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tools/testing/selftests/net/ppp/pppol2tp.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ OUTER_IP_SERVER="172.16.1.1"
99
OUTER_IP_CLIENT="172.16.1.2"
1010

1111
PPPOL2TP_DIR=$(mktemp -d /tmp/pppol2tp.XXXXXX)
12+
PPPOL2TP_LOG="$PPPOL2TP_DIR/l2tp.log"
1213

1314
# shellcheck disable=SC2329
1415
cleanup() {
1516
cleanup_all_ns
17+
[ -n "$SOCAT_PID" ] && kill_process "$SOCAT_PID"
1618
rm -rf "$PPPOL2TP_DIR"
1719
}
1820

@@ -31,6 +33,10 @@ ip -netns "$NS_CLIENT" link set "$VETH_CLIENT" up
3133
ip -netns "$NS_SERVER" address add dev "$VETH_SERVER" "$OUTER_IP_SERVER" peer "$OUTER_IP_CLIENT"
3234
ip -netns "$NS_CLIENT" address add dev "$VETH_CLIENT" "$OUTER_IP_CLIENT" peer "$OUTER_IP_SERVER"
3335

36+
# Start socat as syslog listener
37+
socat -v -u UNIX-RECV:/dev/log OPEN:/dev/null > "$PPPOL2TP_LOG" 2>&1 &
38+
SOCAT_PID=$!
39+
3440
# Generate configuration files
3541
cat > "$PPPOL2TP_DIR/l2tp-server.conf" <<EOF
3642
[global]
@@ -92,4 +98,13 @@ check_fail $?
9298

9399
log_test "PPPoL2TP Recursion"
94100

101+
# Dump syslog messages if the test failed
102+
if [ "$EXIT_STATUS" -ne 0 ]; then
103+
while read -r _sign _date _time len _from _to
104+
do len=${len##*=}
105+
read -n "$len" -r LINE
106+
echo "$LINE"
107+
done < "$PPPOL2TP_LOG"
108+
fi
109+
95110
exit "$EXIT_STATUS"

0 commit comments

Comments
 (0)