Commit Graph

226 Commits

Author SHA1 Message Date
Harald Welte fb3e20b4b2 SCTP support for osmo_stream_{cli,srv} code
Wih this change, osmo_stream_ client and server API can be used not only
for TCP but also for SCTP.  The latter is needed in SIGTRAN ad Iuh
applications, for example.
2015-12-21 20:54:19 +01:00
Alexander Huemer d4be141ab0 teip is a pointer, not an int 2015-11-07 12:35:53 +01:00
Holger Hans Peter Freyther efb9af4dad misc: Release 0.0.6 without libosmovty dependency 2015-11-03 09:36:45 +01:00
Holger Hans Peter Freyther faf5faeb7a libosmovty: Drop dependency as no VTY code is written here
Do not link to libosmovty as we don't need it.
2015-11-03 09:35:44 +01:00
Holger Hans Peter Freyther 1d4120c7c2 Prepare a new release 2015-08-23 18:01:57 +02:00
Pablo Neira Ayuso e479f25a9b osmux: rename batch->dummy field to batch->ndummy
This is basically a counter that tells us how many circuits need the padding,
so better rename this to ndummy.

Suggested by Holger.
2015-08-19 00:21:43 +02:00
Pablo Neira Ayuso 0d90dd1563 build: bump library release number
I have added two new interfaces to add and to delete circuits from osmux input
handles. The client application needs to be adapted to use them otherwise it
will break. That's why I'm making this library release incompatible with the
previous generation.
2015-07-21 17:10:14 +02:00
Pablo Neira Ayuso 552bae6081 tests: osmux: iterate 64 times in osmo_test_loop()
Instead of 63, this resolves major "definitely lost" remaining leak that
valgrind reports regarding msgb.
2015-07-21 12:04:58 +02:00
Pablo Neira Ayuso f71308001a tests: compile tests with debugging symbols, ie. -g
Useful when debuggin via valgrind/gdb.
2015-07-21 11:05:41 +02:00
Pablo Neira Ayuso 41d5c3081a tests: osmux: fix msgb leaks 2015-07-21 11:05:41 +02:00
Pablo Neira Ayuso e1aefad278 osmux: kill osmux_get_hdr()
Never used, so let's get rid of this function. We can recover it later on in
case we need it.
2015-07-21 11:05:41 +02:00
Pablo Neira Ayuso f9407cc668 tests: osmux: test circuit reopening after closure
Make sure circuit routines works correctly.
2015-07-21 11:05:41 +02:00
Pablo Neira Ayuso b8bdc290d0 tests: osmux: validate dummy padding with no voice data interaction
Make sure that early dummy bandwitch preallocation works fine in the absence of
any kind of voice traffic.
2015-07-21 11:05:40 +02:00
Pablo Neira Ayuso 386e7755a7 tests: osmux: test online deactivation of dummy padding
Add RTP packets to circuit with dummy padding enabled to test automatic
deactivation once when start seeing real voice traffic.
2015-07-21 11:05:34 +02:00
Pablo Neira Ayuso b36951e6e3 tests: osmux: factor out main test loop
Move main test loop routine to the new osmux_test_loop() function.
2015-07-21 11:02:30 +02:00
Pablo Neira Ayuso 635bef7363 tests: osmux: adapt it to use the new circuit API
This also introduces a spare circuit that contains no voice data to test
bandwidth preallocation through the new osmux dummy frame type.
2015-07-21 10:24:23 +02:00
Pablo Neira Ayuso ea549806c9 osmux: introduce osmux_xfrm_input_open_circuit()
This new function allows you to create a circuit on an existing input handle.

We don't create the circuit anymore from the first packet seen, instead the
client application is in full control of opening and closing the circuit.

This change includes a new feature to pad a circuit until we see the first
packet that contains voice data. This is useful to preallocate bandwidth on
satellite links such as Iridium/OpenPort.
2015-07-21 09:59:49 +02:00
Pablo Neira Ayuso b3fc27423a osmux: introduce osmux_xfrm_input_close_circuit()
Add this new function to explicitly remove an existing circuit. Thus, the
client application (openbsc) is in full control to release circuits.

Before this patch, the circuit object was added when the first RTP messages was
seen, and it was removed when transforming the list of pending RTP messages to
the Osmux message (once the timer expired).

Moreover, check circuit->nmsgs to account bytes that are consumed by the osmux
header, given that !circuit doesn't mean "this is the first packet" anymore.
2015-07-21 09:59:49 +02:00
Pablo Neira Ayuso ab898deea3 osmux: count pending messages to be transformed in the batch
Add a new field to count the number of messages in the batch that are pending
to be transformed to osmux. Use this new field to check when to enable the
osmux timer.

