mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
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>
This commit is contained in:
parent
dae89316d0
commit
ae4ef7271c
|
|
@ -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]
|
||||
|
|
@ -92,4 +98,13 @@ check_fail $?
|
|||
|
||||
log_test "PPPoL2TP Recursion"
|
||||
|
||||
# Dump syslog messages if the test failed
|
||||
if [ "$EXIT_STATUS" -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
|
||||
|
||||
exit "$EXIT_STATUS"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user