Commit Graph

18 Commits

Author SHA1 Message Date
Pau Espin 7ae55ea29c Update pcap pkt size to 1520 bytes
I see packets of 1520 bytes in the generated pcap running under the
docker setup. This happens when a lot of IPA concurrent clients send
messages and end up in the same TCP packet due to naggle algorithm.

Change-Id: I362371508ba83acc48376b6ed012a97a59d4b31b
2024-02-28 14:15:19 +01:00
arehbein e66c1f8e5a ttcn3-tcpdump*.sh: Fix tcpdump procs not being killed
Also: Fix possibly empty files not being deleted.

Fixes: cf8c450ed5
Fixes: OS#5796
Change-Id: I4e17d8313755c36f130982c921abf69d78c98ae6
2022-11-28 22:52:52 +01:00
arehbein bc85a324be ttcn3-tcpdump*.sh: Log stderr separately to file
The old output is preserved, too, in order to ensure
compatibility with expectations regarding legacy behavior.

Related: OS#5736

Change-Id: Ia92ff32c8ce09ab7805c5509837ec88fa4b864c5
2022-11-25 23:26:06 +01:00
arehbein cf8c450ed5 ttcn3-tcpdump*.sh: Fix scripts hanging on sudo prompt
Related: OS#5736

Change-Id: I05687f9bc0bb87c6f1d5c42ba235dbb90a49aeb6
2022-11-25 16:22:00 +01:00
arehbein a084fbe605 Fix missing quotes for possibly unresolved variables in shell test-statements
Related: OS#5736

Change-Id: I7e7f4f95d1a7cc886360c733908c63a2843b0906
2022-11-02 17:36:35 +00:00
Eric Wild c01eada147 tcpdump capture script: check permissions to fix running in a netns
This might be all caps (=ep), or a list of all caps.

Change-Id: I75f7af6cc67e96ffb7b002591f7f7d1da9b5a51d
2022-05-24 08:32:52 +00:00
Oliver Smith fbf3345065 ttcn3-tcpdump-start.sh: don't hardcode binary paths
After replacing debian-stretch-titan with debian-bullseye-titan, tcpdump
does not run anymore, the binary is in /usr/bin and not in /usr/sbin.

Related: OS#4969
Change-Id: I18c88c45c7522c1120ca42cd48d67fe8f155cd39
2021-12-16 12:17:45 +00:00
Harald Welte 5b11d91db2 ttcn3-tcpdump-start: Fix path of setcap
if we test if /sbin/setcap exists, we als should execute it from that
path, as running from a normal user doesn't have /sbin included in $PATH

Change-Id: I5131f869f86e6d136e0485da5e3749abbfc951e3
2020-12-11 15:34:42 +01:00
Pau Espin ad931f236b 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
2019-10-04 16:09:27 +00:00
Max 81487c8b36 Use dumpcap for ttcn3-tcpdump-*.sh if available
Check if dumpcap is installed (either as suid or with appropriate
capabilities) and use it for packet capture instead of
'sudo tcpdump' if available. This makes it easier to use TTCN-3
testsuite as regular user without altering sudoers.

Change-Id: I77df04d51a469c924cf727f0596cc33565909746
2019-03-19 10:28:46 +00:00
Max e521445fee Generalize ttcn3-tcpdump-*.sh
Prepare for supporting alternative packet dumpers:
* reword comments
* rename pidfile
* move tcpdump-specific option inside if
* move comment about sudo closer to actual sudo invocation

Those are cosmetic changes which do not affect how packet dump is made
but makes it easier to support alternative packet dumpers in follow-up
commit.

Change-Id: Ib2528db65348c0422fe8b7c7c53656fbce4f6405
2019-03-14 20:46:51 +00:00
Neels Hofmeyr ced8acf305 log time in tcpdump-start and -stop.sh
Also log the testcase name in tcpdump-start.sh.

The output now looks like

    ------ MSC_Tests.TC_mo_cc_bssmap_clear ------
    Thu Mar  7 13:21:00 UTC 2019
    [...]
    Thu Mar  7 13:21:04 UTC 2019
    ====== MSC_Tests.TC_mo_cc_bssmap_clear pass ======