The follow up patch keeps circuit objects in the batch until they are closed,
so we won't be able to rely on this to know when to enable the timer anymore.
2015-07-21 09:59:49 +02:00
Pablo Neira Ayuso d886bd0503 osmux: pass up struct osmux_batch
Instead of struct osmux_in_handle. This object contains the internal batching
state information.
2015-07-21 09:59:49 +02:00
Pablo Neira Ayuso f3016f29dd osmux: rename circuit->list to circuit->rtp_list
A circuit object contains a list of pending RTP messages to be converted to the
osmux format.
2015-07-21 09:59:49 +02:00
Pablo Neira Ayuso 22026a4b9b osmux: rename struct batch_list_node to osmux_circuit
I think this is a better name for this object. Basically, an input handle
represents a batch that is composed of one or more circuit objects.

Each circuit object contains a list of RTP messages that are pending to be
converted to the osmux format in one single batch.
2015-07-21 09:59:48 +02:00
Pablo Neira Ayuso 75df57e15f osmux: add circuit helper functions
Add osmux_batch_add_circuit() and osmux_batch_find_circuit() helper functions.
2015-07-21 09:58:48 +02:00
Pablo Neira Ayuso 752a9c68e5 osmux: add osmux_input_state structure
This new structure serves as container of the internal osmux state during
transformation from RTP AMR to the compressed osmux format.

This reduces the footprint of several functions and it makes them easier to
extend if we need to pass new information between functions.
2015-07-17 22:03:31 +02:00
Pablo Neira Ayuso f67d1126ab osmux: discard non voice osmux message
We only support voice osmux messages by now. Discard unsupported types.
2015-07-17 22:03:31 +02:00
Andreas Rottmann c55d867508 build: fix regarding missing CFLAGS constituents
When libosmo-abis is installed in a distinct prefix, the build failed
with non-found headers, for example:

../../src/rs232.c:38:35: fatal error: osmocom/abis/e1_input.h: No such file or directory
 #include <osmocom/abis/e1_input.h>
2015-06-19 21:01:51 +02:00
Andreas Rottmann 87947aff53 build: fix "make distcheck"
Running "make distcheck" failed trying to generate ".version" into the
read-only unpacked source directory:

  make[1]: Entering directory '/tmp/build/libosmo-netif-0.0.4.10-7d1d/_build'
  echo 0.0.4.10-7d1d > ../.version-t && mv ../.version-t ../.version
  /bin/bash: ../.version-t: Permission denied
  Makefile:877: recipe for target '../.version' failed

Actually shipping ".version" in the tarball fixes that.
2015-05-19 11:47:01 +02:00
Holger Hans Peter Freyther c713b12587 rtp: Declare struct msgb to fix compiler warning
Fixes:
/usr/include/osmocom/netif/rtp.h:63:41: warning: ‘struct msgb’ declared inside parameter list
 struct rtp_hdr *osmo_rtp_get_hdr(struct msgb *msg);
2015-03-22 14:42:22 +01:00
Holger Hans Peter Freyther 6d09cc35f3 rtp: Add "data" to access the data behind the header
This is needed for mgcp_transcode.c of OpenBSC to access the
data after the header. Use a zero sized array for it.
2015-03-22 13:54:32 +01:00
Holger Hans Peter Freyther 86115434f1 endian: Use the new endian macros for portability
Use the new macros to deal with little/big endian. Im a bit
worried to make this change due the little test coverage in
this module but in case of a typo the elements would not be
defined.
2015-03-22 09:38:36 +01:00
Holger Hans Peter Freyther d69c1ca8fa debian: Move the package to multi-arch support 2015-03-14 20:09:13 +01:00
Nikola Kolev 2f1ddb2709 Fix the compilation on FreeBSD. 2015-02-25 15:52:14 +01:00
Nikola Kolev 5da504d9eb Fix typo. 2015-02-25 15:52:05 +01:00
Jan Engelhardt 226e994832 build: remove all_includes
This variable is never set and could therefore be removed.
2014-10-02 23:22:55 +02:00
Jan Engelhardt de816861cb build: put dependency libraries in the right place in Makefiles
Libs must be in _LDADD/_LIBADD and not in _LDFLAGS.
2014-10-02 23:22:43 +02:00
Martin Hauke 603f6c40d5 build: rename INCLUDES to AM_CPPFLAGS in Makefile.am to avoid warnings 2014-09-11 18:22:02 +02:00
Holger Hans Peter Freyther dd337a3c87 Prepare new upstream release 2014-09-08 07:52:08 +02:00
Holger Hans Peter Freyther 7c12931f61 misc: Ignore some build artefacts 2014-09-08 07:52:08 +02:00
Pablo Neira Ayuso 0316aa6060 osmux: export OSMUX_BATCH_DEFAULT_MAX
This allows you to set the default batch size when initializing the
osmux input handle.
2014-08-29 15:30:29 +02:00
Pablo Neira Ayuso 9de1521ca9 osmux: fix more leaks in osmux_xfrm_input() in the error path
Return 0 to the caller, which believes that we have put the message
in the batch. But if it is malformed, silently release it.
2014-08-28 20:19:13 +02:00
Pablo Neira Ayuso c7f110fe73 osmux: stop batch timer in osmux_xfrm_input_fini()
Make sure we don't release a osmux handle with an armed batch timer.

