We tagged 1.0.0 off a non-master version in the commit history in order
to keep the new TRAU frame handling out of the 1.0.0 release, but to
have all of the other fixes in a tagged release. This merge brings
master in sync with those changes.
Change-Id: If8fc996f385f4127204ad773b991c49d853dfc5b
When a trau sync fsm is allocated, the user must set the sync pattern,
which can not be changed during the whole fsm lifecycle. However on
codec changes it might be necessary to change the sync pattern on the
fly.
- Add function to change the sync pattern
Change-Id: I1caff93b4c8eace8ba8cd6e32e996a9e1503232b
Related: OS#2659
division modulo 1 is always 0, and hence we always returned '1'
as parity bit. Instead, we need to check if the LSB is set in order to
know if the number of bits is odd or even.
Change-Id: I37af702ba020a90a820bae84cb603e187ebbacb5
Closes: CID#211594
Since I0190872dd282bcfe0f97bb4f8ab8d09023f9f06b we are using a header
file provided by libosmocodec, which means we need to add it to our
dependencies (and include path). Linking against the library is
not required, as we don't use any symbols at this point.
Change-Id: Ie4524165d8873f6c801e07d9f03c94f43c66110d
This adds code that converts codec frames between (decoded) TRAU format
and RTP payload format. The FR + EFR functions have been lifted from
OsmoNITB and exended slightly.
The HR functions have been written from scratch. There is also
incomplete code for AMR that needs to be completed + tested.
Change-Id: I7f6993cce2b95318203043e2e14952e581941b79
The history buffer is filled with zeros on startup. Together with
incoming bits those may appear as a valid signal. (each trau frame
begins with 16 zeros). In order to prevent this lets set the history
buffer to all ones, so that it looks like the data in the history
buffer is from an unused timeslot.
Change-Id: Ie5cc7b9a1ab3d8940ef9d2147f5999e8d09ee40e
Related: OS#2547
This code is able to detect and sync against a variety of TRAU
frame sync patterns. Focus is so far on those patterns present on
16k sub-slots, but 8k sub-slots are expected to be supported soon,
too.
A new codebase for this is required as the old OsmoNITB code had
conflated a 16k sub-slot multiplexer with TRAU frame synchronization,
so there was no way to separate those two parts and hence no way to
support 8k sub-slots.
Change-Id: Ia6fe6228b0b8b9a27999f37ce1115ed5558881ea
In the uplink direction, we provide osmo_trau_frame_dl_ta_us()
to determine the time alignment as requested by the CCU in the BTS.
In the downlink direction, the TRAU frame encoder will perform
time alignment as requested by the user in osmo_trau_frame.dl_ta_usec.
Change-Id: I3981becafc56c9a50119b9ba6bf67aa0391cc76e
The old TRAU frame code in src/trau_frame.c (which is for some strange
reason part of libosmo-abis, and not libosmo-trau!) was introduced more
than a decade ago for the needs of bs11_abis AKA OpenBSC aka OsmoNITB.
It is too constrained to implement TRAU frame parsing in a generic way,
including:
* no way to add support for 8k sub-slots
* no way to handle CRC bits or UFI (i.e. no AMR)
* no real API design, it was just ripped out from OsmoNITB and moved into
a library (even the wrong one)
For those reasons, let's introduce a new API for TRAU frame
encoding/decoding - one that supports all the relevant use cases.
Change-Id: I5cf42e6c445d9224be18503cebc7584b3beba08c
* HSL was never fully supported, not sure why it's in the help
* E1D was neglected to add to the help string
Change-Id: I4a5e503676618171e59550774892816b61adecae
We've had osmo_revbytebits_buf() in libosmocore for ages. As it
recently turned out, the flip_bits[] lookup table approach implemented
here is faster at least on x86 systems of the last decade or so.
As of Change-Id I25029fe7e54c92979fb0119992fb8dc167e1536e in
libosmocore, it has been migrated to the lookup table approach. This
means there's no performance penalty of migrating to using it, and
hence no reason whatsoever to have a private implementation here.
Change-Id: I285a87a9fc6abae7d8b47923a46cd082f46829f8
This slipped through the cracks as jenkins so far doesn't build with
--enable-e1d support (fixed in a separate patch).
Change-Id: I505331a4a9430001b049e9f5cc36abf4ce4ca19e
Recent commit b8ea0ff521 introduced a
heap-use-after-free while getting rid of memleaks and clearing up the
reference counting lifecycle of the line object.
In that commit, e1inp_line_put2() was added in ipaccess_drop() which may
potentially free the line object (and its children e1inp_ts objects)
under specific conditions/scenarions. However, the function still used
the child object e1i_ts which in those scenarios would access already
freed memory.
Let's keep a local reference during the life of the function to make
sure the object is non-freed during e1inp_line_put2(), so that we can
notify upper layers that the link is down.
Detected by enabling ASan and running BSC_Tests.TC_chopped_ipa_ping
TTCN3 test.
Related: OS#4688
Change-Id: I4f56af28ad8297846bcdc8ba7afe51fff0f9a00f
An additional argument was added to specify the timeslot read
buffer size.
Change-Id: I4a088f91f23aaad05c5ab84a4783c1915d85aca6
Depends: osmo-e1d I6d603778cce14c5d72fe5f54904905ea7e66d7ff
This patch untangles the code a bit by changing the order where actions
are taken and variables are assigned.
The only real changes in behavour are the introduced assert, and that
bfd->data is set to NULL before releasing the related line.
Related: OS#4624
Change-Id: I947f64f8fa20f87fdc84538402623a6bcf35fdf9
Since the reference is dropped, make sure no one accesses it through
that pointer anymore. It must be done before calling the put() method,
otherwise it may already be released when put() returns.
Change-Id: Ic3f261b2a995efcbc8eece9669ee3ae63af7b5c0
Drop the function e1inp_close_socket since it's only used by the caller
at hand, and it's only exported through "internal.h", so no app is using
it. Remove it because there's only a caller, and furthermore because
keeping it (and putting bfd->data==line) would introduce a layer
violation because the bfd->data==line is only used for ipaccess so far.
Triggering path:
handle_ts1_read ret=0 "Sign link vanished"
ipaccess_drop
line->ops->sign_link_down
(osmo-bsc) ipaccess_drop_oml
e1inp_sign_link_destroy
link->ts->line->driver->close
ipaccess_close
Related: OS#4624
Change-Id: If23cc722106a9f70c998e591369a4acafa52c519
the bfd->data handles a reference to the e1np_line (obtained through
e1inp_line_get() during bfd setup), so remember to drop it under this
condition.
Related: OS#4624
Change-Id: I418064df04872befe2e936e21768b6ea01263120
osmo_use_count is available since libosmocore 1.1.0 release, so bump
required libosmocore version in autotools and packages.
struct e1inp_line field refcnt is kept in order to keep ABI
compatibility accessing struct fields. The new use_count is added at the
end. Size of struct changing is fine since it is allocated through
an API and a pointer should be used by clients.
e1inp_line_clone API is changed but it's not used by anyone outside
libosmo-abis, so it's fine.
Related: OS#4624
Change-Id: I0658b2e9c452598025cc0f1d0b060076171767cc
We cannot blindly append two ubits to the 320-ubit sized buffer. In the
end, we may already fill the buffer after the first ubit, causing a
buffer overflow with the second ubit.
Lets check if the buffer is full after every bit. Avoid copy+pasting
but move the code repeated per bit to a new function.
Change-Id: I58d946265372278051e4f29301d4f201ab98c0fc
Closes: OS#4648
Let's first add two bytes to the msgb before writing. This way we
would assert in case there was no tailroom. As we just added tailroom
in the previous patch of this series, we are fine
Change-Id: If84b31ea9a3fc7a6c8768918efed2822d1d58427
Closes: OS#4644
The DL-SAP primitive msgbs are currently allocated
to only have headroom but no tailroom. Let's change that
Change-Id: Ia476c8a2f70e6579be53230427923885a573f801
Related: OS#4644
In Commit Ib81a749ae24013b17caaf5fd64ccd9acbbc3ce08 we introduced
a syntax error leading to compile failure sfor --enable-e1d ever since.
This hsan't been discovered as osmo-e1d support is not built
automatically anywhere.
Change-Id: If1f4bd9469a614470045716df4c35187ff2cc76b
Increase reference count when a new sign_link using the line is created.
Otherwise the line is freed too quickly during e1inp_sign_link_destroy()
with several TRX being used, since each RSL link is missing a reference.
That extra refcoutny in update() is not really needed given that we already
have a link assigned on the line when we call update.
Fixes: OS#3612
Fixes: OS#4094
Change-Id: I74405b0e87a89c17d58e87024f4aedbd30832013
Historically, OpenBSC has primarily been used with setups that have
a single E1 based BTS connected. This meant that an error message on
the E1 LAPD implicitly has to be related to that single BTS.
However, in more comprehensive setups, there may be many BTSs on many
E1 lines with many signaling slots. At this point, it's important to
know which line/timeslot/tei/sapi a given log message relates to.
This patch introduces related log context.
Change-Id: Ib81a749ae24013b17caaf5fd64ccd9acbbc3ce08
Requires: libosmocore.git Change-Id Ie6742843fff809edffcac24c4dce4edf66bc71be
Related: OS#1938
the subchan_demux code predates ubit_t; let's use it to clarify
certain pointers refer to arrays of unpacked bits.
Change-Id: I944f05473954920d57e12d5514cf928fc78f2ea4
This command is also usable at run-time to dynamically
enable / disable e1 tracing on all active lines
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I0b4251702aecd6721b9d63c320351ef6cb513454
This will update the pcap fd in all open lines and close
the previous one (if applicable).
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I5c7dd740ba0a90b40c69a53b3dcc9d6d6a98f660
ortp >= 0.24.0 doesn't differentiate between SO_REUSEADDR and
SO_REUSEPORT, and has both enabled by default. The latter means that
we can end up with non-unique port bindings as we will not fail to
bind the same port twice.
This should have caused visible problems not only when operating multiple
osmo-bts on one machine (rare), but also with a single osmo-bts. Once the range
(default 16384-17407 ) wraps, there is a risk of new sockets (for new cals)
colliding with old ones. As two ports (RTP+RTCP) are used per call, this means
every 512 voice calls we expect the BTS to wrap. And from that point onwards
there's a risk of overlapping with previously allocated sockets.
Change-Id: I4fc9eee561c7958c70c63b4ffdc6cb700b795e28
Closes: OS#4444