Compare commits

...

27 Commits

Author SHA1 Message Date
Oliver Smith 1db9b60023 contrib: remove rpm spec file
Related: https://osmocom.org/news/255
Related: OS#6446
Change-Id: Idd67d52ca736c4e145387ea8d4030f9cf4b9596d
2024-05-08 14:40:59 +02:00
Oliver Smith d15ef114cc .deb/.rpm: various fixes related to non-root
* Explicitly chown /var/lib/osmocom to osmocom:osmocom, instead of
  relying on systemd to do it when the service starts up. This does not
  work with the systemd versions in debian 10 and almalinux 8.
* deb: Use "useradd" instead of the interactive "adduser" perl script
  from Debian. This makes it consistent with how we do it in rpm, and
  avoids the dependency on "adduser".
* deb: Consistently use tabs through the file, instead of mixing tabs
  and spaces.
* deb: Remove support for the "dpkg-statoverride --list" logic. This
  seems to be a rather obscure feature to override permissions for
  certain files or directories, for which it does not seem to be a good
  idea to make the postinst script less maintainable. Something similar
  can be achieved by using your own Osmocom config file in a different
  path with different permissions.

Related: OS#4107
Change-Id: I6dd0205fb65d4ad5a79821c111865e67fb293a73
2024-04-26 15:08:45 +02:00
Max 460b553971 .deb/.rpm: add osmocom user during package install
Create osmocom user & group during package installation.
Fix the configuration dir/files permission to match.

Related: OS#4107
Tweaked-By: Oliver Smith <osmith@sysmocom.de>
Change-Id: Ic24b43bde8d4af0641365f276106eb3cd016be2c
2024-04-24 11:52:29 +02:00
Pau Espin a9b33a40af Close LLSK during shutdown procedure
This way we notify the lower layers that state must be reset, eg. when
Iuh conn drops.

Related: OS#6826
Change-Id: I282f3e75d31b3e481136aade34b30074300ab631
2024-03-12 18:48:26 +01:00
Pau Espin b04885005b Free UE contexts when starting shutdown procedure
They are not valid anymore since the Iuh conn is closed.
If kept alive, then if GTP/RTP traffic comes from CN while shutting down
the payloads may be forwarded to LLSK which may have been closed (eg.
because shutdown procedure was started precisely due to death LLSK
because other end closed it).

Related: OS#6826
Change-Id: I51aa449e7fd5b1049fcaaeef3f1378423a838c05
2024-03-12 18:47:35 +01:00
Pau Espin ab8db8fabd llsk: Add APIs to interact with llsk->link
This also clarifies the type of available uses/features.

Change-Id: I7723467d34670f89710f55c0c6731e2e38560f35
2024-03-12 18:47:35 +01:00
Pau Espin d3cd9e7afa cosmetic: Fix typo in comment
Change-Id: Ie13952075be29201751d5b7884ca572a285ca9dd
2024-03-12 17:42:56 +01:00
Pau Espin 8ff216bf02 Name llsk prim_srv{_link}
This allows easily identifying the prim_srv{_link} in logs.

Depends: libosmo-netif.git Change-Id Iba683e4d65e0aba81e13bdf1b9d5a9065b1fc89c
Change-Id: Idae27bc9a2a223710edb9fca905ad5ae924dde80
2024-03-12 12:25:55 +01:00
Pau Espin 9f2a584fb6 iuh: Name stream_cli connection
This makes it easier to figure out the conn log lines.

Change-Id: I1503b322f8ff053088688b3088a70801d10b3d88
2024-03-12 12:03:16 +01:00
Andreas Eversberg 4bc90a6be7 Use uniform log format for default config files
Related: OS#6272
Change-Id: I239229c0f23f70a75155ca8790b51a7c39acca21
2023-12-01 12:47:33 +01:00
Harald Welte fed4bf196a Use 'iuh/local-ip' as local IP for RTP sockets
Don't use the wildcard IPv4 address for RTP sockets, but instead use
the address explicitly configured by the user for the Iuh interface.

Closes: SYS#6657
Change-Id: I90e2cbb1765d4d2db5a19f64f0ff09cdc18b7911
Depends: libosmocore.git Change-Id I6b5c0bf8ca97e6358d992fb2ff45ffd53ba15197
2023-11-21 19:53:02 +01:00
Vadim Yanitskiy b303e296b7 tests: enable commented-out 'python-tests' target
Keep the last line running the CTRL tests commented out as the
CTRL interface is not implemented yet.  Add a TODO.

