This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
Andreas Eversberg jolly at eversberg.euIn order to free RTP socket when lchan_free() or lchan_reset() is called, a signal is used between libbsc and rtp_proxy. --- openbsc/include/openbsc/signal.h | 1 + openbsc/src/libbsc/chan_alloc.c | 19 +++++++--------- openbsc/src/libmsc/Makefile.am | 3 ++- openbsc/src/{libtrau => libmsc}/rtp_proxy.c | 35 +++++++++++++++++++++++++++++ openbsc/src/libtrau/Makefile.am | 2 +- 5 files changed, 47 insertions(+), 13 deletions(-) rename openbsc/src/{libtrau => libmsc}/rtp_proxy.c (96%) diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index 39319f1..31c9187 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -105,6 +105,7 @@ enum signal_lchan { enum signal_challoc { S_CHALLOC_ALLOC_FAIL, /* allocation of lchan has failed */ S_CHALLOC_FREED, /* lchan has been successfully freed */ + S_CHALLOC_RESET, /* lchan has been reset */ }; /* SS_SUBSCR signals */ diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index 9b74329..18ffa93 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -310,13 +310,6 @@ void lchan_free(struct gsm_lchan *lchan) osmo_signal_dispatch(SS_LCHAN, S_LCHAN_UNEXPECTED_RELEASE, &sig); } - if (lchan->abis_ip.rtp_socket) { - LOGP(DRLL, LOGL_ERROR, "%s RTP Proxy Socket remained open.\n", - gsm_lchan_name(lchan)); - rtp_socket_free(lchan->abis_ip.rtp_socket); - lchan->abis_ip.rtp_socket = NULL; - } - /* stop the timer */ osmo_timer_del(&lchan->T3101); @@ -360,18 +353,22 @@ void lchan_free(struct gsm_lchan *lchan) */ void lchan_reset(struct gsm_lchan *lchan) { + struct challoc_signal_data sig; + osmo_timer_del(&lchan->T3101); osmo_timer_del(&lchan->T3109); osmo_timer_del(&lchan->T3111); osmo_timer_del(&lchan->error_timer); + memset(&sig, 0, sizeof(sig)); + sig.type = lchan->type; + lchan->type = GSM_LCHAN_NONE; lchan->state = LCHAN_S_NONE; - if (lchan->abis_ip.rtp_socket) { - rtp_socket_free(lchan->abis_ip.rtp_socket); - lchan->abis_ip.rtp_socket = NULL; - } + sig.lchan = lchan; + sig.bts = lchan->ts->trx->bts; + osmo_signal_dispatch(SS_CHALLOC, S_CHALLOC_RESET, &sig); } /* Drive the release process of the lchan */ diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am index 24db2c2..4d44a62 100644 --- a/openbsc/src/libmsc/Makefile.am +++ b/openbsc/src/libmsc/Makefile.am @@ -17,7 +17,8 @@ libmsc_a_SOURCES = auth.c \ ussd.c \ vty_interface_layer3.c \ transaction.c \ - osmo_msc.c ctrl_commands.c + osmo_msc.c ctrl_commands.c \ + rtp_proxy.c if BUILD_SMPP noinst_HEADERS = smpp_smsc.h diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libmsc/rtp_proxy.c similarity index 96% rename from openbsc/src/libtrau/rtp_proxy.c rename to openbsc/src/libmsc/rtp_proxy.c index 82d50ae..b86d228 100644 --- a/openbsc/src/libtrau/rtp_proxy.c +++ b/openbsc/src/libmsc/rtp_proxy.c @@ -36,6 +36,7 @@ #include <openbsc/rtp_proxy.h> #include <openbsc/mncc.h> #include <openbsc/trau_upqueue.h> +#include <openbsc/signal.h> /* attempt to determine byte order */ #include <sys/param.h> @@ -830,3 +831,37 @@ int rtp_socket_free(struct rtp_socket *rs) return 0; } + +static int rtp_handle_challoc_signal(unsigned int subsys, unsigned int signal, + void *handler_data, void *signal_data) +{ + struct gsm_lchan *lchan; + struct challoc_signal_data *sig; + + if (subsys != SS_CHALLOC) + return 0; + + + sig = signal_data; + if (!sig->lchan || !sig->lchan->conn) + return 0; + + lchan = sig->lchan; + + switch (signal) { + case S_CHALLOC_FREED: + case S_CHALLOC_RESET: + if (lchan->abis_ip.rtp_socket) { + rtp_socket_free(lchan->abis_ip.rtp_socket); + lchan->abis_ip.rtp_socket = NULL; + } + break; + } + + return 0; +} + +static __attribute__((constructor)) void on_dso_load_rtp_proxy(void) +{ + osmo_signal_register_handler(SS_CHALLOC, rtp_handle_challoc_signal, NULL); +} diff --git a/openbsc/src/libtrau/Makefile.am b/openbsc/src/libtrau/Makefile.am index 0c8cf17..7b71417 100644 --- a/openbsc/src/libtrau/Makefile.am +++ b/openbsc/src/libtrau/Makefile.am @@ -4,4 +4,4 @@ AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOABIS_LIBS) $(COVERA noinst_LIBRARIES = libtrau.a -libtrau_a_SOURCES = rtp_proxy.c trau_mux.c trau_upqueue.c +libtrau_a_SOURCES = trau_mux.c trau_upqueue.c -- 1.8.1.5 --------------040603060708080405050707--