Compare commits

...

15 Commits

Author SHA1 Message Date
Oliver Smith
51565999da Bump version: 1.11.1.1-fb862 → 1.11.2
Change-Id: I8ba80a0a3ebb1ac1719aaea0a3091d1212508130
2023-05-26 17:49:29 +02:00
Oliver Smith
fb8624ed1e systemd: depend on networking-online.target
Related: SYS#6400
Change-Id: Ib6c78c76c5f13b9482428ce653a61b03b2aca1d3
2023-05-26 17:48:18 +02:00
Pau Espin Pedrol
1d23dfb0aa Bump version: 1.11.0.1-ef3e5 → 1.11.1
Change-Id: I45b2d09948bb6666c52466b59beb301d8da972c1
2023-03-10 14:55:22 +01:00
Pau Espin Pedrol
6087326beb mgcp_network: Unregister osmo_fd before closing fd
(cherry picked from commit 6c303664f5)

Change-Id: Id03011a11be17e9c0a53b01444754dd633232d2e
2023-03-10 14:55:11 +01:00
Pau Espin Pedrol
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 Pedrol
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 Pedrol
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 Pedrol
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
20 changed files with 232 additions and 117 deletions

View File

@@ -24,6 +24,3 @@
# If any interfaces have been removed or changed since the last public release, a=0.
#
#library what description / commit summary line
libosmo-netif >1.2.0 OSMUX_DEFAULT_PORT, osmux_xfrm_output_*, osmux_xfrm_input_*
libosmocore >1.7.0 osmo_sockaddr_is_any()
libmgcp-client NEW APIs mgcp_client_pool_member_...(), mgcp_client_pool_config_write()

View File

@@ -44,13 +44,13 @@ AC_SEARCH_LIBS([dlsym], [dl dld], [LIBRARY_DLSYM="$LIBS";LIBS=""])
AC_SUBST(LIBRARY_DLSYM)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.2.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.8.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.8.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.8.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.8.0)
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.4.0)
PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 1.4.0)
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
@@ -79,6 +79,7 @@ AC_ARG_ENABLE(werror,
if test x"$werror" = x"yes"
then
WERROR_FLAGS="-Werror"
WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition"
WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
CFLAGS="$CFLAGS $WERROR_FLAGS"

View File

@@ -29,30 +29,30 @@ BuildRequires: pkgconfig >= 0.20
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: pkgconfig(libosmo-netif) >= 1.2.0
BuildRequires: pkgconfig(libosmocore) >= 1.7.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.7.0
BuildRequires: pkgconfig(libosmogsm) >= 1.7.0
BuildRequires: pkgconfig(libosmovty) >= 1.7.0
BuildRequires: pkgconfig(libosmocoding) >= 1.7.0
BuildRequires: pkgconfig(libosmoabis) >= 1.3.0
BuildRequires: pkgconfig(libosmotrau) >= 1.3.0
BuildRequires: pkgconfig(libosmo-netif) >= 1.3.0
BuildRequires: pkgconfig(libosmocore) >= 1.8.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.8.0
BuildRequires: pkgconfig(libosmogsm) >= 1.8.0
BuildRequires: pkgconfig(libosmovty) >= 1.8.0
BuildRequires: pkgconfig(libosmocoding) >= 1.8.0
BuildRequires: pkgconfig(libosmoabis) >= 1.4.0
BuildRequires: pkgconfig(libosmotrau) >= 1.4.0
%{?systemd_requires}
%description
OsmoMGW is Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks.
%package -n libosmo-mgcp-client9
%package -n libosmo-mgcp-client11
Summary: Osmocom's Media Gateway Control Protocol client library
Group: System/Libraries
%description -n libosmo-mgcp-client9
%description -n libosmo-mgcp-client11
Osmocom's Media Gateway Control Protocol client library.
%package -n libosmo-mgcp-client-devel
Summary: Development files for Osmocom's Media Gateway Control Protocol client library
Group: Development/Libraries/C and C++
Requires: libosmo-mgcp-client9 = %{version}
Requires: libosmo-mgcp-client11 = %{version}
%description -n libosmo-mgcp-client-devel
Osmocom's Media Gateway Control Protocol client librarary.
@@ -90,8 +90,8 @@ find %{buildroot} -type f -name "*.la" -delete -print
%check
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
%post -n libosmo-mgcp-client9 -p /sbin/ldconfig
%postun -n libosmo-mgcp-client9 -p /sbin/ldconfig
%post -n libosmo-mgcp-client11 -p /sbin/ldconfig
%postun -n libosmo-mgcp-client11 -p /sbin/ldconfig
%if 0%{?suse_version}
%preun
@@ -119,8 +119,8 @@ make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
%dir %{_sysconfdir}/osmocom
%config(noreplace) %{_sysconfdir}/osmocom/osmo-mgw.cfg
%files -n libosmo-mgcp-client9
%{_libdir}/libosmo-mgcp-client.so.9*
%files -n libosmo-mgcp-client11
%{_libdir}/libosmo-mgcp-client.so.11*
%files -n libosmo-mgcp-client-devel
%{_libdir}/libosmo-mgcp-client.so

View File

@@ -1,5 +1,7 @@
[Unit]
Description=Osmocom Media Gateway (MGW)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
@@ -8,6 +10,11 @@ WorkingDirectory=%S/osmocom
Restart=always
ExecStart=/usr/bin/osmo-mgw -s -c /etc/osmocom/osmo-mgw.cfg
RestartSec=2
# CPU scheduling policy:
CPUSchedulingPolicy=rr
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):
CPUSchedulingPriority=1
# See sched(7) for further details on real-time policies and priorities
[Install]
WantedBy=multi-user.target