==9753== Invalid read of size 4
==9753==    at 0x4043CA2: rb_first (rbtree.c:293)
==9753==    by 0x403E172: osmo_timers_check (timer.c:256)
==9753==    by 0x403E69E: osmo_select_main (select.c:124)
==9753==    by 0x804EBD3: main (bsc_nat.c:1613)
==9753==  Address 0x4302670 is 56 bytes inside a block of size 108 free'd
==9753==    at 0x4023B6A: free (vg_replace_malloc.c:366)
==9753==    by 0x40494CF: talloc_free (talloc.c:609)
==9753==    by 0x40AB279: osmux_xfrm_input_fini (osmux.c:620)
==9753==    by 0x80651FC: osmux_disable_endpoint (mgcp_osmux.c:96)
==9753==    by 0x805CAFF: mgcp_release_endp (mgcp_protocol.c:1540)
==9753==    by 0x805DD35: handle_delete_con (mgcp_protocol.c:1274)
==9753==    by 0x805E998: mgcp_handle_message (mgcp_protocol.c:415)
==9753==    by 0x804CFF1: mgcp_do_read (bsc_mgcp_utils.c:972)
==9753==    by 0x403F96D: osmo_wqueue_bfd_cb (write_queue.c:48)
==9753==    by 0x403E724: osmo_select_main (select.c:158)
==9753==    by 0x804EBD3: main (bsc_nat.c:1613)
2014-08-28 20:00:06 +02:00
Pablo Neira Ayuso bf42dd6b23 osmux: fix leaks in osmux_xfrm_input() error path
If it is not possible to put the RTP message into the batch in case that:

1) The message is malformed.
2) The message is duplicated.
3) OOM.
4) The batch is already full.

Osmux releases the messages and gets back to the upper layer with an OK
to give another chance to follow up RTP messages.

This patch also fixes a use-after-free that was possible when the batch
was full. The message was released and osmux_batch_add() was returning 0
osmux_xfrm_input(), which resulted in accessing the released message
when updating the statistics.
2014-08-28 19:33:45 +02:00
Pablo Neira Ayuso 217336c2ec osmux: fix osmux_xfrm_output() due to 62d8a18
Fix accidental inclusion of list_add in debugging message area
in ("62d8a18 osmux: hide spamming debug log messages behind ifdef")
that broke osmux.
2014-08-28 18:39:35 +02:00
Pablo Neira Ayuso 355f95b0a3 osmux: more hide spamming debug log 2014-08-28 17:30:12 +02:00
Pablo Neira Ayuso 62d8a18787 osmux: hide spamming debug log messages behind ifdef
This is ugly, with many ifdefs, but they don't want any debug message
that can be spamming. I don't want to remove these because there is
no dissector for osmux, and this can be useful for troubleshooting.
2014-08-28 17:18:11 +02:00
Pablo Neira Ayuso 843c23098a osmux: add statistics to osmux_in_handle struct
Add statistics to the osmux input handle, which translates the RTP
messages to osmux batch.
2014-08-28 16:14:16 +02:00
Pablo Neira Ayuso 7a990e8e53 osmux: disable timing reconstruction debugging
Should be enabled only in case you consider that Osmux should
is lagging when reconstructing RTP messages. I haven't seen
any issue regarding this so far. Let's disable it by default.
2014-08-28 15:17:41 +02:00
Pablo Neira Ayuso d8947e37b0 osmux: allow to specify the osmux frame size
This patch adds a new field to the struct osmux_in_handle that allows
you to specify the osmux frame size. If not specified, the default
size assumes your nic uses a mtu of 1500 bytes.
2014-08-28 15:01:03 +02:00
Pablo Neira Ayuso 0b44016ef6 osmux: fix leak in osmux_replay_lost_packets()
The original RTP header has been already sanity check. Therefore,
we can assume the clone is sane.
2014-08-28 14:30:53 +02:00
Pablo Neira Ayuso 3789791b6b osmux: revisit osmux_batch_enqueue() in case of batch full
1) Force batch delivery in case it is full.

2) Skip padding with more RTP clone in case of message lost if the
   batch is full.
2014-08-28 14:27:54 +02:00