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 <cursoragent@cursor.com>
This commit is contained in:
parent
189444c88f
commit
aed791efae
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue