From: Ralf Lici Date: Tue, 24 Mar 2026 14:54:18 +0000 (+0100) Subject: selftests: ovpn: flatten slurped notification JSON before filtering X-Git-Tag: v7.1-rc1~36^2~59^2~3 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=222e7f8d1ca3aaebe7588a79bf64d9820813785c;p=thirdparty%2Fkernel%2Flinux.git selftests: ovpn: flatten slurped notification JSON before filtering Notification comparison uses jq -s, which slurps all inputs into an array. Some inputs can be arrays themselves, and applying the .msg.peer filter directly on those entries triggers jq type errors. Expand any array-valued JSON items returned by jq -s before selecting .msg.peer, so the filter handles both normal notification objects and [] entries without type errors. Fixes: 77de28cd7cf1 ("selftests: ovpn: add notification parsing and matching") Signed-off-by: Ralf Lici Signed-off-by: Antonio Quartulli --- diff --git a/tools/testing/selftests/net/ovpn/common.sh b/tools/testing/selftests/net/ovpn/common.sh index c92415aaddfc..d3b322e84fab 100644 --- a/tools/testing/selftests/net/ovpn/common.sh +++ b/tools/testing/selftests/net/ovpn/common.sh @@ -15,7 +15,8 @@ SYMMETRIC_ID=${SYMMETRIC_ID:-0} export ID_OFFSET=$(( 9 * (SYMMETRIC_ID == 0) )) -JQ_FILTER='map(select(.msg.peer | has("remote-ipv6") | not)) | +JQ_FILTER='map(if type == "array" then .[] else . end) | + map(select(.msg.peer | has("remote-ipv6") | not)) | map(del(.msg.ifindex)) | sort_by(.msg.peer.id)[]' LAN_IP="11.11.11.11"