summaryrefslogtreecommitdiffstats
path: root/ttcn3-tcpdump-start.sh
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-10-02 13:00:51 +0200
committerpespin <pespin@sysmocom.de>2019-10-04 16:09:27 +0000
commitad931f236b73eec04a4a54a5a9e08b7c2c83a9e9 (patch)
tree43425b4cac0782f3afbbbc084304f43346be0311 /ttcn3-tcpdump-start.sh
parent02f77d88072b55e12e40a436f17e89d094481a11 (diff)
Create dummy gsmtap sink with netcat
otherwise ICMP messages appear in pcap files and some messages are lost since they seem to be dropped by the kernel. Change-Id: Id69d98db63f8260067ad6bc1525fb05c936912f2
Diffstat (limited to 'ttcn3-tcpdump-start.sh')
-rwxr-xr-xttcn3-tcpdump-start.sh27
1 files changed, 21 insertions, 6 deletions
diff --git a/ttcn3-tcpdump-start.sh b/ttcn3-tcpdump-start.sh
index 9bf3c0a..3ad14c0 100755
--- a/ttcn3-tcpdump-start.sh
+++ b/ttcn3-tcpdump-start.sh
@@ -1,10 +1,22 @@
#!/bin/sh
-PIDFILE=/tmp/dumper.pid
+PIDFILE_PCAP=/tmp/pcap.pid
TCPDUMP=/usr/sbin/tcpdump
DUMPCAP=/usr/bin/dumpcap
+
+PIDFILE_NETCAT=/tmp/netcat.pid
+NETCAT=/bin/nc
+GSMTAP_PORT=4729
+
TESTCASE=$1
+kill_rm_pidfile() {
+ if [ -e $1 ]; then
+ kill "$(cat "$1")"
+ rm $1
+ fi
+}
+
echo "------ $TESTCASE ------"
date
@@ -12,10 +24,8 @@ if [ "z$TTCN3_PCAP_PATH" = "z" ]; then
TTCN3_PCAP_PATH=/tmp
fi
-if [ -e $PIDFILE ]; then
- kill "$(cat "$PIDFILE")"
- rm $PIDFILE
-fi
+kill_rm_pidfile $PIDFILE_NETCAT
+kill_rm_pidfile $PIDFILE_PCAP
if [ "$(id -u)" = "0" ]; then
CMD="$TCPDUMP -U"
@@ -39,9 +49,14 @@ if [ -x $DUMPCAP ]; then
fi
fi
+# Create a dummy sink for GSMTAP packets
+$NETCAT -l -u -k -p $GSMTAP_PORT >/dev/null 2>$TESTCASE.netcat.stderr &
+PID=$!
+echo $PID > $PIDFILE_NETCAT
+
$CMD -s 1500 -n -i any -w "$TTCN3_PCAP_PATH/$TESTCASE.pcap" >$TTCN3_PCAP_PATH/$TESTCASE.pcap.stdout 2>&1 &
PID=$!
-echo $PID > $PIDFILE
+echo $PID > $PIDFILE_PCAP
# Wait until packet dumper creates the pcap file and starts recording.
# We generate some traffic until we see packet dumper catches it.