The reason to log start and end dates came up like this: I noticed a segfault
in a tested program at a specific time. From the timestamp I tried to find out
which of the tests saw the failure. (After a segfault, all subsequent tests run
and fail, but it is not obvious which failure occured because of a segfault,
and which ones just normally failed before that.) Looking at the timestamps of
the log files didn't help, because the ttcn3_logmerge touched those after the
tests completed. So the only way is to cat each individual log file and find
the timestamp.

So this adds an overview of the timestamps without needing to open log files.

Change-Id: I0832d9b5df599baad5dec8d3a993481b4286fbb3
2019-03-07 16:33:03 +01:00
Alexander Couzens d1f4095df8 ttcn3-tcpdump-start.sh: reduce snaplen of tcpdump
Improve speed of tcpdump startup. -s 0 sets the snaplen is 256k.
tcpdump will request the snaplen multiplied by the buffer as
a contigous buffer in the kernel. This could lead to higher
start time.

Change-Id: I8a372e71798b366faa3b723573c60de6e8fd128f
2018-05-15 20:54:54 +00:00
Harald Welte d71c343818 ttcn3-tcpdump-start.sh: Don't call tcpdump log files ".log"
The problem is that we use ttcn3_logmerge FOO_Tests.*.log and that the
tcpdump stdout log files also match this pattern.  Call them
.pcap.stdout in order to avoid them falling into the globbing pattern of
the TITAN log files.

Change-Id: Iac1ae217b006182121d86375ffa4d3c00ef37e8b
2018-02-18 14:14:44 +01:00
Pau Espin 8fdd3130fe ttcn3-tcpdump-start.sh: Wait for tcpdump to start recording
We generate some fake transit and we wait until we catch tcpdump already
saved some packet into the pcap file, this way making sure it is already
recording before starting the test.

The -U flag (--packet-buffered) is added to increase the chances to
sleep less time waiting for stuff being saved into the pcap file.
According to tcpdump manual:
"""
If  the  -w option is specified, make the saved raw packet output ``packet-buffered''; i.e., as each packet is saved, it will
              be written to the output file, rather than being written only when the output buffer fills.
"""

Change-Id: I91cfd84ff5356857a13af1901abfe2204a93f76d
2018-02-15 17:22:52 +00:00
Pau Espin b01d313b83 ttcn3-tcpdump-start.sh: Wait for pcap file creation to start test
It was spotted in the jenkins artficats that pcap files for some tests
are missing. It is probably due to the fact that tcpdump is started in
the background and immediately after the test is started. Some tests are
really quick, which means they are executing before tcpdump starts
creating the file and recording.
While still having the file created doesn't mean tcpdump is already
recording, we at least ensure the file is created and we can see it's
empty at the end. Running this patch in my PC indeed shows that usually
the pcap file is not created immediately after and it waits for 1 second
to continue.

The hack to make sure tcpdump is already recording before starting the
test is to create some traffic (ie ping 127.0.0.1) and then check the
following condition: $(tcpdump -r file.pcap | wc -l) -gt 0

Change-Id: I17a456a27c8e33571f333f4b7efdf61161ebb174
2018-02-15 17:22:52 +00:00
Pau Espin ef59855ac7 ttcn3-tcpdump-start.sh: Log tcpdump output to file
This can be useful in case there was an error in tcpdump, or to make
sure no packets were lost while capturing.

Change-Id: I8d7570bba3c21c017ba38d36185f6ae042967599
2018-02-15 17:22:52 +00:00
Harald Welte e057146df7 re-organize configuration files; add tcpdump integration
Let's make sure we share common configuration between the test
suites and split the config file into a "default" part which is
used (but not copied) in the Docker images, and a "local" part
which is basically those overrides that the user (or docker image)
wants to do from the default.

Change-Id: I3db452e24e5238aa05254d903739c64d202e61db
2018-02-14 18:50:16 +01:00