Change-Id: I76e24184aecafa8460d1da9419a424d9990730c5
Related: OS#5989
2023-11-03 14:47:59 +07:00
Vadim Yanitskiy 11b379d95a tests/ctrl_test_runner.py: fix wrong CTRL port
Change-Id: I88432b77dae923df373055a657a77838268a32e1
Related: OS#5989
2023-11-03 14:47:57 +07:00
Vadim Yanitskiy be5af799c3 vty: fix incomplete docs for 'asn-debug' command
Change-Id: I7174e1833be206a62afd95ddc27e9d912a7efcfc
Related: OS#5989
2023-10-30 15:38:55 +07:00
Pau Espin 4f7362272f Bump version: 0.1.1.8-6968-dirty → 0.1.2
Change-Id: Ib6cba818c589f7c280827311de7e4e5568714f2a
2023-09-12 17:22:11 +02:00
Pau Espin 69682c8deb rua: Fix null ptr access in hnb->llsk.srv
At startup, osmo-hnodeb connects the Iuh socket to the HNBGW, and start
the LLSK unix socket link_server waiting for lower layers to connect.
If for some reason the lower layers don't connect and an Iuh messages
arrives which was to be forwarded to LLSK, it would try to access it
without first checking if it was already available.
This patch adds a check to avoid a crash when accessing the null
pointer.

Change-Id: I32d8f91b2fc5401ace386e1085c248476228cd18
2023-07-25 11:27:59 +02:00
Oliver Smith 4d94531f6f systemd: depend on networking-online.target
Related: SYS#6400
Change-Id: Ib6c78c76c5f13b9482428ce653a61b03b2aca1d3
2023-05-26 14:10:45 +02:00
Vadim Yanitskiy b4a5d3d9a8 copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
Change-Id: I9ad500784d1c99cc764b38729ac0d86ab8441379
2023-05-18 18:46:29 +07:00
Oliver Smith eee4534364 debian: set compat level to 10
Related: OS#5958
Change-Id: I5d26ab03aacf3b8ef8c1c4c669c12090fd0b7899
2023-04-25 16:48:23 +02:00
Vadim Yanitskiy a2aa6b19b2 tests: do not depend on undefined $(BUILT_SOURCES)
Change-Id: I43c78aac0d23274d2a9bb01021cde0371c231be2
2023-03-30 03:02:45 +07:00
Vadim Yanitskiy 54899f76b0 tests: make 'vty-test' target depend on the respective binary
Change-Id: I53ff9a1659a0e25a6c3a5bc987dbae82d0312259
2023-03-30 03:01:22 +07:00
Vadim Yanitskiy 9b356e1c5c build: remove $(COVERAGE_LDFLAGS) from osmo_hnodeb_LDADD
Change-Id: Id088775f444640df863c346b225c1bae61725249
2023-03-30 03:00:24 +07:00
arehbein ad5981352b Transition to use of 'telnet_init_default'
Related: OS#5809
Change-Id: Icc57c68337d55c6594c1c36e9bf41624d11dab0a
2023-02-25 17:48:58 +01:00
Pau Espin 69f91b1773 Bump version: 0.1.0.3-1bad-dirty → 0.1.1
Change-Id: I6c1170506c76b794fd4e762b64adf63a039053ca
2023-02-07 18:03:49 +01:00
Oliver Smith 1bad165c69 contrib/jenkins.sh: use --enable-werror
Fixes: OS#5290
Change-Id: Ic32464b9a52a5de4ee81fc3a4dbb5717b3b43e39
2022-11-15 12:40:36 +01:00
Max 9c2c2654ba Set working directory in systemd service file
By default systemd will execute service with root directory (or home directory for user instance) which might result in
attempts to create files in unexpected place. Let's set it to 'osmocom' subdir of state directory (/var/lib for system instance) instead.

Related: OS#4821
Change-Id: I67564759f43193f4739b0b194d5f5da92e3bc6ae
2022-08-30 19:51:47 +07:00
Vadim Yanitskiy f74f944784 configure.ac: do not require unused dlopen
Change-Id: Idd4a816babcfb2e2302fbd21cb48989659940d5c
2022-08-19 20:29:35 +07:00
27 changed files with 198 additions and 167 deletions

