Commit Graph

6970 Commits

Author SHA1 Message Date
Neels Hofmeyr 03fcc91aad mgcp_client_endpoint_fsm: on term, still let conns wait for DLCX OK
When the mgcp_client_endpoint_fsm terminates, do not directly pull each
conn FSM instance (mgcp_client_fsm) into oblivion as well. Those should
emit a DLCX and wait for the "OK" response before deallocating.

In programs using the mgcp client endpoint FSM (osmo-bsc, osmo-msc),
this gets rid of false LMGCP ERROR logging related to DLCX like this:

  Cannot find matching MGCP transaction for trans_id 71998

Related: SYS#5529
Change-Id: I8fbfec5533e9be9cc7ea550df1e6639a0a215973
2021-07-15 02:28:03 +02:00
Neels Hofmeyr 9de30e7cc4 mgcp_client_fsm delete: set mgcp_client as ctx, not NULL
Upon mgcp_conn_delete(), we unparent the FSM instance. Instead of
setting the talloc ctx to NULL, place the deleting conn under the
struct mgcp_client talloc ctx.

Related: SYS#5529
Change-Id: Ia12749e0d7d520f24a967c2df9a4651267e1019e
2021-07-15 02:26:56 +02:00
Philipp Maier d64c041cdb mgcp_endp: make wildcarded detection separate
osmo-mgw currently does only a very simple detection method for
wildcarded requests, but it makes sense to split this detection
off into a separate function so that it can be used from different code
locations and we still have it at one place only.

Change-Id: I27018c01afb8acabfcf5d435c996cc9806e52d6b
Related: SYS#5535
2021-07-14 15:15:15 +02:00
Philipp Maier d02716d6c2 mgcp_protocol: forward declare mgcp_endpoint
The function mgcp_rtp_end_config() takes an mgcp_endpoint as
parameter. The header file does not declare the mgcp_endp struct
and it also does not include mgcp_endp.h because that also would
cause problems. Since the endp parameter in mgcp_rtp_end_config()
is only a pointer we can simply forward declare it.

This patch will currently not change anythig, but it will prevent
compiler warnings when we remove the endp pointer from
struct mgcp_parse_data in a follow up patch

Related: SYS#5535
Change-Id: I07a4d6f9d5334b1f4cf4b262482b8a67b1384398
2021-07-14 15:15:15 +02:00
Philipp Maier a065e632c0 mgcp_ratectr: refactor rate counter and set group name
The rate counter group is currently only referenced by an index. In a
system with multiple trunks this makes it difficult to say which rate
counter group belongs to which trunk sinde the index that is used does
not necessarly corespond to a specific trunk.

Since rate counter groups can now get a human readable name assigned, we
should do that.

Also E1 specific rate counters only make sense for E1-trunks, so they
should not be present on the virtual trunk.

