Ensure that the test binaries do not show up in `git status`:
tests/gsm44021/test_frame_csd
tests/v110/test_frame
tests/v110/test_ra1
The new naming complies to the 'tests/*/*_test' pattern in .gitignore.
Change-Id: I7bbcec2ec6887a2e6c9b37e2e5b3d9ee489654ce
msg was made a parent of msghdr after discussion in change
I3a279b55a3adff96948120683c844e1508d0ba94
It turns out this violates some assumptions made in osmo_io,
specifically that the user read callback shall free msg, but we expect
msghdr to remain valid until after that callback returns.
In general I think it is cleaner to make iofd a parent of msghdr.
Change-Id: I41277190e3020cd8fa625bd57a743973e2a65c4b
Ubuntu 20.04 is based on debian 11, but does not have liburing. Extend
the logic to cover this distribution too, so building packages for it
isn't stuck anymore on libosmocore not being able to resolve the
liburing-dev dependency.
I have verified that this makes libosmocore properly build with/without
liburing on debian 10, 11 and ubuntu 20.04 and 22.04.
Fixes: e486e012 ("debian: depend on liburing-dev for debian >= 11")
Change-Id: If18d6543fae9537c8b188e90499491bda3fdfe59
Ensure that existing binds are updated as well.
In some cases the default max length of the osmo_io txqueue could be too
small. Set it to 128 by default and add a VTY option to change it for
an NSI (program-wide).
Change-Id: I993b87fd6b83b3981f5e293f70b931075afec715
Related: SYS#6550
liburing is not available in CentOS 7, so disable it there. I've
verified that this works as expected in our OBS with CentOS 7, 8 and
openSUSE Tumbleweed.
Related: OS#5751
Change-Id: Ie2399754952d460499c9355706be37f792988bac
Avoid aborting the entire socket creation, since those sockopt are fairly
new in the kernel (v5.4), and the feature can still be enabled in older
versions system-wide with sysctl. The worst it can happen is that the
ability to submit address updates (such as Peer Primary Address) doesn't
work, which is not really critical.
Related: SYS#6501
Change-Id: Iff261c8592b6b3c4237c90c84b4e8e921e3c4a65
Prepare for the io_uring backend, by conditionally depending on
liburing-dev on debian >= 11 based distributions. On debian 10 based
distributions, set --disable-uring as configure flag.
Closes: OS#6143
Related: https://askubuntu.com/a/761943
Change-Id: If7832baec0bddbe0bbbbfe07f77bba3deb328d5c
Ensure that a msgb has the proper talloc parent:
All msgbs inside an iofd get the iofd as parent. Received msgbs are reparented
to iofd->msgb_alloc.ctx (which was set in osmo_iofd_setup()) before
being passed to the receive callback.
Before this change the code could fail for msgbs that are submitted via uring
where the (failed) write returns after the iofd has already been
osmo_iofd_free()d. free()ing the iofd is deferred until the write
completes, but the (iofd) parent context could have been free()d in the
meantime.
Change-Id: I3a279b55a3adff96948120683c844e1508d0ba94
This allows uses accessing the updated fields such as fn from the l3_cb
when receiving a msg from CCCH, eg: "le->datalink[DL_SAPI0].mctx.fn;"
Related: OS#3626
Change-Id: Icabc3759c47b0f7cfe61f1b7a96f08f36714262e
This reverts commit 54b1b3be37.
osmo-bts is forwarding the msgbs as they come from lapdm to the RSL on
the wire, which means we end up sending the osmocom-specific IEs on the
wire, something which was not envisioned when adding this IE.
Change-Id: Id9029ef378970322063478e9ce888daf335d6103
Related: OS#6142
This reverts commit d981794113.
osmo-bts is forwarding the msgbs as they come from lapdm to the RSL on
the wire, which means we end up sending the osmocom-specific IEs on the
wire, something which was not envisioned when adding this IE.
Change-Id: I0ab0d5b545b4862e72eb1842edd07ca2e4955311
Related: OS#6142
Marked as WIP because I'm not entirely sure if negative index lookups
were allowed on purpose (although I doubt it)
Change-Id: Iba81873cbc435229599b1a8139cf4b627f8e6924
This makes it possible to track GSM time in the upper layers.
The existing RSL_IE_FRAME_NUMBER and RSL_IE_STARTNG_TIME cannot be used
there, since those are 16bit fields containing Relative FN values.
The IE needs to be added before the L3_INFO one, because user code
usually assumes the msgb->l3 pointing to L3_INFO value extends until the
end of the message, using msgb3_len(msg). Regarding having an extra IE
at the middle, it's not a big problem since the libosmocore version
submitting this commit to the upper layers is the same which will also
be parsing it through rsl_tlv_parse() later on by the app.
Related: OS#3626
Change-Id: Id62c18f49f270449067b25b7104eb8b47f1955ec
This will be used in RSLms to provide Absolute Frame Number information
of the primitive indications being sent to upper layers, so that it's
possible to track GSM time in the upper layers.
The existing RSL_IE_FRAME_NUMBER and RSL_IE_STARTNG_TIME cannot be used
there, since those are 16bit fields containing Relative FN values.
Related: OS#3626
Change-Id: Ia28caa24dd141b1162b6e11500d753353fe6500d
The SCTP_ASCONF_SUPPORTED sockopt, which enables ASCONF features
for the SCTP associations managed by the SCTP socket, gets its default
value from to sysctl "net.sctp.addip_enable", which, at least up to
current kernel 6.4.8 is set to "0" (disabled) by default.
As a result, ASCONF related features such as
setsockopt(SCTP_SET_PEER_PRIMARY_ADDR) fail with -EPERM
since ASNCONF extensions where not negotiated during the SCTP init
handshake.
This commit adds support for setting SCTP_ASCONF_SUPPORTED=1 during
socket creation, since that needs to be applied before the first
bind()/connect() (before first assoc is created).
Furthermore, for ASCONF features to work properly, the assoc also needs
to announce/use the AUTH extension, as per RFC5061 section 4.2.7.
Otherwise, the peer receiving an SCTP INIT with
ExtensionFeatures=ASCONF,ASCONF_ACK but without AUTH, will reject the
assoc with an ABORT since it's not complying with spec (this behavior
can be tweaked through sysctl "net.sctp.addip_noauth_enable").
The AUTH extension is enabled through sockopt SCTP_AUTH_SUPPORTED, and
its default value is that of sysctl "net.sctp.auth_enable", which is
also disabled (0) by default.
Kernel support for those is relatively new:
SCTP_FUTURE_ASSOC added in: 80df2704a375bb4b3c9c5cce9c00052361b16d61
Follows: v5.0-rc4
Precedes: v5.1-rc1
SCTP_ASCONF_SUPPORTED added in: df2c71ffdfae58961981d7cbcccea93688fc4e96
Follows: v5.3-rc5
Precedes: v5.4-rc1
SCTP_AUTH_SUPPORTED added in: 56dd525abd56f7acd7b44a52935726e3ada4916c
Follows: v5.3-rc5
Precedes: v5.4-rc1
Related: OS#6076
Change-Id: Iac07031927b66a9d32d2bb2faab817e4c922a359
Implementation ported from osmo-pcu.git
e98b315d12fb009359410809f4169f9380f3d933, function bts_rfn_to_fn().
This functionality can be used by osmo-pcu, libosmo-gprs or any other
related code which needs to handle RFNs.
Change-Id: Ib71e8da976f6cc84c3a4ab17b0a8c2101492e243
This field will be used in follow-up commits to provide FN information
in RSLms primitives towars upper layers. This is needed for instance on
the MS side when a CCCH_DATA.ind is received containing a TBF ImmAss
with a relative FN indicating the Starting Time. Without tracking FN
advance, the uppers layers are not capable of figuring out the absolute
FN of the TBF Starting time.
The struct lapdm_msg_ctx is not really used outside of libosmocore, so
we are safe extending it.
Related: OS#3626
Change-Id: Icf986f4202703eb452bedc1b749bb8ce0c73706f
msgb_tv32_put() already exists, but msgb_tv32_push doesn't.
The tv16 counterparts are already present, and having to pass 32bit
integers is also quite common, so let's add an API for it.
Change-Id: I68d5693a18d55ce8d0647359044157d7e5bfae50
We have a decoder for RIM ROUTING INFORMATION (bssgp_parse_rim_ri),
let's also have a decoder for RIM ROUTING ADDRESS (bssgp_parse_rim_ra.
Related: OS#6095
Change-Id: Ibca1f08906c4ffeecdae80d4e91c6c7b05fe4f8a
The API function bssgp_tx_rim() accepts decoded RIM PDU structs, encodes
them and eventually sends them. However, there may be cases where the
RIM PCU already exists in its encoded form. (This is in particular the
case when the RIM PDU is forwarded from GTP to BSSGP)
Lets add an API function bssgp_tx_rim_encoded to allow sending of
already encoded RIM PDUs
Related: OS#6095
Change-Id: Id4a793bbaf32d7b9d894dcc5be3faaf2f2d91d82
In bssgp_tx_rim we print source and destination address of the RIM
message we send, but we do not print the NSEI, even though this is also
an important address parameter.
Related: OS#6095
Change-Id: I2595abff28fc1d89c1409a2ca0194fedc6f15313
Use talloc_steal() if a msg is passed in to osmo_io when sending. This
avoids the message being free()d early in case the original parent is
free()d.
Change-Id: Ie36bd68a8bd63e67d76fb41996f8fdf99f51d96c
Under certain cases, gcc version 13.1.1 20230714 catches the fact that
the pointer being passed cannot be null, (eg local variable struct
osmo_sockaddr_str addr_str passed as &addr_str), and errors about
checking nullability of a pointer which cannot be null.
"""
/include/osmocom/core/sockaddr_str.h:63:10: error: the address of 'addr_str' will always evaluate as 'true' [-Werror=address]
63 | ((R) && (R)->af == AF_INET6)? "[" : "", \
| ^
"""
Let's add a macro which can be used for pointers known to be there (tbh,
I'd expect that to be the usual case in most code paths). Using this new
macro should be more optimal in those cases, and avoid gcc erroring.
Change-Id: I59c7b05450cb463d2e87ddb022f0b6ba7109d398
Currently this function is hard-coding the "Connection element (octet
6c)" (see Table 10.5.101h/3GPP TS 24.008) to "Transparent" (0). This
breaks non-transparent data calls.
Use the value from bcap->data.transp. The decoding equivalent of
this function needs no changes, it does populate this field already.
Change-Id: I7339908864e8a2aef6f2b48a108650167e413c7f
Related: OS#6110, OS#4394
As per 3GPP TS 48.008, section 3.2.2.103, the "Codec Type" field may
contain either a certain 3GPP Speech Codec Type directly (4 bit value),
or the so called "Codec Extension" = 0xFh, in which case the real Codec
Type follows in the next octet as "Extended Codec Type".
CSD is such an example, the encoding is defined as follows:
8 7 6 5 4 3 2 1
+----+----+----+----+-------------------+
| -- | PI | PT | -- | 0xFh |
+----+----+----+----+-------------------+
| Extended Codec Type (CSData) |
+----+----+-----------------------------+
| R2 | R3 | |
+----+----+-----------------------------+
CSData is coded with 0xFDh or '1111 1101' (0xfd).
Let's have the "Codec Extension" value clearly defined in the header
file, but intentionally separate from the other GSM0808_SCT_* values.
Change-Id: Iafaa25070684d2ba400c75fa33e803651a5ce857
Related: OS#6110, OS#4393, OS#4394
We need to account for the fact that segmentation_cb() could have
changed the length by calling msgb_pull(). Calculate the new len
according to the new tail/data pointers.
Change-Id: I5486ddc0d3345e92b20cbc6e5bcf2cefea3958c8
It has been decided that the segmentation callback be changed
and moved to libosmo-netif, so we remove it here.
This reverts commit 2c59d1285e.
Related: OS#5753
Change-Id: I9b380326c63587fc79d6a5d8cd458188074fc55d
This is used for parsing e.g. the ipa header and setting msg->cb.
Guard against segmentation_cb changing msg->data in
iofd_handle_segmentation().
Change-Id: Idd2115baae98a7818aabb26232d4423d2d48fb5c
No issue is in principle expected with previous code since snprintf
doesn't seem to be setting errno according to "man snprintf", but better
be safe, specially in case someone calls the functions calling snprintf
in the future, or if snprintf sets errno in other implementations.
Change-Id: I6969be10db867b4821e05aed50bc22a7ccd4a633
See 3GPP TS 45.003 section 3.6. This channel mode is a bit special,
because unlike the other CSD specific channel modes it's interleaved
over 8 (not 22!) consecutive bursts, just like TCH/FS.
Change-Id: I4685376c8deb04db670684c9ebf685ad6fc989fa
Related: OS#1572
Convolutional codes terminated with CONV_TERM_FLUSH (the default)
always append k-1 zeroes at the end to "flush" the encoder state.
This is the case for both TCH/F9.6 and TCH/F14.4.
Change-Id: I4a77ecb9af72b2fd4ea92c42d6748879e73d2cf2
Related: OS#1572
Put the 'm' pointer into braces, so that it's possible to pass an
expression to these macros, e.g. a pointer-to-pointer dereference.
This patch makes the following example compile:
struct msgb **msg = /* ... */;
return msgb_l2(*msg); /* <-- currently this fails */
Currently it fails with the following error:
error: ‘msg’ is a pointer to pointer; did you mean to
dereference it before applying ‘->’ to it?
Change-Id: I2d19ea3c09ff9499314255d408fb71c07148fe25