Commit Graph

6970 Commits

Author SHA1 Message Date
Philipp Maier 057decfe3a mgcp_sdp: add spec reference
Change-Id: I16cd453aa986cf9efa0716257230aed8739593da
2023-02-08 09:21:12 +00:00
Pau Espin 342a9a9418 Bump version: 1.10.0.117-22f9c-dirty → 1.11.0
Change-Id: I9f1dcbbf2fdc242e8d304ec6b2a8e1e60d010c32
2023-02-07 16:58:42 +01:00
Harald Welte 22f9cf2687 update outdated vty copyright statement
Change-Id: I7af4bdecddda0b43f98855571942219e8ba00b64
2023-02-06 16:07:07 +00:00
Oliver Smith 26d6b2b5ce mgcp_client: add new clearmode codec
Set 120 as payload type, as specified in 3GPP TS 48.103 table 5.4.2.2.1.

Related: OS#4395
Related: https://www.rfc-editor.org/rfc/rfc4040#section-5
Change-Id: I55f9fe241a405935dbedc3947b0a4f4986acd5cb
2023-01-24 18:18:11 +01:00
Oliver Smith 169d50ed4a Fix various typos
Change-Id: Iba7851a5bdb0ce2ce6852a8fa035b72515d7b0a1
2023-01-24 13:23:21 +01:00
Philipp Maier 82dfb505db mgcp_network: improve coment
the comment that explains the AMR frame format check is a bit difficult
to understand, lets rephrase it.

Change-Id: I07f12c03449e1e8eda8bdd3edad6d1007f5ba48d
2023-01-19 14:28:30 +01:00
Max 9c0d105d09 ctrl: take both address and port from vty config
Change-Id: Id053bc02e0a6359e52a0f5e110128d3bb87ed151
2022-12-20 19:00:45 +03:00
Pau Espin ded02cfc29 iuup: Use osmo_amr_ft_valid() API
This is the only user outside libosmo-abis using this define, which
meaning is not clear at all. Let's simply use the related API to clearly
check the FT.

Related: SYS#6161
Change-Id: I40c7ed2e7f6a99a33b467734e33acf3d5befac0d
2022-12-19 13:24:23 +01:00
Pau Espin 0cbed362cd osmux: Use new osmux_xfrm_input API to set name on each link
Depends: libosmo-netif.git Change-Id 8bb688e4827f345416c2a4526ced956a07fcc60b
Change-Id: Id5b7d497be4b3405403d30e40e1a52f13101cf5f
2022-11-21 10:52:17 +01:00
Pau Espin 310e41cdf3 osmux: Rotate over available Osmux CID when allocating a new one
Before this patch, the free CID with the smallest number was always
selected to be used. This caused more or less the same subset of CIDs to
be used all the time, while the CIDs with bigger numbers were mostly
unused.
Let's distribute the use so that all CIDs are used roughly the same.
This has the advantage, among others, that the same CID will not be
re-used immediatelly after being freed if a new call is established.
It is useful to leave the CIDs unused for some time since the other end
peer may know of the call being tear down with some delay.
Hence if a new call is established immediately after the CID was
released, the same CID would be allocated and passed at the peer, which
would then detect that the old call (in its view still active) would
already make use of that remote CID.

Change-Id: I9dfbcc5e4b4c61ce217020e533d68fbcfa6b9f56
Related: SYS#6161
2022-11-15 18:10:28 +01:00
Max a55bfdc436 Add realtime scheduling and set priority in service file
This sets lowest realtime priority which still takes precedence over any non-realtime service.

Related: OS#5687
Change-Id: Ib1705a164b04b876f129a17c4e8353b9ddcc538e
2022-11-14 10:52:06 +00:00
Harald Welte 6ea8d7dac6 Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition
... if --enable-werror is used

Change-Id: Ib397f3ad748e17f20b6177ef706af65088571f70
2022-11-03 12:53:20 +01:00
Harald Welte 9befdeb673 Support building with -Werror=strict-prototypes / -Werror=old-style-definition
Unfortunately "-std=c99" is not sufficient to make gcc ignore code that
uses constructs of earlier C standards, which were abandoned in C99.