View File

@ -19,7 +19,6 @@ SUBDIRS = \
BUILT_SOURCES = $(top_srcdir)/.version
EXTRA_DIST = \
.version \
contrib/osmo-hnodeb.spec.in \
debian \
git-version-gen \
osmoappdesc.py \

View File

@ -7,3 +7,5 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
libosmocore depend >= 1.9.0 we need osmo_sockaddr_from_str_and_uint()
libosmo-netif depend > 1.4.0 osmo_prim_srv{_link}_set_name()

View File

@ -37,8 +37,6 @@ fi
PKG_PROG_PKG_CONFIG([0.20])
dnl checks for libraries
AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
AC_SUBST(LIBRARY_DL)
old_LIBS=$LIBS
AC_SEARCH_LIBS([sctp_recvmsg], [sctp], [
AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support])
@ -51,17 +49,17 @@ AC_SEARCH_LIBS([sctp_recvmsg], [sctp], [
LIBS=$old_LIBS
PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.30)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.2.0)
PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.6.0)
PKG_CHECK_MODULES(LIBOSMORUA, libosmo-rua >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOHNBAP, libosmo-hnbap >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.4.0)
PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.8.0)
PKG_CHECK_MODULES(LIBOSMORUA, libosmo-rua >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOHNBAP, libosmo-hnbap >= 1.5.0)
dnl checks for header files
@ -228,5 +226,4 @@ AC_OUTPUT(
doc/manuals/Makefile
contrib/Makefile
contrib/systemd/Makefile
contrib/osmo-hnodeb.spec
Makefile)

View File

@ -52,7 +52,7 @@ set -x
cd "$base"
autoreconf --install --force
./configure --enable-sanitize --enable-external-tests $CONFIG
./configure --enable-sanitize --enable-external-tests --enable-werror $CONFIG
$MAKE $PARALLEL_MAKE
LD_LIBRARY_PATH="$inst/lib" $MAKE check \
|| cat-testlogs.sh

View File

@ -1,97 +0,0 @@
#
# spec file for package osmo-hnodeb
#
# Copyright (c) 2017, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
## Disable LTO for now since it breaks compilation of the tests
## https://osmocom.org/issues/4113
%define _lto_cflags %{nil}
Name: osmo-hnodeb
Version: @VERSION@
Release: 0
Summary: Osmohnodeb: Osmocom's Base Station Controller for 2G CS mobile networks
License: AGPL-3.0-or-later AND GPL-2.0-or-later
Group: Hardware/Mobile
URL: https://osmocom.org/projects/osmohnodeb
Source: %{name}-%{version}.tar.xz
BuildRequires: autoconf-archive
BuildRequires: automake >= 1.9
BuildRequires: libtool >= 2
BuildRequires: lksctp-tools-devel
BuildRequires: pkgconfig >= 0.20
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: pkgconfig(libcrypto) >= 0.9.5
BuildRequires: pkgconfig(libosmo-netif) >= 1.2.0
BuildRequires: pkgconfig(libosmo-sigtran) >= 1.6.0
BuildRequires: pkgconfig(libosmoabis) >= 1.3.0
BuildRequires: pkgconfig(libosmotrau) >= 1.3.0
BuildRequires: pkgconfig(libosmocore) >= 1.7.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.7.0
BuildRequires: pkgconfig(libosmogb) >= 1.7.0
BuildRequires: pkgconfig(libosmogsm) >= 1.7.0
BuildRequires: pkgconfig(libosmovty) >= 1.7.0
BuildRequires: pkgconfig(libosmo-hnbap) >= 1.3.0
BuildRequires: pkgconfig(libosmo-ranap) >= 1.3.0
BuildRequires: pkgconfig(libosmo-rua) >= 1.3.0
BuildRequires: pkgconfig(talloc)
BuildRequires: pkgconfig(libasn1c) >= 0.9.30
%{?systemd_requires}
%description
OsmoHNodeB: Osmocom's Home NodeB for 3G mobile networks.
%prep
%setup -q
%build
echo "%{version}" >.tarball-version
autoreconf -fi
%configure \
--docdir=%{_docdir}/%{name} \
--with-systemdsystemunitdir=%{_unitdir}
make %{?_smp_mflags}
%install
%make_install
%if 0%{?suse_version}
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%endif
%check
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
%files
%license COPYING
%doc AUTHORS README.md
%{_bindir}/osmo-hnodeb
%dir %{_docdir}/%{name}/examples
%dir %{_docdir}/%{name}/examples/osmo-hnodeb
%{_docdir}/%{name}/examples/osmo-hnodeb/osmo-hnodeb.cfg
%dir %{_sysconfdir}/osmocom
%config(noreplace) %{_sysconfdir}/osmocom/osmo-hnodeb.cfg
%{_unitdir}/%{name}.service
%changelog