147
debian/changelog vendored
View File

@@ -1,3 +1,150 @@
osmo-mgw (1.11.2) unstable; urgency=medium
* systemd: depend on networking-online.target
-- Oliver Smith <osmith@sysmocom.de> Fri, 26 May 2023 17:49:29 +0200
osmo-mgw (1.11.1) unstable; urgency=medium
* mgcp_network: Unregister osmo_fd before closing fd
-- Pau Espin Pedrol <pespin@sysmocom.de> Fri, 10 Mar 2023 14:55:21 +0100
osmo-mgw (1.11.0) unstable; urgency=medium
[ Pau Espin Pedrol ]
* mgcp-client: Remove impossible code path
* mgcp_osmux: Drop duplicated conn_osmux_release_cid() in code path
* Use Osmux default port define from libosmo-netif
* osmux: Use new osmux APIs to let libosmo-netif alloc struct osmux_out_handle
* mgw: Fix osmux conn local IP selection
* cosmetic: osmux: Fix wrong indentation
* mgw: Use X-Osmux string define
* Add Osmux log category
* cosmetic: main: Properly format log_info_cat
* osmux: Use better name for function which may allocate a new struct
* osmux: Use osmo_sockaddr wherever possible
* osmux: Log refcounting of osmux_handle_list
* osmux: Fix memleak on error code path
* osmux: don't store conn ptr inside shared osmux_handle
* osmux: set log level of expected code path to INFO
* cosmetic: vty: Fix indentation whitespace
* osmux: Log sendto() error
* cosmetic: mgcp_conn.h: fix indentation whitespace
* osmux: Attach osmux to virtual trunk
* osmux: Clean up helper macro osmux_chunk_length()
* osmux: Get rid of static NULL talloc context
* Fix typo in ratectr description
* mgcp_conn: rename field s/rate_ctr_group/ctrg/g
* Use 'static const' instead of 'const static' everywhere
* osmux: Add connection and global rate counters
* cosmetic: osmux: Fix formatting of if-else brackets
* osmux: Rename field osmux usage policy and define it with proper type
* Use bool type instead of int in config field
* osmux: Support local CID != remote CID
* osmux: Fix incorrect rate_ctr_group used in mgcp_osmux.c
* osmux: Improve per-conn tx rate counters
* vty: show per-connection Osmux VTY stats
* osmux: Rename field s/init/initialized
* osmux: Allocate rate counters during initialization of osmux conn
* cosmetic: osmux: Drop extra empty line
* osmux: Drop unneeded comment block
* osmux: Lower log level when osmux batch received for unknown CID
* osmux: Keep decoding osmux pkt if a batch contains an unknown CID
* Allocate struct osmux_in_handle through new libosmo-netif APIs
* osmux: Drop logging of osmux internal counters
* osmux: cleanup misleading code calling rtp_bridge_cb
* osmux: Unify rtp_conn osmux type into a single type
* osmux: Match remote address in osmux_conn_lookup()
* osmux: Fill in from_addr in struct osmo_rtp_msg_ctx
* osmux: Log remote address upon rx of osmux pkt
* send_dummy: Use proper condition to test if conn is osmux
* Fix regression in detection of legacy dummy packets
* Use new libosmocore API osmo_sockaddr_is_any()
* Get rid of separate rtp_port field
* osmux: Use available API to check if remote end is known
* Add Osmux IPv6 support
* Clean up local var pointers in mgcp_get_local_addr()
* osmux: Change couple log lines to OSMUX category
* osmux: Add square brackets around IPv6 address to distinguish port in log line
* osmux: Drop unused role parameter
* osmux: cosmetic: Fix indentation
* Check once if remote addr is available when sending dummy packet
* osmux: Simplify and constify param passing
* osmux: Set conn->type during osmux_init_conn()
* osmux: Make conn_osmux_{allocate,release}_local_cid() APIs static
* osmux: Define osmux_dummy cfg as boolean
* osmux: Move setting OSMUX_STATE_DISABLED to initializer function
* osmux: Erase references to bsc-nat
* mgcp_conn_dump(): Separate dump for osmux and iuup connections
* osmux: Introduce osmux peer-behind-nat (on|off) and rework conn activation
* osmux: Clean up mgcp_config osmux fields
* cosmetic: Fix typo in comment
* mgcp-client: pool: Improve documentation of some internal fields
* mgcp-client: Avoid double iteration picking client from pool
* mgcp-client: Fix typo in internal function name
* mgcp-client: Rename internal field in mgcp_client_pool
* mgcp-client: Move & rename helper function outside of vty code
* mgcp-client: Create alloc() and free() internal APIs for mgcp_client_pool_member
* mgcp-client: Move internal API acting on mgcp_client_pool to the correct file section
* mgcp-client: Refactor reinit of mgcp clients
* mgcp-client: Rearrange order of structs and APIs in header
* mgcp-client: Rearrange internal backpointers
* mgcp-client: Introduce APIs to manually select mgcp_client from pool
* mgcp-client: vty: Write deprecation warning using non-mgw nodes
* mgcp-client: Use random free local port by default
* mgcp-client: Convert users supporting new MGW Pool VTY node during write-config
* mgcp-client: Introduce API mgcp_client_pool_config_write
* mgcp-client: Add new VTY commands under mgw node without mgw prefix
* mgcp-client: Fix 'mgw endpoint-range' command dropped from old VTY node
* mgcp-client: Refactor system keeping old users not calling mgcp_client_pool_config_write() working
* mgcp-client: Fix no 'mgw ' prefix written in old VTY node
* Fix misleading error log
* mgcp_send: Use mgcp_conn_rtp_is_iuup() helper
* cosmetic: Clarify and fix typos in comment
* mgw: Log unexpected RTP AMR OA-vs-BE payload
* Rename and move func checking if amr mode is explicitly configured
* mgw: rx_rtp(): reorder checks and handlings
* mgw: Rename s/mgcp_send_rtp/mgcp_conn_rtp_dispatch_rtp/
* osmux: Rename function and pass msgb directly to it
* osmux: Make sure RTP AMR feed to osmux is in octet-aligned mode
* Improve logging on AMR OA<->BWE conversion failure
* osmux: Rotate over available Osmux CID when allocating a new one
* osmux: Use new osmux_xfrm_input API to set name on each link
* iuup: Use osmo_amr_ft_valid() API
[ Vadim Yanitskiy ]
* libosmo-mgcp-client: add -no-undefined to *_la_LDFLAGS
[ Philipp Maier ]
* mgcp_e1: fix apidoc
* mgcp_network: improve coment
[ Max ]
* Set working directory in systemd service file
* Add realtime scheduling and set priority in service file
* ctrl: take both address and port from vty config
[ Harald Welte ]
* Make osmo_mgcpc_ep_fsm_pre_term() static
* Support building with -Werror=strict-prototypes / -Werror=old-style-definition
* Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition
* update outdated vty copyright statement
[ Oliver Smith ]
* mgcp_client_pool.h: add missing stdbool include
* Fix various typos
* mgcp_client: add new clearmode codec
[ Neels Hofmeyr ]
* AMR->IuUP: do not crash on AMR data before IuUP Init
* AMR->IuUP: properly translate Q -> FQC
* IuUP->AMR: do not patch payload type a second time
* IuUP->AMR: log whether converting to AMR OA or BE
* AMR->IuUP: log conversion, like for the flipside
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 07 Feb 2023 16:58:41 +0100
osmo-mgw (1.10.0) unstable; urgency=medium
[ Eric ]

