Commit Graph

3 Commits

Author SHA1 Message Date
Harald Welte 67881aef23 Avoid generating zero-length packets
I used the construct like f_rnd_octstring(f_rnd_int(100)) in a number
of places to generate random-length packets with randomized length.

The problem I didn't realize is that f_rnd_int() of course can also
return '0', which would generate zero-length packets.  This may be
permitted in some protocols, but it leads to problems e.g. when trying
to send a UDP packet of zero length (which the kernel will not do).

So let's introduce
* f_rnd_int_nonzero() for returning non-zero randomized integers
* f_rnd_octstring_rnd_len() for returning a random-length random payload
  octet string
* replace all f_rnd_octstring(f_rnd_int()) call sites with the new
  function.

Change-Id: I818a113ff8d2a2f7cab2ec7d9c8661607c6331d6
Closes: OS#5528
2022-04-12 22:52:47 +02:00
Harald Welte 1c8d16c570 pcap-client: Don't bind to second 'traffic' udp port
if the tester runs on a different host/IP than the IUT (like in our
dockerized jenkins tests), then of course we cannot assume that
traffic sent by the tester can be received by the tester again.

So rather than binding/connecting two sockets, let's only use one
and send packets without caring if there is a remote receiver.

Change-Id: If826705c78c7a0ad0e633b7a320d7dd5e5561c27
2021-04-25 13:06:35 +02:00
Harald Welte c4ac9e0fe3 Initial test suite for osmo-pcap-client
Change-Id: If4a1072e75cb64f785d660e4c828c0f521d84b16
2021-04-24 12:43:48 +02:00