See https://lwn.net/ml/fedora-devel/Y1kvF35WozzGBpc8@redhat.com/ for
some related discussion.

Change-Id: I98a3c0d5cfda2c4b020652efb4f445f8288342b6
2022-11-03 12:53:20 +01:00
Neels Hofmeyr 5fb814b6b9 AMR->IuUP: log conversion, like for the flipside
For IuUP -> AMR, we log a message like
  Convert IuUP -> AMR OA:...
Do the same for the direction AMR -> IuUP.

Related: SYS#5092
Change-Id: I525685a7dedb6d5d1deecbd026844cbe23193fac
2022-10-28 19:04:00 +00:00
Pau Espin 9ac9cb963d Improve logging on AMR OA<->BWE conversion failure
Change-Id: I7c7dd10650c1d249c723d6781585b343004bd64d
2022-10-26 12:36:48 +02:00
Pau Espin 377d39122d osmux: Make sure RTP AMR feed to osmux is in octet-aligned mode
The Osmux implementation in libosmo-netif expects to work with RTP AMR
in octet-aligned mode. Therefore, if the peer connection received RTP
AMR in bandwidth-efficient mode, we need to convert it to octet-aligned
before feeding the packets to the osmux layer.

Related: SYS#6161
Change-Id: Ifeec44241079f7a31da12745c92bfdc4fb222f3a
2022-10-26 11:56:05 +02:00
Pau Espin d1e94c7ac3 osmux: Rename function and pass msgb directly to it
The new prefix now matches other related functions acting on an osmux
connection.
Pass the msgb to it so simplify new msgb copy.

Change-Id: I8c0121485d0c96f70fe8bcbdb150793d428183ff
2022-10-26 11:56:05 +02:00
Pau Espin 6db3f7f1cb mgw: Rename s/mgcp_send_rtp/mgcp_conn_rtp_dispatch_rtp/
The previous name is misleading since the function is not really sending
stuff over a socket, but rather handling/dispatching the incoming
message internally (and finally later it may be sent over a socket under
some conditions).

Change-Id: Idaf791997b8438a4aede50f614afa0d55ad41faa
2022-10-26 11:55:26 +02:00
Pau Espin 58c0b0a6f7 mgw: rx_rtp(): reorder checks and handlings
First validate the origin of the message, then later the content
of the message and finally execute whatever triggers are necessary.
This way contents from unknown senders are not even parsed or acted
upon, avoiding useless potential harm.

Change-Id: I011a6d7d705768c32a35cec5cd7169725a21a670
2022-10-25 18:23:09 +02:00
Pau Espin cca55247ed Rename and move func checking if amr mode is explicitly configured
The previous naming was quite confusing, since the function is not
really checking whether a conversion is needed, but rather whether the
codec has the AMR RTP mode defined explicitly and hence forced.

The previous naming didn't harm because the amr_oa_bwe_convert also
supports the conversion path OA<->OA and BE<->BE.
Hence nowadays the amr_oa_bwe_convert() function is called always if the
dst conn has its codec with AMR RTP mode explicitly set, no matter if
the src and dst conn have the same mode.

Related: SYS#6161
Change-Id: I8dce3038ebccf5e1e37e2908070a67d66693a96f
2022-10-25 18:23:08 +02:00
Pau Espin d266c374ee mgw: Log unexpected RTP AMR OA-vs-BE payload
Change-Id: Ib5ae82c01153398491b21191a8cec9969337bbbc
2022-10-25 18:23:04 +02:00
Pau Espin d358d71206 cosmetic: Clarify and fix typos in comment
Change-Id: Ibcbe7d85cf7e1912de73d59540f2dea1dfa5d98d
2022-10-25 13:09:36 +02:00
Neels Hofmeyr 5e6661eece IuUP->AMR: log whether converting to AMR OA or BE
Enhance the existing log message
  Convert IuUP -> AMR:...
to
  Convert IuUP -> AMR OA:...
(or BE) to show wether emitting Octet-Aligned or Bandwidth-Efficient.