Change-Id: I5e7f0e9081a06af48e284afa5c36a095b2847704
2021-07-13 14:58:07 +02:00
Philipp Maier bd060c3c99 mgcp_trunk: add value string for trunk type.
Change-Id: I634fb2a03744117e976430468ab5c57d50ab0089
2021-07-09 13:57:32 +02:00
Philipp Maier 97cae477fb mgcp_ratectr: fix sourcecode formatting
Change-Id: I7460fd4cdf1a552bca1af681faaa9bd8f88f1404
2021-07-09 13:57:32 +02:00
Philipp Maier 02c880a7dd mgcp_ratectr: drop ws line
Change-Id: Ib0bb231ebf1d941dee85bdea596f07fe26510ce5
2021-07-09 13:57:32 +02:00
Philipp Maier ba09687768 mgcp_trunk: drop ws line
Change-Id: Iac2dfe5643d87066490a77211f01ee9ee3d9fcc7
2021-07-09 13:57:32 +02:00
Neels Hofmeyr a4b677c45a check_rtp_destin(): clarify log msg
The braces as put before this patch would read as {"is known", "is not
yet known"}, which is confusing the actual situation.

Change-Id: Icd1f22a9f4147a2758c2f068ecba46cf7f732604
2021-07-09 11:52:04 +00:00
Philipp Maier 6b7afe8f57 mgw_main: fix loop that resets all endpoints
The loop that resets all endpoints in read_call_agent() starts counting
at endpoint index 1, but it should begin counting at index 0

Change-Id: I82a385e547e54d82eff95213652317ed2fdaadd8
2021-07-09 11:51:00 +00:00
Philipp Maier 4131a65c4d mgcp_protocol: fix loop that sends dummy RTP packets
The logic in mgcp_keepalive_timer_cb() only sends dummy packets for
endpoints 1-N, leaving out endpoint 0, this is not correct it should
include all endpoints (0-N).

Change-Id: I99a9b572eac26780bc1286a8dd63c4c5652fda4f
2021-07-09 11:51:00 +00:00
Pau Espin 6a5e5ac2d4 Use DLMGCP instead of DLGLOBAL in log lines
Change-Id: I95e11e8b1803153315750840ecec01402becf819
2021-07-08 18:13:46 +02:00
Pau Espin b066bd0c86 Take into account Marker bit when patching RTP stream
On a deployed osmo-mgw with RTP traffic coming from a thirdparty
RTP source, it was usual to see log messages like following one from
time to time:
"The input timestamp has an alignment error of 159 on SSRC"

Doing a quick traffic analysis showed that the above mentioned RTP
source was generating traffic from time to time containing RTP packets
with the Marker (M) bit.

Those messages were logged because the verification & patching funcions
in osmo-mgw were not Marker-bit aware. Hence, this patch implements
support for Marker bit when handling RTP packets.

The Marker bit is usually used as a start of a talkspurt, and has to be
considered a syncrhonization point, where timestamp and relation to real
time don't need to match with last received RTP packet in the stream.

Related: SYS#5498
Change-Id: I1fb449eda49e82607649122b9b9d983a9e5983fa
2021-07-08 10:18:15 +00:00
Pau Espin d6769ea207 Fail rx MDCX sendrecv with invalid remote addr
use the recently new available API to check both remote address and
port, instead of only the port.
It doesn't make sense to configure a conn as sendrecv if we have no IP
address to send stuff to, similar to what was already being checked with
the port.

Change-Id: I6ce8cf52930d423d3db8c27251be8350a26a4ede
2021-07-07 14:12:35 +00:00
Pau Espin ca280a1a84 mgw: rx CRCX: Avoid sending dummy rtp if remote address not provided
The following sequence of events was seen frequently in a osmo-mgw
instance running on the field with heavy traffic:
"""
endpoint:rtpbridge/1@mgw CRCX: creating new connection ...
mgcp_network.c:236 endpoint:rtpbridge/1@mgw CI:1C8CCFA9 Failed to send dummy RTP packet.
"""

Allegedly, that happens because at CRCX time the remote address may
still not be known, hence we end up trying to send a dummy rtp packet
to, for instance, host 0.0.0.0 port 0, which will of course fail.
Let's avoid sending it if the address is not yet known.

Similary, same issue could be seen during MDCX, since at MDCX we don't
necessarily need to have a valid addr+port (there could be several MDCX
and only last one set it).

Finally, the keepalive timer also needs the check, since it iterates
over all connections, and it could be that some is still not fully
configured.

Related: SYS#5498
Change-Id: I8ceafda691146823b12232b4a804b4ce74acbdc8
2021-07-07 14:12:35 +00:00
Pau Espin a24dcc61d7 mgcp_send_dummy: Check RTP destination is available before attempt tx
Several log messages showing "Failed to send dummy RTP packet." were
seen in a osmo-mgw on the field. Let's re-use the function to check and
provide more information on what's wrong to ease debugging.

Related: SYS#5498
Change-Id: Iee6ac1f4d24c131e3bf40c37e6fdc252e5208ec8
2021-07-07 14:12:35 +00:00
Pau Espin 62d9df684f mgcp_network.c: Reorder some functions in file
This is a preparation for next commit, where one of the function will
require an static function available before it in the file.

Moving the functions also make sense, in order to have the 3 mgcp send
functions together for more easy understanding.

This commit does small style changes to fix followint linter errors:
"""
src/libosmo-mgcp/mgcp_network.c:1036: ERROR:SPACING: space required after that ',' (ctx:VxV)
src/libosmo-mgcp/mgcp_network.c:1091: WARNING:BRACES: braces {} are not necessary for any arm of this statement
src/libosmo-mgcp/mgcp_network.c:1145: ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"
src/libosmo-mgcp/mgcp_network.c:1163: ERROR:ELSE_AFTER_BRACE: else should follow close brace '}'
src/libosmo-mgcp/mgcp_network.c:1204: ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"
src/libosmo-mgcp/mgcp_network.c:1226: ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"
"""

Change-Id: Iff8dab942182a0d909519acddb86be75d9cda7ae
2021-07-07 14:12:35 +00:00
Pau Espin 8358c4ba07 constify some function arg pointers
Change-Id: I7a7560fad96719da01f1ee30eea0be0e52c60e99
2021-07-07 13:44:39 +02:00
Pau Espin 4c77e9b748 Define patch_ssrc as bool type
This variable clearly holds a boolean value, so let's use stdef to make
it clear.

Change-Id: I05233a413b0d8511d056e8f93467a111c4bdf119
2021-07-07 12:18:43 +02:00
Pau Espin 33347a4f5d constify arg in addr_is_any()
Change-Id: Ie8cb750d2e265bae48bbfa8ea1d88f3e316879ed
2021-07-06 20:04:23 +02:00
Philipp Maier 7d86d4c523 mgcp_client: fix error handling in mgcp message generation
The functions add_lco and add_sdp assert when the codec string can not
be generated. This is the case when an unexpected codec is addressed in
the input parameter mgcp_msg for mgcp_msg_gen(). Even though the API
user is expected only to use the codec identifiers in mgcp_client.h the
check should not be done with an assert. Instead mgcp_msg_gen() should
just return NULL imediately.

Also all generation functions should not use magic numbers as return
codes. Instead constants from errno.h should be used. It is also
problematic that the return codes from msgb_printf are added up.
Depending. It makes more sense to use an OR operator since msgb_printf
only returns 0 or -EINVAL, so the end result will be -EINVAL if one or
more msgb_printf fail and not just a random negative value.

Change-Id: Ibb788343e0bec9c0eaf33e6e4727d4d36c100017
Related: OS#5119
2021-06-11 15:16:13 +02:00
Philipp Maier eb984bd630 mgcp_client: drop nunnecessary else statement
There is an elarly return statement, so there is no need for an else
branch.

Change-Id: I96d0d468ccab302f9add206164f4d5b1b768bb48
2021-06-11 12:22:51 +02:00
Philipp Maier b3d14eb552 mgcp_network: refactor MGCP_DUMMY_LOAD
The constant MGCP_DUMMY_LOAD is used ambigously. Sometimes it is used as
initalizer for an array, sometimes it is used as a single byte. Also the
name is not very expressive. Lets refactor this.

Change-Id: I21d96cefeeb647958bfa1e22a0ea030884746fad
Related: OS#4005
2021-06-07 20:14:35 +00:00
Pau Espin 907744e2fc Use new stat item/ctr getter APIs
Generated with spatch with this and similat snippets:
"""
@@
expression E1, E2;
@@
- &E2->ctr[E1]
+ rate_c

Change-Id: I53b75ea8a88bc1ae4ceb479ed272865054de9665
2021-06-04 17:57:34 +02:00
Philipp Maier 776846a0b9 mgcp_common, mgcp_udp_send: make parameter buf const
When mgcp_udp_send() is called, the memory where *buf is pointing to is
never modified. It should be marked as const.

Change-Id: Iac90de5beb19bf52586ac6ffeab9eb5152edf339
2021-05-20 14:22:08 +02:00
Neels Hofmeyr 59e7cf4437 add osmo_mgcpc_ep_ci_get_remote_rtp_info()
So far an mgcp_client user can get the RTP address+port information that
the MGW has returned upon a CRCX. Add this function to return the other
RTP end, i.e. address+port that the MGW was told to send RTP to.

This will be used to fix the MGCP in osmo-bsc, which so far mixes up the
two RTP ends and compares the MSC's RTP address+port with the MGW's one
and hence fails to skip unnecessary MDCX.

Change-Id: Ibb488925827d9dc0ccb1f8d6d84728745d086793
2021-05-19 19:05:44 +02:00
Keith Whyte b2064423fe Log some useful messages at ERROR/INFO instead of DEBUG
Change-Id: I22cbecab8d9f7a1980387f16c9a8da444aaa0311
2021-05-10 17:45:49 -05:00
Philipp Maier 97a9312be8 mgcp_network: fix implicit address loopback
A call agent may send a CRCX to create a connection in LOOPBACK mode but
without specifiying the destination address. In those cases the MGW
should deduct the destination address from the first incoming RTP
packet.

Unfortunately this is currently blocked by an OSMO_ASSERT that checks the
current sa_familiy against the sa_family from the incoming packet. This
makes no sense since the current sa_family is still uninitalized, which
is expected and not an error since the code that follows will initalize
it.

It also makes sense not to access the osmo_sockaddr struct members
individually but rather copy the address as a wohle.

Since the event only happens once and since it is also somewhat special
it makes sense to log the event as well.

Change-Id: I2dbd6f62170a7f62e5287d04a4ee6716b8786c26
Related: OS#5123
2021-05-10 12:50:34 +00:00
Neels Hofmeyr 427cede4ba tweak termination DLCX log msg
Sending a DLCX upon FSM cleanup is not unusual. Move the log about that
DLCX to INFO, and also print the endpoint and conn identifier.

Change-Id: Id723d949f101b66fb75296d01489d9dac350c7c8
2021-05-08 09:05:01 +00:00
Neels Hofmeyr 7371663aeb send DLCX only once
If the mgcp_client_fsm gets terminated in ST_DLCX_RESP, it has already
sent a DLCX to the MGW. So do not send a second one.

I noticed the duplicate DLCX for the same endpoint conn identifier while
running TTCN3 tests and watching the network trace of test teardown.

Change-Id: I35e415f67946b73c74408afe265618cfe4f72b0b
2021-05-08 09:05:01 +00:00
Keith Whyte fe53edd776 Add vty command 'show mgcp active'
With just one E1 line, the 'show mgcp' command outputs
several hundred lines to the vty. Add a 'active' parameter to
only show endpoints that are active.

Change-Id: I23a26b4fdc03d8b2469d293dd6c06ed83ce739e9
2021-05-07 19:00:17 +00:00
Harald Welte 4f6a7ad5f8 manual: Include QoS chapter and add osmo-mgw specific example
Change-Id: I46f632f52a86a50242689a0132a7a7cb2a8feb12
Depends: osmo-gsm-manuals.git Id344c29eda2a9b3e36376302b425e9db1f6c0f28
2021-04-29 21:26:15 +02:00
Harald Welte 55a9229922 mgw: Add support for setting socket priority from VTY
This is useful for affecting the 802.1Q PCP value without any separate
external packet filter rules for classification.

Change-Id: I69136c6dd114c24b1dace034e75dba5157bac37e
Depends: libosmocore.git I89abffcd125e6d073338a5c6437b9433220e1823
2021-04-29 21:25:33 +02:00
Harald Welte 7802ccc8d6 switch from osmo_sock_set_dscp() to OSMO_SOCK_F_DSCP()
libosmocore If22988735fe05e51226c6b091a5348dcf1208cdf introduces
an even more convenient mechanism for specifying the DSCP of
an IP socket via OSMO_SOCK_F_DSCP()

Change-Id: If0b11dea08716ed3952a25b546b2a9bd013857bf
2021-04-28 20:27:37 +02:00
Harald Welte 3ff5151661 manual: don't define fig-bsc twice
Change-Id: Ibaed44a8de5425b420820a13f14c92c38b9c5fd9
2021-04-28 20:27:37 +02:00
Harald Welte 5936a9c23e TOS bits != DSCP
We have VTY options that allow to set the DSCP value.  However, we
then call a function to set the TOS bits in the kernel.  This is
very wrong.  The DSCP is only the upper 6 bits of the 8-bit TOS
value, and hence we are mussing that translation.

As libosmocore now has a helper function osmo_sock_set_dscp(),
let's make use of it and don't care about the low-level details.

However, this means we need to finally remove the deprecated
alias for "rtp ip-tos <0-255>".

Closes: OS#5137
Change-Id: I9c18c90273be97aedd2ad212b82f650e35c32851
Depends: libosmocore.git Ia4ba389a5b7e3e9d5f17a742a900d6fd68c08e40
2021-04-28 20:27:11 +02:00
Harald Welte 9ffaba7c1b Bump version: 1.8.0.1-535e → 1.8.1
Change-Id: Ib92e6ca89e1406d3707a94063975fe338cf67a9e
2021-02-24 10:56:17 +01:00
Harald Welte 535ede2598 attempt to fix RPM spec file after recent soversion bump
In I64ff22193ab2a95a9a7d66e9957a875d096e23de the soversion was
chhanged, but the spec.in file was not adjusted accordingly.

Change-Id: I45d7321adb2db8e7b9ea41b6bcf0c6cc59984a0e
2021-02-24 10:54:32 +01:00
Pau Espin 6ccdaa243f Bump version: 1.7.0.138-ace0b-dirty → 1.8.0
Change-Id: I64ff22193ab2a95a9a7d66e9957a875d096e23de
2021-02-23 18:28:45 +01:00
Pau Espin ace0b946ff tests: Replace deprecated API log_set_print_filename
Change-Id: I761d2bf99aa5a009ff489584d804634e58588125
2021-02-19 13:33:52 +01:00
Pau Espin a34036c296 .gitignore: Ignore new autofoo tmp files
Change-Id: I792f5cd80bee6572ee60269ac44a12d10b5e3a5f
2021-02-04 12:50:27 +01:00
Oliver Smith 9fec391d6e configure.ac: set -std=gnu11
Change-Id: Ic2a1f20be65810a86cdc36aaa459819146a0bfcc
2021-01-28 09:28:08 +00:00
Oliver Smith a835fa85d7 contrib/jenkins: don't build osmo-gsm-manuals
Related: OS#4912
Change-Id: Idb179c5618797bb245fad857fa79242c43d539a2
2021-01-13 13:14:39 +01:00
Vadim Yanitskiy 2c66c15227 fixup mgcp_trunk: increase default number of virtual endpoints
In change I55605ea083565b6950d0820e3f72c50c9dc19ffa, the default
number of endpoints was increased to 512, however the
configuration examples were not updated.

Change-Id: I449a612065a5208c9f70ae74f594e8d45eb344cf
Related: OS#4711, SYS#5262
2021-01-02 11:29:29 +01:00
Philipp Maier 92a73cd637 mgcp_client: get rid of magic numbers for E1 slots
use NUM_E1_TS-1 instead of 31 in relation of E1 timeslot count

Change-Id: Iee134d70f05883fcd2e58e0b9c78ed70aea16695
2020-12-10 15:23:17 +00:00
Philipp Maier 6e2795bfbf usermanual: add chapter about mgcp endpoints
The manual does not say much about the endpoint naming, even though
osmo-mgw is oriented at RFC 3435 the endpoint names are specific to
osmo-mgw. In particular the E1/T1 endpoints and their overlapping need
some explaination

Change-Id: I16265eb667221959a69f33701d024bd8d9b22040
2020-12-01 12:04:38 +00:00
Philipp Maier 276b595361 configuration: add section about E1 trunks
The cunfiguration chapter does not say anything about E1 trunk
configurations, lets add a subsection that explains how an E1
trunk is added.

Change-Id: I4059771df0f115242398d1af499c837005a7dabc
2020-12-01 12:04:38 +00:00
Philipp Maier 3c293b418b mgcp_trunk: get rid of magic numbers for E1 slots
use NUM_E1_TS-1 instead of 31 in relation of E1 timeslot count

Change-Id: I1cf5fa17f7455448a08ec3c32febca450eadb21e
2020-11-27 15:12:33 +01:00
Philipp Maier 41425e9b85 mgcp_vty: add missing VTY commands for E1 trunks
The E1 trunk lacks the VTY commands force-realloc and rtp-accept-all.
However, the function that write the E1 trunk config includes those
commands. Also they would be applicable, so lets add those two commands
also for E1 trunks.

Change-Id: Ief2bc7502bb8d1e0f9c784d42edbe1aed5ffb728
2020-11-26 21:52:00 +01:00