View File

@ -1,9 +1,15 @@
[Unit]
Description=Osmocom Home NodeB (hNodeB)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Restart=always
User=osmocom
Group=osmocom
ExecStart=/usr/bin/osmo-hnodeb -c /etc/osmocom/osmo-hnodeb.cfg
RestartSec=2

33
debian/changelog vendored
View File

@ -1,3 +1,36 @@
osmo-hnodeb (0.1.2) unstable; urgency=medium
[ arehbein ]
* Transition to use of 'telnet_init_default'
[ Vadim Yanitskiy ]
* build: remove $(COVERAGE_LDFLAGS) from osmo_hnodeb_LDADD
* tests: make 'vty-test' target depend on the respective binary
* tests: do not depend on undefined $(BUILT_SOURCES)
* copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
[ Oliver Smith ]
* debian: set compat level to 10
* systemd: depend on networking-online.target
[ Pau Espin Pedrol ]
* rua: Fix null ptr access in hnb->llsk.srv
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 12 Sep 2023 17:22:10 +0200
osmo-hnodeb (0.1.1) unstable; urgency=medium
[ Vadim Yanitskiy ]
* configure.ac: do not require unused dlopen
[ Max ]
* Set working directory in systemd service file
[ Oliver Smith ]
* contrib/jenkins.sh: use --enable-werror
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 07 Feb 2023 18:03:48 +0100
osmo-hnodeb (0.1.0) unstable; urgency=medium
[ Pau Espin Pedrol ]

2
debian/compat vendored
View File

@ -1 +1 @@
9
10

18
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: osmo-hnodeb
Section: net
Priority: extra
Maintainer: Osmocom team <openbsc@lists.osmocom.org>
Build-Depends: debhelper (>=9),
Build-Depends: debhelper (>= 10),
dh-autoreconf,
autotools-dev,
autoconf,
@ -14,14 +14,14 @@ Build-Depends: debhelper (>=9),
libtalloc-dev,
libasn1c-dev (>= 0.9.30),
libsctp-dev,
libosmocore-dev (>= 1.7.0),
libosmo-sigtran-dev (>= 1.6.0),
libosmo-abis-dev (>= 1.3.0),
libosmo-netif-dev (>= 1.2.0),
libosmo-hnbap-dev (>= 1.3.0),
libosmo-ranap-dev (>= 1.3.0),
libosmo-rua-dev (>= 1.3.0),
osmo-gsm-manuals-dev (>= 1.3.0)
libosmocore-dev (>= 1.9.0),
libosmo-sigtran-dev (>= 1.8.0),
libosmo-abis-dev (>= 1.5.0),
libosmo-netif-dev (>= 1.4.0),
libosmo-hnbap-dev (>= 1.5.0),
libosmo-ranap-dev (>= 1.5.0),
libosmo-rua-dev (>= 1.5.0),
osmo-gsm-manuals-dev (>= 1.5.0)
Standards-Version: 3.9.8
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-hnodeb
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-hnodeb

30
debian/postinst vendored Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh -e
case "$1" in
configure)
# Create the osmocom group and user (if it doesn't exist yet)
if ! getent group osmocom >/dev/null; then
groupadd --system osmocom
fi
if ! getent passwd osmocom >/dev/null; then
useradd \
--system \
--gid osmocom \
--home-dir /var/lib/osmocom \
--shell /sbin/nologin \
--comment "Open Source Mobile Communications" \
osmocom
fi
# Fix permissions of previous (root-owned) install (OS#4107)
chown osmocom:osmocom /etc/osmocom/osmo-hnodeb.cfg
chmod 0660 /etc/osmocom/osmo-hnodeb.cfg
chown root:osmocom /etc/osmocom
chmod 2775 /etc/osmocom
mkdir -p /var/lib/osmocom
chown -R osmocom:osmocom /var/lib/osmocom
;;
esac
# dh_installdeb(1) will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#