Related: SYS#5092
Change-Id: I3672d01d2879ae8820176a46454f26a4f5f584de
2022-10-24 21:23:15 +02:00
Neels Hofmeyr c1468ef7a5 IuUP->AMR: do not patch payload type a second time
When converting IuUP to AMR/RTP, bridge_iuup_to_rtp_peer() sets the AMR
side's payload type number and then calls mgcp_send(). In mgcp_send(),
do not attempt to patch the payload type number a second time.

In mgcp_send(), skip patching payload type numbers if the source side is
IuUP. This matches exactly the case of converting IuUP to AMR/RTP.

There already is a check for IuUP, but for the wrong side. Drop that one
and explain in a comment why.

Move the comment about transcoding into the failure branch, where it is
relevant and doesn't clutter the new explanation of payload type
patching conditions.

Related: OS#5720
Related: SYS#5092
Change-Id: I7c722cd959f76bd104ae4941d182c77e5c025867
2022-10-24 21:23:15 +02:00
Neels Hofmeyr 24763eaa73 AMR->IuUP: properly translate Q -> FQC
Fix the reversed logic when composing IuUP.FQC:
AMR.Q == 1 means the frame is good.

Without this fix, all frames on IuUP are marked as bad, and no voice is
heard on the IuUP side.

Related: SYS#5092
Change-Id: I29878dd27af9ba0c9e600324c528b22940cdcc30
2022-10-24 21:23:15 +02:00
Neels Hofmeyr d8c2f31a87 AMR->IuUP: do not crash on AMR data before IuUP Init
When translating AMR to IuUP, when AMR data arrives before the IuUP side
has negotiated an IuUP Initialization, do not crash osmo-mgw, but return
failure and drop the AMR packet.

As soon as IuUP Initialization occured and RFCIs are defined, the AMR
starts to pass through to the IuUP side.

Related: SYS#5092
Change-Id: Id9efb7e523d8d9af988e4bf4f5e925839204f934
2022-10-24 21:23:02 +02:00
Pau Espin 01b812ea76 mgcp_send: Use mgcp_conn_rtp_is_iuup() helper
Change-Id: I6988337f395168b88959876fe3827d8e67b8fc00
2022-10-19 19:18:50 +02:00
Pau Espin 0807771b9e Fix misleading error log
The check is not for an AMR RTP packet. It actually only checks for RTP
header.

Change-Id: I60d7dbfeb2977bcb7102eed19e1c73c9433151a7
2022-10-19 19:06:47 +02:00
Pau Espin 103e50a561 mgcp-client: Fix no 'mgw ' prefix written in old VTY node
Recent commit dropped the 'mgw ' prefix in commands under the "mgw" VTY
node because it was redundant.
However, for old apps still not supporting the 'mgw' node, the commands
are still printed in another node and hence the 'mgw ' prefix must still
be appeneded to them, to avoid breaking backward compatibility.

Related: SYS#5987
Fixes: 8c138fe89c
Change-Id: Ifbfb71f8864b425c1b842cdee241ce279d17a8ba
2022-10-19 17:22:48 +02:00
Pau Espin 3a914e33e9 mgcp-client: Refactor system keeping old users not calling mgcp_client_pool_config_write() working
Move the regular writing logic to a subfunction, and raise the flag only
on one of them.
This simplifies the code paths but not marking stuff true and false over
the same code path.

Change-Id: I070798863f2bdc253df004a63262d4bcd529348f
2022-10-19 17:14:51 +02:00
Pau Espin 2172f402a5 mgcp-client: Fix 'mgw endpoint-range' command dropped from old VTY node
That command was already deprecated when the new commands without the
"mgw" prefix were dropped, so there was no need to create a new command
for it (since it shouldn't be used and it's currently implemented as a
NOOP).

However, the recent patch moved the install line out of the common
function, which meant the command was not available anymore on the old
node, and as a result old config files using it would fail to be parsed.

This commit moves the command back to the common function so that it is
still available for config files using the old node.