12
debian/control vendored
View File

@@ -6,10 +6,10 @@ Build-Depends: debhelper (>=9),
dh-autoreconf,
pkg-config,
autotools-dev,
libosmocore-dev (>= 1.7.0),
libosmo-netif-dev (>= 1.2.0),
libosmo-abis-dev (>= 1.3.0),
osmo-gsm-manuals-dev (>= 1.3.0)
libosmocore-dev (>= 1.8.0),
libosmo-netif-dev (>= 1.3.0),
libosmo-abis-dev (>= 1.4.0),
osmo-gsm-manuals-dev (>= 1.4.0)
Standards-Version: 3.9.8
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw
@@ -21,7 +21,7 @@ Multi-Arch: foreign
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: OsmoMGW: Osmocom's Media Gateway for 2G and 3G circuit-switched mobile networks
Package: libosmo-mgcp-client9
Package: libosmo-mgcp-client11
Section: libs
Architecture: any
Multi-Arch: same
@@ -33,7 +33,7 @@ Package: libosmo-mgcp-client-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends: libosmo-mgcp-client9 (= ${binary:Version}), ${misc:Depends}
Depends: libosmo-mgcp-client11 (= ${binary:Version}), ${misc:Depends}
Description: libosmo-mgcp-client: Osmocom's Media Gateway Control Protocol client utilities
Package: osmo-mgw-doc