View File

@ -1,9 +1,11 @@
log stderr
logging filter all 1
logging color 1
logging print category 1
logging print category-hex 0
logging timestamp 1
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
!
line vty
no login

View File

@ -1,6 +1,6 @@
/* hNodeB shutdown FSM */
/* (C) 2021 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* Author: Pau Espin Pedrol <pespin@sysmocom.de>
*
* All Rights Reserved
@ -28,6 +28,7 @@
enum hnb_shutdown_fsm_states {
HNB_SHUTDOWN_ST_NONE,
HNB_SHUTDOWN_ST_IN_PROGRESS,
HNB_SHUTDOWN_ST_EXIT,
};

View File

@ -30,8 +30,11 @@ struct hnb;
struct rtp_conn;
int hnb_llsk_alloc(struct hnb *hnb);
void hnb_llsk_free(struct hnb *hnb);
int hnb_llsk_start_listen(struct hnb *hnb);
bool hnb_llsk_connected(const struct hnb *hnb);
bool hnb_llsk_can_be_configured(struct hnb *hnb);
void hnb_llsk_close_conn(const struct hnb *hnb);
int ll_addr_type2af(enum u_addr_type t);
int ll_addr2osa(enum u_addr_type t, const union u_addr *uaddr, uint16_t port, struct osmo_sockaddr *osa);

View File

@ -40,5 +40,6 @@ struct rtp_conn {
struct rtp_conn *rtp_conn_alloc(struct hnb_ue *ue);
void rtp_conn_free(struct rtp_conn *conn);
int rtp_conn_setup(struct rtp_conn *conn, const struct osmo_sockaddr *rem_addr, const struct hnb_audio_conn_establish_req_param *ce_req);
int rtp_conn_setup(struct rtp_conn *conn, const char *local_ipstr, const struct osmo_sockaddr *rem_addr,
const struct hnb_audio_conn_establish_req_param *ce_req);
int rtp_conn_tx_data(struct rtp_conn *conn, uint8_t frame_nr, uint8_t fqc, uint8_t rfci, const uint8_t *data, unsigned int data_len);

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# (C) 2021 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
# (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or

View File

@ -54,7 +54,6 @@ osmo_hnodeb_LDADD = \
$(LIBOSMOVTY_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMONETIF_LIBS) \
$(COVERAGE_LDFLAGS) \
$(LIBOSMOABIS_LIBS) \
$(LIBOSMOTRAU_LIBS) \
$(LIBOSMOSIGTRAN_LIBS) \

View File

@ -88,9 +88,7 @@ void hnb_free(struct hnb *hnb)
}
hnb_iuh_free(hnb);
osmo_timer_del(&hnb->llsk.defer_configure_ind_timer);
osmo_prim_srv_link_free(hnb->llsk.link);
hnb->llsk.link = NULL;
hnb_llsk_free(hnb);
hnb_gtp_unbind(hnb);

View File

@ -1,6 +1,6 @@
/* hNodeB shutdown FSM */
/* (C) 2021 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* Author: Pau Espin Pedrol <pespin@sysmocom.de>
*
* All Rights Reserved
@ -44,21 +44,35 @@ static void st_none_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
static void st_none(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct hnb *hnb = (struct hnb *)fi->priv;
switch (event) {
case HNB_SHUTDOWN_EV_START:
/* TODO: here we may want to communicate t lower layers over UDsocket that we are shutting down...
* TODO: Also, if Iuh link is still up, maybe send a Hnb deregister req towards HNBGW
* TODO: also signal the hnb object somehow that we are starting to shut down?
*/
if (osmo_stream_cli_is_connected(hnb->iuh.client))
osmo_stream_cli_close(hnb->iuh.client);
hnb_shutdown_fsm_state_chg(fi, HNB_SHUTDOWN_ST_EXIT);
hnb_shutdown_fsm_state_chg(fi, HNB_SHUTDOWN_ST_IN_PROGRESS);
break;
}
}
static void st_in_progress_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
struct hnb *hnb = (struct hnb *)fi->priv;
struct hnb_ue *ue, *ue_tmp;
/* TODO: Also, if Iuh link is still up, maybe send a Hnb deregister req towards HNBGW */
/* Drop active UE contexts, together with their GTP/AUDIO sessions: */
llist_for_each_entry_safe(ue, ue_tmp, &hnb->ue_list, list)
hnb_ue_free(ue);
if (osmo_stream_cli_is_connected(hnb->iuh.client))
osmo_stream_cli_close(hnb->iuh.client);
/* Close LLSK to notify lower layers that we are shutting down
* even if we are not exiting the process. */
if (hnb_llsk_connected(hnb))
hnb_llsk_close_conn(hnb);
hnb_shutdown_fsm_state_chg(fi, HNB_SHUTDOWN_ST_EXIT);
}
static void st_exit_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
struct hnb *hnb = (struct hnb *)fi->priv;
@ -76,11 +90,17 @@ static struct osmo_fsm_state hnb_shutdown_fsm_states[] = {
.in_event_mask =
X(HNB_SHUTDOWN_EV_START),
.out_state_mask =
X(HNB_SHUTDOWN_ST_EXIT),
X(HNB_SHUTDOWN_ST_IN_PROGRESS),
.name = "NONE",
.onenter = st_none_on_enter,
.action = st_none,
},
[HNB_SHUTDOWN_ST_IN_PROGRESS] = {
.out_state_mask =
X(HNB_SHUTDOWN_ST_EXIT),
.name = "IN_PROGRESS",
.onenter = st_in_progress_on_enter,
},
[HNB_SHUTDOWN_ST_EXIT] = {
.name = "EXIT",
.out_state_mask =

View File

@ -180,6 +180,7 @@ void hnb_iuh_alloc(struct hnb *hnb)
cli = osmo_stream_cli_create(hnb);
OSMO_ASSERT(cli);
hnb->iuh.client = cli;
osmo_stream_cli_set_name(cli, "Iuh");
osmo_stream_cli_set_nodelay(cli, true);
osmo_stream_cli_set_proto(cli, IPPROTO_SCTP);
osmo_stream_cli_set_reconnect_timeout(cli, 5);

View File

@ -85,6 +85,7 @@ enum u_addr_type osa2_ll_addr(const struct osmo_sockaddr *osa, union u_addr *uad
static int llsk_opened_cb(struct osmo_prim_srv *srv)
{
struct hnb *hnb = (struct hnb *)osmo_prim_srv_get_priv(srv);
osmo_prim_srv_set_name(srv, "llsk");
if (hnb->llsk.srv) {
LOGP(DLLSK, LOGL_ERROR, "New connection opened while one is already active, dropping it\n");
@ -112,7 +113,12 @@ static int llsk_closed_cb(struct osmo_prim_srv *srv)
hnb->llsk.srv = NULL;
hnb->llsk.valid_sapi_mask = 0x0;
osmo_timer_del(&hnb->llsk.defer_configure_ind_timer);
hnb_shutdown(hnb, "LLSK conn dropped", false);
/* We actively close the llsk conn during hnb_shutdown, no need to
* re-enter shutdown procedure thin that case: */
if (!hnb_shutdown_in_progress(hnb))
hnb_shutdown(hnb, "LLSK conn dropped", false);
return 0;
}
@ -135,6 +141,14 @@ bool hnb_llsk_can_be_configured(struct hnb *hnb)
return false;
}
void hnb_llsk_close_conn(const struct hnb *hnb)
{
if (!hnb_llsk_connected(hnb))
return;
osmo_prim_srv_close(hnb->llsk.srv);
/* pointer NULLed in llsk_closed_cb() */
}
static void llsk_defer_configure_ind_timer_cb(void *data)
{
struct hnb *hnb = (struct hnb *)data;
@ -208,6 +222,7 @@ int hnb_llsk_alloc(struct hnb *hnb)
{
hnb->llsk.link = osmo_prim_srv_link_alloc(hnb);
osmo_prim_srv_link_set_priv(hnb->llsk.link, hnb);
osmo_prim_srv_link_set_name(hnb->llsk.link, "llsk-link");
osmo_prim_srv_link_set_log_category(hnb->llsk.link, DLLSK);
osmo_prim_srv_link_set_addr(hnb->llsk.link, HNB_PRIM_UD_SOCK_DEFAULT);
osmo_prim_srv_link_set_opened_conn_cb(hnb->llsk.link, llsk_opened_cb);
@ -217,3 +232,15 @@ int hnb_llsk_alloc(struct hnb *hnb)
osmo_timer_setup(&hnb->llsk.defer_configure_ind_timer, llsk_defer_configure_ind_timer_cb, hnb);
return 0;
}
void hnb_llsk_free(struct hnb *hnb)
{
osmo_timer_del(&hnb->llsk.defer_configure_ind_timer);
osmo_prim_srv_link_free(hnb->llsk.link);
hnb->llsk.link = NULL;
}
int hnb_llsk_start_listen(struct hnb *hnb)
{
return osmo_prim_srv_link_open(g_hnb->llsk.link);
}

View File

@ -210,7 +210,7 @@ static int llsk_rx_audio_conn_establish_req(struct hnb *hnb, struct hnb_audio_co
/* Create the socket: */
conn = rtp_conn_alloc(ue);
if ((rc = rtp_conn_setup(conn, &rem_osa, ce_req)) < 0) {
if ((rc = rtp_conn_setup(conn, hnb->iuh.local_addr, &rem_osa, ce_req)) < 0) {
LOGUE(ue, DLLSK, LOGL_ERROR, "Rx AUDIO-CONN_ESTABLISH.req: Failed to set up audio socket rem_addr=%s\n",
rem_addrstr);
return _send_conn_establish_cnf_failed(hnb, v0->context_id, 4);

View File

@ -268,14 +268,14 @@ int main(int argc, char **argv)
exit(1);
}
rc = telnet_init_dynif(tall_hnb_ctx, g_hnb, vty_get_bind_addr(), OSMO_VTY_PORT_HNODEB);
rc = telnet_init_default(tall_hnb_ctx, g_hnb, OSMO_VTY_PORT_HNODEB);
if (rc < 0) {
perror("Error binding VTY port");
exit(1);
}
/* Start listening on lower layer unix domain socket: */
rc = osmo_prim_srv_link_open(g_hnb->llsk.link);
rc = hnb_llsk_start_listen(g_hnb);
if (rc < 0) {
perror("Error opening lower layer socket");
exit(1);

View File

@ -263,14 +263,13 @@ static void rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl,
"Failed passing rx rtp up to IuUP layer: %d\n", rc);
}
int rtp_conn_setup(struct rtp_conn *conn, const struct osmo_sockaddr *rem_addr,
int rtp_conn_setup(struct rtp_conn *conn, const char *local_ipstr, const struct osmo_sockaddr *rem_addr,
const struct hnb_audio_conn_establish_req_param *ce_req)
{
int rc;
char cname[256+4];
char name[32];
struct osmo_rtp_socket *rs;
const char *local_wildcard_ipstr = "0.0.0.0";
char remote_ipstr[INET6_ADDRSTRLEN];
uint16_t remote_port;
struct osmo_iuup_rnl_prim *irp;
@ -305,15 +304,16 @@ int rtp_conn_setup(struct rtp_conn *conn, const struct osmo_sockaddr *rem_addr,
rs->priv = conn;
rs->rx_cb = &rtp_rx_cb;
rc = rtp_bind(hnb, rs, local_wildcard_ipstr);
rc = rtp_bind(hnb, rs, local_ipstr);
if (rc < 0) {
LOGUE(ue, DRTP, LOGL_ERROR, "Failed to bind RTP/RTCP sockets\n");
goto free_ret;
}
conn->id = rc; /* We use local port as rtp conn ID */
osmo_sockaddr_from_str_and_uint(&conn->loc_addr, local_ipstr, rc);
/* Ensure RTCP SDES contains some useful information */
snprintf(cname, sizeof(cname), "hnb@%s", local_wildcard_ipstr);
snprintf(cname, sizeof(cname), "hnb@%s", local_ipstr);
snprintf(name, sizeof(name), "ue@%u-%u", conn->ue->conn_id, conn->id);
osmo_rtp_set_source_desc(rs, cname, name, NULL, NULL, NULL,
"OsmoHNodeB-" PACKAGE_VERSION, NULL);
@ -324,12 +324,14 @@ int rtp_conn_setup(struct rtp_conn *conn, const struct osmo_sockaddr *rem_addr,
goto free_ret;
}
/* osmo_rtp_socket_connect() is broken, OS#5356 */
//rc = rtp_get_bound_addr(rs, &conn->loc_addr);
rc = rtp_get_bound_addr(rs, rem_addr, &conn->loc_addr);
if (rc < 0) {
LOGUE(ue, DRTP, LOGL_ERROR, "Cannot obtain locally bound IP/port: %d\n", rc);
goto free_ret;
if (osmo_sockaddr_is_any(&conn->loc_addr)) {
/* osmo_rtp_socket_connect() is broken, OS#5356 */
//rc = rtp_get_bound_addr(rs, &conn->loc_addr);
rc = rtp_get_bound_addr(rs, rem_addr, &conn->loc_addr);
if (rc < 0) {
LOGUE(ue, DRTP, LOGL_ERROR, "Cannot obtain locally bound IP/port: %d\n", rc);
goto free_ret;
}
}
/* Now configure the IuUP layer: */

View File

@ -115,6 +115,11 @@ static void hnb_rua_cl_handle(struct hnb *hnb, ANY_t *in)
ranap_buf_len = ies.ranaP_Message.size;
LOGP(DRUA, LOGL_DEBUG, "Rx RUA UDT ranap_len=%zu\n", ranap_buf_len);
if (!hnb->llsk.srv) {
LOGP(DRUA, LOGL_NOTICE, "Discarding rx RUA UDT ranap_len=%zu due to lower layers not available\n",
ranap_buf_len);
goto free_ret;
}
LOGP(DLLSK, LOGL_DEBUG, "Tx IUH-UNITDATA.ind ranap_len=%zu\n", ranap_buf_len);
iuh_prim = hnb_iuh_makeprim_unitdata_ind(ranap_buf, ranap_buf_len);

View File

@ -343,7 +343,10 @@ static int config_write_hnodeb(struct vty *vty)
DEFUN(asn_dbg, asn_dbg_cmd,
"asn-debug (1|0)", "Enable or disable libasn1c debugging")
"asn-debug (1|0)",
"Enable or disable libasn1c debugging\n"
"Enable libasn1c debugging\n"
"Disable libasn1c debugging\n")
{
asn_debug = atoi(argv[0]);

View File

@ -34,15 +34,14 @@ DISTCLEANFILES = \
$(NULL)
if ENABLE_EXT_TESTS
python-tests: $(BUILT_SOURCES)
echo ""
# TODO: Enable once we have a VTY/CTRL interface:
# $(MAKE) vty-test
# osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
# osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
python-tests: $(top_builddir)/src/osmo-hnodeb/osmo-hnodeb
$(MAKE) vty-test
osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
# TODO: CTRL interface is not implemented
# $(srcdir)/ctrl_test_runner.py -w $(abs_top_builddir) -v
else
python-tests: $(BUILT_SOURCES)
python-tests:
echo "Not running python-based tests (determined at configure-time)"
endif
@ -52,7 +51,7 @@ VTY_TEST ?= *.vty
# To update the VTY script from current application behavior,
# pass -u to vty_script_runner.py by doing:
# make vty-test U=-u
vty-test:
vty-test: $(top_builddir)/src/osmo-hnodeb/osmo-hnodeb
osmo_verify_transcript_vty.py -v \
-n OsmoHNodeB -p 4273 \
-r "$(top_builddir)/src/osmo-hnodeb/osmo-hnodeb -c $(top_srcdir)/doc/examples/osmo-hnodeb/osmo-hnodeb.cfg" \

View File

@ -154,7 +154,7 @@ class TestCtrlHNB(TestCtrlBase):
"doc/examples/osmo-hnodeb/osmo-hnodeb.cfg"]
def ctrl_app(self):
return (4249, "./src/osmo-hnodeb/osmo-hnodeb", "OsmoHNodeB", "hnb")
return (4274, "./src/osmo-hnodeb/osmo-hnodeb", "OsmoHNodeB", "hnb")
def testCtrlErrs(self):
r = self.do_get('invalid')