Related: SYS#5987
Fixes: 8c138fe89c
Change-Id: I800abcc9869ed097a9d28715269c42552f5aaf29
2022-10-19 16:13:23 +02:00
Pau Espin 8c138fe89c mgcp-client: Add new VTY commands under mgw node without mgw prefix
Previous existing ones are left marked as deprecated, to avoid breakage
with older configs.

Related: SYS#5987
Change-Id: Id55af13d2ecde49d968b9dca6a2f8108a17ec484
2022-10-19 12:47:33 +02:00
Pau Espin 7881f7da0b mgcp-client: Introduce API mgcp_client_pool_config_write
It is not a good idea to use a personal write_config function for the
MGW node, since it's not meant to be a 1st level (top) node.
During write-config the node function will be called at an
implementation specific time (based on the order defined by the app in
the node type enum), so there's no real way to control that the output
of the MGW node will end up under the parent configured in
mgcp_client_pool_vty_init(). As mentioned the order can be tweaked based
on how the node enums are configured, installed, etc. but that's really
a nightmare, so let's better not rely on that.

Therefore, this patch introduces a new API which the users (apps such as
OsmoBSc and OsmoMSC) can use to write the config at the required time
(when writing its own parent node).
A hack is introduced internally to detect older versions of the users
which didn't call this function to still print stuff (up to to the app
if the order is correct).

Related: SYS#5987
Change-Id: I7a620cf47886d8ecab30ce369cf123d98ab842c5
2022-10-18 17:38:44 +02:00
Pau Espin d17a9de79e mgcp-client: Convert users supporting new MGW Pool VTY node during write-config
If the user (app) already supports the MGW Pool VTY command set
(mgcp_client_pool_vty_init() was called), then if single MGW mode is in
use it's because the config file was not updated to use the new MGW Pool
node. Let's convert it to the new format to help in transitioning to the
new VTY command set.

Related: SYS#5987
Change-Id: I2f6658cc66f8bcbd4a60ee2b932bb5dd65888233
2022-10-18 12:44:52 +02:00
Pau Espin 8e74c63e15 mgcp-client: Use random free local port by default
Deprecate mgcp_client_connect2() and all the related messy system where
configured port is incremented until a free port is found.
Let's simply use local_port=0 by default and let the kernel take care of
doing all that.
The mgcp_client_connect2() is actually not being used anywhere outside
of libosmo-mgcp-client, so it's not a real problem deprecating it. We
could poitentially remove it too.

This helps in fixing a regression in recent refactoring commit
f48cd95bbc, which unified calls to
mgcp_client_connect() and in the process dropped the code path which was
setting the retry_n_ports=99.
As a result, since all libosmo-mgcp-client instances set local_port=2727
and addr=NULL by default, using MGW pooling or having several osmo-bsc
or osmo-msc processes would make creating the socket fail.

Change-Id: I5683bcf3b2c4e8058338433f2cd1b143753f6512
2022-10-17 19:22:41 +02:00
Pau Espin 80dd576ad2 mgcp-client: vty: Write deprecation warning using non-mgw nodes
Let's advise all our users to migrate to the new pooled mode, the old
VTY interface should be dropped at some point to avoid making it
overcomplex to configure MGW. There's no need to maintain the same set
of commands under 2 different places.

Change-Id: I95f717a0fcd3c4ca622e3989baa28fac1f7ec1ca
2022-10-17 17:32:31 +02:00
Oliver Smith cb922b646f mgcp_client_pool.h: add missing stdbool include
Fix for:
[   34s] In file included from vty.c:22:
[   34s] /usr/include/osmocom/mgcp_client/mgcp_client_pool.h:18:1: error: unknown type name 'bool'; did you mean '_Bool'?
[   34s]  bool mgcp_client_pool_member_is_blocked(const struct mgcp_client_pool_member *pool_member);