View File

@@ -6,7 +6,6 @@ noinst_HEADERS = \
mgcp_endp.h \
mgcp_sdp.h \
mgcp_codec.h \
mgcp_ctrl.h \
mgcp_trunk.h \
debug.h \
mgcp_ratectr.h \

View File

@@ -1,24 +0,0 @@
/*
* (C) 2020 by Harald Welte <laforge@gnumonks.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
struct ctrl_handle *mgw_ctrl_interface_setup(struct mgcp_config *cfg,
const char *bind_addr, uint16_t port);

View File

@@ -50,6 +50,7 @@ enum mgcp_codecs {
CODEC_AMR_8000_1 = 112,
CODEC_AMRWB_16000_1 = 113,
CODEC_IUFP = 96,
CODEC_CLEARMODE = 120, /* 3GPP TS 48.103 table 5.4.2.2.1 */
};
/* Note: when new codec types are added, the corresponding value strings
* in mgcp_client.c (codec_table) must be updated as well. Enumerations

View File

@@ -21,7 +21,7 @@ AM_LDFLAGS = \
# This is not at all related to the release version, but a range of supported
# API versions. Read TODO_RELEASE in the source tree's root!
MGCP_CLIENT_LIBVERSION=10:0:1
MGCP_CLIENT_LIBVERSION=11:0:0
lib_LTLIBRARIES = \
libosmo-mgcp-client.la \

View File

@@ -60,6 +60,7 @@ const struct value_string osmo_mgcpc_codec_names[] = {
{ CODEC_AMR_8000_1, "AMR/8000/1" },
{ CODEC_AMRWB_16000_1, "AMR-WB/16000/1" },
{ CODEC_IUFP, "VND.3GPP.IUFP/16000" },
{ CODEC_CLEARMODE, "CLEARMODE/8000" },
{ 0, NULL },
};

View File

@@ -45,7 +45,6 @@ libosmo_mgcp_a_SOURCES = \
mgcp_stat.c \
mgcp_endp.c \
mgcp_trunk.c \
mgcp_ctrl.c \
mgcp_ratectr.c \
mgcp_e1.c \
mgcp_iuup.c \

View File

@@ -1,36 +0,0 @@
/*
* (C) 2020 by Harald Welte <laforge@gnumonks.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <osmocom/ctrl/control_if.h>
#include <osmocom/mgcp/mgcp.h>
static int mgw_ctrl_node_lookup(void *data, vector vline, int *node_type,
void **node_data, int *i)
{
return 0;
}
struct ctrl_handle *mgw_ctrl_interface_setup(struct mgcp_config *cfg,
const char *bind_addr, uint16_t port)
{
return ctrl_interface_setup_dynip2(cfg, bind_addr, port, mgw_ctrl_node_lookup,
_LAST_CTRL_NODE);
}

View File

@@ -672,7 +672,7 @@ int mgcp_conn_iuup_send_rtp(struct mgcp_conn_rtp *conn_src_rtp, struct mgcp_conn
"Bridge RTP=>IuUP: too short for AMR OA hdr (%u)\n", msgb_length(msg));
goto free_ret;
}
if (amr_hdr->ft >= AMR_FT_MAX) {
if (!osmo_amr_ft_valid(amr_hdr->ft)) {
LOG_CONN_RTP(conn_src_rtp, LOGL_NOTICE, "Bridge RTP=>IuUP: wrong AMR OA ft=%u\n", amr_hdr->ft);
goto free_ret;
}
@@ -695,7 +695,7 @@ int mgcp_conn_iuup_send_rtp(struct mgcp_conn_rtp *conn_src_rtp, struct mgcp_conn
goto free_ret;
}
ft = ((amr_bwe_hdr[0] & 0x07) << 1) | ((amr_bwe_hdr[1] & 0x80) >> 7);
if (ft >= AMR_FT_MAX) {
if (!osmo_amr_ft_valid(ft)) {
LOG_CONN_RTP(conn_src_rtp, LOGL_NOTICE, "Bridge RTP=>IuUP: wrong AMR BE ft=%u\n", ft);
goto free_ret;
}

View File

@@ -1537,12 +1537,11 @@ static int rx_rtp(struct msgb *msg)
if (!trunk->rtp_accept_all && check_rtp_origin(conn_src, from_addr))
return -1;
/* If AMR is configured for the ingress connection and conversion of the
* framing mode (octet-aligned vs. bandwith-efficient) is explicitly
* defined, then we check if the incoming payload matches that
* expectation. */
/* Handle AMR frame format conversion (octet-aligned vs. bandwith-efficient) */
if (mc->proto == MGCP_PROTO_RTP &&
mgcp_codec_amr_align_mode_is_indicated(conn_src->end.codec)) {
/* Make sure that the incoming AMR frame format matches the frame format that the call agent has
* communicated via SDP when the connection was created/modfied. */
int oa = amr_oa_check((char*)msgb_data(msg), msgb_length(msg));
if (oa < 0)
return -1;
@@ -1677,14 +1676,14 @@ int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port,
void mgcp_free_rtp_port(struct mgcp_rtp_end *end)
{
if (end->rtp.fd != -1) {
osmo_fd_unregister(&end->rtp);
close(end->rtp.fd);
end->rtp.fd = -1;
osmo_fd_unregister(&end->rtp);
}
if (end->rtcp.fd != -1) {
osmo_fd_unregister(&end->rtcp);
close(end->rtcp.fd);
end->rtcp.fd = -1;
osmo_fd_unregister(&end->rtcp);
}
}

View File

@@ -155,6 +155,7 @@ osmux_handle_alloc(const struct mgcp_trunk *trunk, const struct osmo_sockaddr *r
{
struct osmux_handle *h;
const struct mgcp_config *cfg = trunk->cfg;
char name[128] = "r=";
h = talloc_zero(trunk, struct osmux_handle);
if (!h)
@@ -167,6 +168,9 @@ osmux_handle_alloc(const struct mgcp_trunk *trunk, const struct osmo_sockaddr *r
talloc_free(h);
return NULL;
}
osmo_sockaddr_to_str_buf(name + 2, sizeof(name) - 2, rem_addr);
osmux_xfrm_input_set_name(h->in, name);
/* sequence number to start OSMUX message from */
osmux_xfrm_input_set_initial_seqnum(h->in, 0);
osmux_xfrm_input_set_batch_factor(h->in, cfg->osmux.batch_factor);
@@ -734,26 +738,46 @@ int osmux_cid_pool_count_used(void)
return used;
}
/*! take a free OSMUX cid.
/*! Find and reserve a free OSMUX cid. Keep state of last allocated CID to
* rotate allocated CIDs over time. This helps in letting CIDs unused for some
* time after last use.
* \returns OSMUX cid */
int osmux_cid_pool_get_next(void)
{
int i, j;
static uint8_t next_free_osmux_cid_lookup = 0;
uint8_t start_i, start_j;
uint8_t i, j, cid;
for (i = 0; i < sizeof(osmux_cid_bitmap); i++) {
for (j = 0; j < 8; j++) {
/* i = octet index, j = bit index inside ith octet */
start_i = next_free_osmux_cid_lookup >> 3;
start_j = next_free_osmux_cid_lookup & 0x07;
for (i = start_i; i < sizeof(osmux_cid_bitmap); i++) {
for (j = start_j; j < 8; j++) {
if (osmux_cid_bitmap[i] & (1 << j))
continue;
goto found;
}
}
osmux_cid_bitmap[i] |= (1 << j);
LOGP(DOSMUX, LOGL_DEBUG,
"Allocating Osmux CID %u from pool\n", (i * 8) + j);
return (i * 8) + j;
for (i = 0; i <= start_i; i++) {
for (j = 0; j < start_j; j++) {
if (osmux_cid_bitmap[i] & (1 << j))
continue;
goto found;
}
}
LOGP(DOSMUX, LOGL_ERROR, "All Osmux circuits are in use!\n");
return -1;
found:
osmux_cid_bitmap[i] |= (1 << j);
cid = (i << 3) | j;
next_free_osmux_cid_lookup = (cid + 1) & 0xff;
LOGP(DOSMUX, LOGL_DEBUG,
"Allocating Osmux CID %u from pool\n", cid);
return cid;
}
/*! take a specific OSMUX cid.

View File

@@ -1026,7 +1026,7 @@ mgcp_header_done:
&endp->local_options, local_options);
if (rc != 0) {
LOGPCONN(_conn, DLMGCP, LOGL_ERROR,
"CRCX: inavlid local connection options!\n");
"CRCX: invalid local connection options!\n");
error_code = rc;
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_INVALID_CONN_OPTIONS));
goto error2;

View File

@@ -41,7 +41,6 @@
#include <osmocom/mgcp/debug.h>
#include <osmocom/mgcp/mgcp_endp.h>
#include <osmocom/mgcp/mgcp_trunk.h>
#include <osmocom/mgcp/mgcp_ctrl.h>
#include <osmocom/core/application.h>
#include <osmocom/core/msgb.h>
@@ -51,7 +50,7 @@
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/socket.h>
#include <osmocom/ctrl/control_if.h>
#include <osmocom/ctrl/control_vty.h>
#include <osmocom/vty/telnet_interface.h>
@@ -83,7 +82,7 @@ static int daemonize = 0;
const char *osmomgw_copyright =
"Copyright (C) 2009-2010 Holger Freyther and On-Waves\r\n"
"Copyright (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>\r\n"
"Copyright (C) 2017-2022 by sysmocom s.f.m.c. GmbH\r\n"
"Contributions by Pablo Neira Ayuso, Jacob Erlbeck, Neels Hofmeyr\r\n"
"Philipp Maier\r\n\r\n"
"License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
@@ -366,7 +365,7 @@ int main(int argc, char **argv)
if (rc < 0)
return rc;
cfg->ctrl = mgw_ctrl_interface_setup(cfg, ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_MGW);
cfg->ctrl = ctrl_interface_setup(cfg, OSMO_CTRL_PORT_MGW, NULL);
if (!cfg->ctrl) {
fprintf(stderr, "Failed to init the control interface on %s:%u. Exiting\n",
ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_MGW);

View File

@@ -838,7 +838,7 @@ static void test_messages(void)
if (endp->local_options.pkt_period_min ||
endp->local_options.pkt_period_max)
printf
("Requested packetetization period: "
("Requested packetization period: "
"%d-%d\n",
endp->local_options.pkt_period_min,
endp->
@@ -1632,7 +1632,8 @@ static void test_osmux_cid(void)
for (i = 0; i < 256; ++i) {
id = osmux_cid_pool_get_next();
OSMO_ASSERT(id == i);
/* We called osmux_cid_pool_get_next() above, so next CID is i+1. */
OSMO_ASSERT(id == ((i + 1) & 0xff));
OSMO_ASSERT(osmux_cid_pool_count_used() == i + 1);
}