From aed791efaedb1318b2cf6fef146403d811ed21f8 Mon Sep 17 00:00:00 2001 From: Robert McMahon Date: Fri, 13 Feb 2026 14:05:34 -0800 Subject: [PATCH] Suppress stderr to allow tshark to continue despite field errors Redirect stderr to /dev/null to suppress 'Some fields aren't valid' errors when tshark encounters frames without RA/TA fields. This should allow tshark to continue capturing instead of exiting early. Co-authored-by: Cursor --- test_monitor_tshark.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test_monitor_tshark.sh b/test_monitor_tshark.sh index ad4dd52..c30d19f 100755 --- a/test_monitor_tshark.sh +++ b/test_monitor_tshark.sh @@ -137,11 +137,9 @@ echo "Capturing packets for $DURATION seconds..." # We'll capture both stdout and stderr, but continue even if tshark exits with an error set +e # Temporarily disable exit on error # Use -q to suppress packet count output -# Use display filter to only capture frames that have RA/TA fields -# This prevents tshark from erroring when it encounters frames without these fields -CAPTURE_OUTPUT=$(timeout "$DURATION" tshark -q -i "$INTERFACE" -n \ - -Y "(wlan.ra) || (wlan.ta)" \ - -T fields \ +# Redirect stderr to /dev/null to suppress "Some fields aren't valid" errors +# This allows tshark to continue even when encountering frames without RA/TA +CAPTURE_OUTPUT=$(timeout "$DURATION" tshark -q -i "$INTERFACE" -n -T fields \ -e frame.number \ -e frame.time \ -e wlan.ra \ @@ -150,7 +148,7 @@ CAPTURE_OUTPUT=$(timeout "$DURATION" tshark -q -i "$INTERFACE" -n \ -e wlan.fc.subtype \ -e wlan.fc.type_subtype \ -e radiotap.present \ - 2>&1) + 2>/dev/null) CAPTURE_EXIT_CODE=$? set -e # Re-enable exit on error