Related: https://obs.osmocom.org/package/live_build_log/osmocom:master/osmo-bsc-nat/CentOS_8/x86_64
Change-Id: Ic3773f49160cbb8c6f53c4f0e17b897017dec98a
2022-10-14 16:42:03 +02:00
Pau Espin 5d8b5b0935 mgcp-client: Introduce APIs to manually select mgcp_client from pool
This will be used by osmo-bsc to implement MGW-pinning for specific BTS.
This is useful for instance to keep all BTS connections targeting the
same MGW in order to make use of Osmux trunking optimizations (AMR
payload of different calls filling same underlaying UDP packet).

Related: SYS#5987
Change-Id: I75ce3e04cd3f6d9cc20d7b4fc0f51083780786c8
2022-10-13 18:47:07 +02:00
Pau Espin 35bd2523e2 mgcp-client: Rearrange internal backpointers
Let's properly store backpointers so that it is easy to access all
relation chain (pool<->pool_member<->mgcp_client).

Related: SYS#5987
Change-Id: I5ec2465075da2e3c8eabca9df60681620a7db499
2022-10-13 18:42:34 +02:00
Pau Espin f45a9b9760 mgcp-client: Rearrange order of structs and APIs in header
Move mgcp_client_pool up in the file as a preparation for next commit,
where pool_member will have a pointer to the pool added.
The related APIs on the object are also moved up in the file.

Change-Id: I9ff9c6e1e722690835c5d59b1fa87fb7d9e3120c
2022-10-13 18:42:34 +02:00
Pau Espin f48cd95bbc mgcp-client: Refactor reinit of mgcp clients
The second parameter of mgcp_client_pool_member_reinit_client() will be
removed in a follow-up patch after further refactoring.

Related: SYS#5987
Change-Id: I0ab59278629c0e7e7c62a68b54b4235df58a5d77
2022-10-13 18:42:34 +02:00
Pau Espin 7558c20973 mgcp-client: Move internal API acting on mgcp_client_pool to the correct file section
Change-Id: Ia0cccb783918eea72c4a77861dac4b60ad369b95
2022-10-13 18:42:31 +02:00
Pau Espin 6ddc79b6ed mgcp-client: Create alloc() and free() internal APIs for mgcp_client_pool_member
Related: SYS#5987
Change-Id: Ibd2bf976885c777fe944652af6fe6eb0f1820468
2022-10-13 18:39:10 +02:00
Pau Espin ff5921573a mgcp-client: Move & rename helper function outside of vty code
This way acessing of the list is kept inside the same file.

Related: SYS#5987
Change-Id: I6b26c2de4064d9c28f92452178fff170fb295576
2022-10-13 18:38:57 +02:00
Pau Espin d4ad77d326 mgcp-client: Rename internal field in mgcp_client_pool
Having a list named pool inside an object already named pool is quite
confusing. Let's rename the field so that it makes sense immediatelly
when looking at it.

Change-Id: I4062af6b619317c48223ad4577eaaad05d4eec9d
2022-10-13 18:38:43 +02:00
Pau Espin a6917fecb1 mgcp-client: Fix typo in internal function name
Change-Id: I073038f1d6c68bc8546763a2c8c791fb5a021630
2022-10-13 18:38:43 +02:00
Pau Espin 58877f04e3 mgcp-client: Avoid double iteration picking client from pool
Change-Id: I99e8be878452c5d8e2183239fbdd499dcf507e90
2022-10-13 18:38:43 +02:00
Pau Espin d4707e2185 mgcp-client: pool: Improve documentation of some internal fields
Change-Id: Ic9823ab0a3f101549452a7c7a0b1b5b21aaa837c
2022-10-13 18:38:28 +02:00
Pau Espin f633302c73 cosmetic: Fix typo in comment
Change-Id: I6b0fcd7ee13e0e712d47741258f83a6f98503e27
2022-10-13 13:20:10 +02:00
Pau Espin 36413c011f osmux: Clean up mgcp_config osmux fields
* Move all of them to an anonymous "osmux" substruct to have them all
  together.
* Rename some fields to clarify its meanings, similar to what
  was already done in osmo-bts.
* Move the port VTY config next to the ip address ones.

Change-Id: Icc1c1ce3ab3a8beb941cda7c112485a0db882a90
2022-10-13 12:36:44 +02:00