Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
Oliver Smith | cb5e0bf436 | |
Oliver Smith | 1db9b60023 | |
Oliver Smith | d15ef114cc | |
Max | 460b553971 | |
Pau Espin | a9b33a40af | |
Pau Espin | b04885005b | |
Pau Espin | ab8db8fabd | |
Pau Espin | d3cd9e7afa | |
Pau Espin | 8ff216bf02 | |
Pau Espin | 9f2a584fb6 | |
Andreas Eversberg | 4bc90a6be7 | |
Harald Welte | fed4bf196a | |
Vadim Yanitskiy | b303e296b7 | |
Vadim Yanitskiy | 11b379d95a | |
Vadim Yanitskiy | be5af799c3 |
|
@ -19,7 +19,6 @@ SUBDIRS = \
|
||||||
BUILT_SOURCES = $(top_srcdir)/.version
|
BUILT_SOURCES = $(top_srcdir)/.version
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
.version \
|
.version \
|
||||||
contrib/osmo-hnodeb.spec.in \
|
|
||||||
debian \
|
debian \
|
||||||
git-version-gen \
|
git-version-gen \
|
||||||
osmoappdesc.py \
|
osmoappdesc.py \
|
||||||
|
|
|
@ -7,3 +7,5 @@
|
||||||
# If any interfaces have been added since the last public release: c:r:a + 1.
|
# 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.
|
# If any interfaces have been removed or changed since the last public release: c:r:0.
|
||||||
#library what description / commit summary line
|
#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()
|
|
@ -226,5 +226,4 @@ AC_OUTPUT(
|
||||||
doc/manuals/Makefile
|
doc/manuals/Makefile
|
||||||
contrib/Makefile
|
contrib/Makefile
|
||||||
contrib/systemd/Makefile
|
contrib/systemd/Makefile
|
||||||
contrib/osmo-hnodeb.spec
|
|
||||||
Makefile)
|
Makefile)
|
||||||
|
|
|
@ -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.4.0
|
|
||||||
BuildRequires: pkgconfig(libosmo-sigtran) >= 1.8.0
|
|
||||||
BuildRequires: pkgconfig(libosmoabis) >= 1.5.0
|
|
||||||
BuildRequires: pkgconfig(libosmotrau) >= 1.5.0
|
|
||||||
BuildRequires: pkgconfig(libosmocore) >= 1.9.0
|
|
||||||
BuildRequires: pkgconfig(libosmoctrl) >= 1.9.0
|
|
||||||
BuildRequires: pkgconfig(libosmogb) >= 1.9.0
|
|
||||||
BuildRequires: pkgconfig(libosmogsm) >= 1.9.0
|
|
||||||
BuildRequires: pkgconfig(libosmovty) >= 1.9.0
|
|
||||||
BuildRequires: pkgconfig(libosmo-hnbap) >= 1.5.0
|
|
||||||
BuildRequires: pkgconfig(libosmo-ranap) >= 1.5.0
|
|
||||||
BuildRequires: pkgconfig(libosmo-rua) >= 1.5.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
|
|
|
@ -8,6 +8,8 @@ Type=simple
|
||||||
StateDirectory=osmocom
|
StateDirectory=osmocom
|
||||||
WorkingDirectory=%S/osmocom
|
WorkingDirectory=%S/osmocom
|
||||||
Restart=always
|
Restart=always
|
||||||
|
User=osmocom
|
||||||
|
Group=osmocom
|
||||||
ExecStart=/usr/bin/osmo-hnodeb -c /etc/osmocom/osmo-hnodeb.cfg
|
ExecStart=/usr/bin/osmo-hnodeb -c /etc/osmocom/osmo-hnodeb.cfg
|
||||||
RestartSec=2
|
RestartSec=2
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
#!/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)
|
||||||
|
if dpkg --compare-versions "$2" le "0.2.0"; then
|
||||||
|
if [ -e /etc/osmocom/osmo-hnodeb.cfg ]; then
|
||||||
|
chown -v osmocom:osmocom /etc/osmocom/osmo-hnodeb.cfg
|
||||||
|
chmod -v 0660 /etc/osmocom/osmo-hnodeb.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d /etc/osmocom ]; then
|
||||||
|
chown -v root:osmocom /etc/osmocom
|
||||||
|
chmod -v 2775 /etc/osmocom
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p /var/lib/osmocom
|
||||||
|
chown -R -v osmocom:osmocom /var/lib/osmocom
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# dh_installdeb(1) will replace this with shell code automatically
|
||||||
|
# generated by other debhelper scripts.
|
||||||
|
#DEBHELPER#
|
|
@ -1,9 +1,11 @@
|
||||||
log stderr
|
log stderr
|
||||||
logging filter all 1
|
logging filter all 1
|
||||||
logging color 1
|
logging color 1
|
||||||
logging print category 1
|
|
||||||
logging print category-hex 0
|
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
|
line vty
|
||||||
no login
|
no login
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
enum hnb_shutdown_fsm_states {
|
enum hnb_shutdown_fsm_states {
|
||||||
HNB_SHUTDOWN_ST_NONE,
|
HNB_SHUTDOWN_ST_NONE,
|
||||||
|
HNB_SHUTDOWN_ST_IN_PROGRESS,
|
||||||
HNB_SHUTDOWN_ST_EXIT,
|
HNB_SHUTDOWN_ST_EXIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,11 @@ struct hnb;
|
||||||
struct rtp_conn;
|
struct rtp_conn;
|
||||||
|
|
||||||
int hnb_llsk_alloc(struct hnb *hnb);
|
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_connected(const struct hnb *hnb);
|
||||||
bool hnb_llsk_can_be_configured(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_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);
|
int ll_addr2osa(enum u_addr_type t, const union u_addr *uaddr, uint16_t port, struct osmo_sockaddr *osa);
|
||||||
|
|
|
@ -40,5 +40,6 @@ struct rtp_conn {
|
||||||
struct rtp_conn *rtp_conn_alloc(struct hnb_ue *ue);
|
struct rtp_conn *rtp_conn_alloc(struct hnb_ue *ue);
|
||||||
void rtp_conn_free(struct rtp_conn *conn);
|
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);
|
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);
|
||||||
|
|
|
@ -88,9 +88,7 @@ void hnb_free(struct hnb *hnb)
|
||||||
}
|
}
|
||||||
hnb_iuh_free(hnb);
|
hnb_iuh_free(hnb);
|
||||||
|
|
||||||
osmo_timer_del(&hnb->llsk.defer_configure_ind_timer);
|
hnb_llsk_free(hnb);
|
||||||
osmo_prim_srv_link_free(hnb->llsk.link);
|
|
||||||
hnb->llsk.link = NULL;
|
|
||||||
|
|
||||||
hnb_gtp_unbind(hnb);
|
hnb_gtp_unbind(hnb);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
static void st_none(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||||
{
|
{
|
||||||
struct hnb *hnb = (struct hnb *)fi->priv;
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case HNB_SHUTDOWN_EV_START:
|
case HNB_SHUTDOWN_EV_START:
|
||||||
/* TODO: here we may want to communicate t lower layers over UDsocket that we are shutting down...
|
hnb_shutdown_fsm_state_chg(fi, HNB_SHUTDOWN_ST_IN_PROGRESS);
|
||||||
* 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);
|
|
||||||
break;
|
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)
|
static void st_exit_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
|
||||||
{
|
{
|
||||||
struct hnb *hnb = (struct hnb *)fi->priv;
|
struct hnb *hnb = (struct hnb *)fi->priv;
|
||||||
|
@ -76,11 +90,17 @@ static struct osmo_fsm_state hnb_shutdown_fsm_states[] = {
|
||||||
.in_event_mask =
|
.in_event_mask =
|
||||||
X(HNB_SHUTDOWN_EV_START),
|
X(HNB_SHUTDOWN_EV_START),
|
||||||
.out_state_mask =
|
.out_state_mask =
|
||||||
X(HNB_SHUTDOWN_ST_EXIT),
|
X(HNB_SHUTDOWN_ST_IN_PROGRESS),
|
||||||
.name = "NONE",
|
.name = "NONE",
|
||||||
.onenter = st_none_on_enter,
|
.onenter = st_none_on_enter,
|
||||||
.action = st_none,
|
.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] = {
|
[HNB_SHUTDOWN_ST_EXIT] = {
|
||||||
.name = "EXIT",
|
.name = "EXIT",
|
||||||
.out_state_mask =
|
.out_state_mask =
|
||||||
|
|
|
@ -180,6 +180,7 @@ void hnb_iuh_alloc(struct hnb *hnb)
|
||||||
cli = osmo_stream_cli_create(hnb);
|
cli = osmo_stream_cli_create(hnb);
|
||||||
OSMO_ASSERT(cli);
|
OSMO_ASSERT(cli);
|
||||||
hnb->iuh.client = cli;
|
hnb->iuh.client = cli;
|
||||||
|
osmo_stream_cli_set_name(cli, "Iuh");
|
||||||
osmo_stream_cli_set_nodelay(cli, true);
|
osmo_stream_cli_set_nodelay(cli, true);
|
||||||
osmo_stream_cli_set_proto(cli, IPPROTO_SCTP);
|
osmo_stream_cli_set_proto(cli, IPPROTO_SCTP);
|
||||||
osmo_stream_cli_set_reconnect_timeout(cli, 5);
|
osmo_stream_cli_set_reconnect_timeout(cli, 5);
|
||||||
|
|
|
@ -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)
|
static int llsk_opened_cb(struct osmo_prim_srv *srv)
|
||||||
{
|
{
|
||||||
struct hnb *hnb = (struct hnb *)osmo_prim_srv_get_priv(srv);
|
struct hnb *hnb = (struct hnb *)osmo_prim_srv_get_priv(srv);
|
||||||
|
osmo_prim_srv_set_name(srv, "llsk");
|
||||||
|
|
||||||
if (hnb->llsk.srv) {
|
if (hnb->llsk.srv) {
|
||||||
LOGP(DLLSK, LOGL_ERROR, "New connection opened while one is already active, dropping it\n");
|
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.srv = NULL;
|
||||||
hnb->llsk.valid_sapi_mask = 0x0;
|
hnb->llsk.valid_sapi_mask = 0x0;
|
||||||
osmo_timer_del(&hnb->llsk.defer_configure_ind_timer);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +141,14 @@ bool hnb_llsk_can_be_configured(struct hnb *hnb)
|
||||||
return false;
|
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)
|
static void llsk_defer_configure_ind_timer_cb(void *data)
|
||||||
{
|
{
|
||||||
struct hnb *hnb = (struct hnb *)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);
|
hnb->llsk.link = osmo_prim_srv_link_alloc(hnb);
|
||||||
osmo_prim_srv_link_set_priv(hnb->llsk.link, 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_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_addr(hnb->llsk.link, HNB_PRIM_UD_SOCK_DEFAULT);
|
||||||
osmo_prim_srv_link_set_opened_conn_cb(hnb->llsk.link, llsk_opened_cb);
|
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);
|
osmo_timer_setup(&hnb->llsk.defer_configure_ind_timer, llsk_defer_configure_ind_timer_cb, hnb);
|
||||||
return 0;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -210,7 +210,7 @@ static int llsk_rx_audio_conn_establish_req(struct hnb *hnb, struct hnb_audio_co
|
||||||
|
|
||||||
/* Create the socket: */
|
/* Create the socket: */
|
||||||
conn = rtp_conn_alloc(ue);
|
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",
|
LOGUE(ue, DLLSK, LOGL_ERROR, "Rx AUDIO-CONN_ESTABLISH.req: Failed to set up audio socket rem_addr=%s\n",
|
||||||
rem_addrstr);
|
rem_addrstr);
|
||||||
return _send_conn_establish_cnf_failed(hnb, v0->context_id, 4);
|
return _send_conn_establish_cnf_failed(hnb, v0->context_id, 4);
|
||||||
|
|
|
@ -275,7 +275,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start listening on lower layer unix domain socket: */
|
/* 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) {
|
if (rc < 0) {
|
||||||
perror("Error opening lower layer socket");
|
perror("Error opening lower layer socket");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -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);
|
"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)
|
const struct hnb_audio_conn_establish_req_param *ce_req)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char cname[256+4];
|
char cname[256+4];
|
||||||
char name[32];
|
char name[32];
|
||||||
struct osmo_rtp_socket *rs;
|
struct osmo_rtp_socket *rs;
|
||||||
const char *local_wildcard_ipstr = "0.0.0.0";
|
|
||||||
char remote_ipstr[INET6_ADDRSTRLEN];
|
char remote_ipstr[INET6_ADDRSTRLEN];
|
||||||
uint16_t remote_port;
|
uint16_t remote_port;
|
||||||
struct osmo_iuup_rnl_prim *irp;
|
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->priv = conn;
|
||||||
rs->rx_cb = &rtp_rx_cb;
|
rs->rx_cb = &rtp_rx_cb;
|
||||||
|
|
||||||
rc = rtp_bind(hnb, rs, local_wildcard_ipstr);
|
rc = rtp_bind(hnb, rs, local_ipstr);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
LOGUE(ue, DRTP, LOGL_ERROR, "Failed to bind RTP/RTCP sockets\n");
|
LOGUE(ue, DRTP, LOGL_ERROR, "Failed to bind RTP/RTCP sockets\n");
|
||||||
goto free_ret;
|
goto free_ret;
|
||||||
}
|
}
|
||||||
conn->id = rc; /* We use local port as rtp conn ID */
|
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 */
|
/* 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);
|
snprintf(name, sizeof(name), "ue@%u-%u", conn->ue->conn_id, conn->id);
|
||||||
osmo_rtp_set_source_desc(rs, cname, name, NULL, NULL, NULL,
|
osmo_rtp_set_source_desc(rs, cname, name, NULL, NULL, NULL,
|
||||||
"OsmoHNodeB-" PACKAGE_VERSION, 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;
|
goto free_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* osmo_rtp_socket_connect() is broken, OS#5356 */
|
if (osmo_sockaddr_is_any(&conn->loc_addr)) {
|
||||||
//rc = rtp_get_bound_addr(rs, &conn->loc_addr);
|
/* osmo_rtp_socket_connect() is broken, OS#5356 */
|
||||||
rc = rtp_get_bound_addr(rs, rem_addr, &conn->loc_addr);
|
//rc = rtp_get_bound_addr(rs, &conn->loc_addr);
|
||||||
if (rc < 0) {
|
rc = rtp_get_bound_addr(rs, rem_addr, &conn->loc_addr);
|
||||||
LOGUE(ue, DRTP, LOGL_ERROR, "Cannot obtain locally bound IP/port: %d\n", rc);
|
if (rc < 0) {
|
||||||
goto free_ret;
|
LOGUE(ue, DRTP, LOGL_ERROR, "Cannot obtain locally bound IP/port: %d\n", rc);
|
||||||
|
goto free_ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now configure the IuUP layer: */
|
/* Now configure the IuUP layer: */
|
||||||
|
|
|
@ -343,7 +343,10 @@ static int config_write_hnodeb(struct vty *vty)
|
||||||
|
|
||||||
|
|
||||||
DEFUN(asn_dbg, asn_dbg_cmd,
|
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]);
|
asn_debug = atoi(argv[0]);
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,11 @@ DISTCLEANFILES = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if ENABLE_EXT_TESTS
|
if ENABLE_EXT_TESTS
|
||||||
python-tests:
|
python-tests: $(top_builddir)/src/osmo-hnodeb/osmo-hnodeb
|
||||||
echo ""
|
$(MAKE) vty-test
|
||||||
# TODO: Enable once we have a VTY/CTRL interface:
|
osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
|
||||||
# $(MAKE) vty-test
|
osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
|
||||||
# osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
|
# TODO: CTRL interface is not implemented
|
||||||
# osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
|
|
||||||
# $(srcdir)/ctrl_test_runner.py -w $(abs_top_builddir) -v
|
# $(srcdir)/ctrl_test_runner.py -w $(abs_top_builddir) -v
|
||||||
else
|
else
|
||||||
python-tests:
|
python-tests:
|
||||||
|
|
|
@ -154,7 +154,7 @@ class TestCtrlHNB(TestCtrlBase):
|
||||||
"doc/examples/osmo-hnodeb/osmo-hnodeb.cfg"]
|
"doc/examples/osmo-hnodeb/osmo-hnodeb.cfg"]
|
||||||
|
|
||||||
def ctrl_app(self):
|
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):
|
def testCtrlErrs(self):
|
||||||
r = self.do_get('invalid')
|
r = self.do_get('invalid')
|
||||||
|
|
Loading…
Reference in New Issue