From ccee3a50c3fd14c602eea0d116b50af36fb862d2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 11 Dec 2020 17:19:58 +0100 Subject: [PATCH] ttcn3-dumpcap-start.sh: Accept running as root or setuid dumpcap Change-Id: Id97fb22e0018739a07e46ecaf26463248554f276 --- ttcn3-dumpcap-start.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ttcn3-dumpcap-start.sh b/ttcn3-dumpcap-start.sh index aa3814a9b..4832b6dbc 100755 --- a/ttcn3-dumpcap-start.sh +++ b/ttcn3-dumpcap-start.sh @@ -30,7 +30,14 @@ fi kill_rm_pidfile $PIDFILE_NETCAT kill_rm_pidfile $PIDFILE_PCAP -if [ -x $DUMPCAP ]; then +if [ ! -x $DUMPCAP ]; then + echo "Missing required dumpcap binary at ${DUMPCAP}" + exit 31 +fi + +if [ "$(id -u)" = "0" ]; then + CMD="$DUMPCAP -q" +else CAP_ERR="1" if [ -x /sbin/setcap ]; then # N. B: this check requires libcap2-bin package