Hello community, here is the log from the commit of package libosmo-abis for openSUSE:Factory checked in at 2019-08-22 10:49:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libosmo-abis (Old) and /work/SRC/openSUSE:Factory/.libosmo-abis.new.22127 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libosmo-abis" Thu Aug 22 10:49:50 2019 rev:10 rq:723411 version:0.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libosmo-abis/libosmo-abis.changes 2019-02-01 11:44:52.704587427 +0100 +++ /work/SRC/openSUSE:Factory/.libosmo-abis.new.22127/libosmo-abis.changes 2019-08-22 10:49:56.753719424 +0200 @@ -1,0 +2,7 @@ +Thu Aug 15 04:29:02 UTC 2019 - Jan Engelhardt <[email protected]> + +- Update to new upstream release 0.7.0 + * ipaccess: allow TCP keepalive for IPA clients + * Add IPA keep-alive FSM implementation + +------------------------------------------------------------------- Old: ---- libosmo-abis-0.6.0.tar.xz New: ---- libosmo-abis-0.7.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libosmo-abis.spec ++++++ --- /var/tmp/diff_new_pack.ppsF2l/_old 2019-08-22 10:49:57.209719363 +0200 +++ /var/tmp/diff_new_pack.ppsF2l/_new 2019-08-22 10:49:57.213719362 +0200 @@ -12,19 +12,19 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # -%define version_unconverted 0.6.0 +%define version_unconverted 0.7.0 Name: libosmo-abis -Version: 0.6.0 +Version: 0.7.0 Release: 0 Summary: Osmocom library for A-bis interface between BTS and BSC License: AGPL-3.0-or-later AND GPL-2.0-or-later Group: Productivity/Telephony/Utilities -Url: https://osmocom.org/projects/libosmo-abis/wiki/Libosmo-abis +URL: https://osmocom.org/projects/libosmo-abis/wiki/Libosmo-abis Source: %name-%version.tar.xz Patch1: osmo-talloc.diff ++++++ _service ++++++ --- /var/tmp/diff_new_pack.ppsF2l/_old 2019-08-22 10:49:57.245719358 +0200 +++ /var/tmp/diff_new_pack.ppsF2l/_new 2019-08-22 10:49:57.245719358 +0200 @@ -2,8 +2,8 @@ <service name="tar_scm" mode="disabled"> <param name="scm">git</param> <param name="url">git://git.osmocom.org/libosmo-abis</param> - <param name="parent-tag">0.6.0</param> - <param name="versionformat">0.6.0</param> + <param name="parent-tag">0.7.0</param> + <param name="versionformat">0.7.0</param> </service> <service name="recompress" mode="disabled"> <param name="file">*.tar</param> ++++++ libosmo-abis-0.6.0.tar.xz -> libosmo-abis-0.7.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/contrib/jenkins.sh new/libosmo-abis-0.7.0/contrib/jenkins.sh --- old/libosmo-abis-0.6.0/contrib/jenkins.sh 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/contrib/jenkins.sh 2019-07-21 21:32:08.000000000 +0200 @@ -37,5 +37,6 @@ $MAKE $PARALLEL_MAKE $MAKE distcheck \ || cat-testlogs.sh +$MAKE maintainer-clean osmo-clean-workspace.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/debian/changelog new/libosmo-abis-0.7.0/debian/changelog --- old/libosmo-abis-0.6.0/debian/changelog 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/debian/changelog 2019-07-21 21:32:08.000000000 +0200 @@ -1,3 +1,33 @@ +libosmo-abis (0.7.0) unstable; urgency=medium + + [ Max ] + * Set local IP in ipa_server_link properly + * Log peer's port in accept callback + + [ Harald Welte ] + * ipa: Make ipa_server_conn_destroy() re-entrant + * Add IPA keep-alive FSM implementation + * ipa_keepalive_fsm: Fix OSMO_IPA_KA_E_STOP allstate event + * ipa_keepalive_fsm: Suppress error messages for INIT -> INIT transition + * ipaccess.c: Avoid calling close(-1) on error path + + [ Oliver Smith ] + * tests: use -no-install libtool flag to avoid ./lt-* scripts + * contrib/jenkins.sh: run "make maintainer-clean" + + [ Sylvain Munaut ] + * rtp: Add 'autoconnect' feature to the osmo_rtp_socket + + [ Eric Wild ] + * ipaccess: allow tcp keepalive for ipa clients + * add TCP_USER_TIMEOUT to keepalive + * extend the ipa keepalive fsm + + [ Debian Mobcom Maintainers ] + * spelling + + -- Harald Welte <[email protected]> Sun, 21 Jul 2019 21:32:08 +0200 + libosmo-abis (0.6.0) unstable; urgency=medium [ Neels Hofmeyr ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/include/osmocom/abis/ipa.h new/libosmo-abis-0.7.0/include/osmocom/abis/ipa.h --- old/libosmo-abis-0.6.0/include/osmocom/abis/ipa.h 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/include/osmocom/abis/ipa.h 2019-07-21 21:32:08.000000000 +0200 @@ -5,6 +5,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/timer.h> #include <osmocom/core/select.h> +#include <osmocom/core/fsm.h> #include <osmocom/gsm/ipa.h> struct e1inp_line; @@ -99,4 +100,43 @@ void ipa_msg_push_header(struct msgb *msg, uint8_t proto); + +/*********************************************************************** + * IPA Keep-Alive FSM + ***********************************************************************/ + +/*! parameters describing the keep-alive FSM (timeouts). */ +struct ipa_keepalive_params { + /*! interval in which to send IPA CCM PING requests to the peer. */ + unsigned int interval; + /*! time to wait for an IPA CCM PONG in response to a IPA CCM PING before giving up. */ + unsigned int wait_for_resp; +}; + +typedef int ipa_keepalive_timeout_cb_t(struct osmo_fsm_inst *fi, void *conn); + +typedef void ipa_keepalive_send_cb_t(struct osmo_fsm_inst *fi, void *conn, struct msgb *msg); + +struct osmo_fsm_inst *ipa_client_conn_alloc_keepalive_fsm(struct ipa_client_conn *client, + const struct ipa_keepalive_params *params, + const char *id); + +struct osmo_fsm_inst *ipa_server_conn_alloc_keepalive_fsm(struct ipa_server_conn *server, + const struct ipa_keepalive_params *params, + const char *id); + +struct osmo_fsm_inst *ipa_generic_conn_alloc_keepalive_fsm(void *ctx, void* data, + const struct ipa_keepalive_params *params, + const char *id); + +void ipa_keepalive_fsm_set_timeout_cb(struct osmo_fsm_inst *fi, ipa_keepalive_timeout_cb_t *cb); + +void ipa_keepalive_fsm_set_send_cb(struct osmo_fsm_inst *fi, ipa_keepalive_send_cb_t *fn); + +void ipa_keepalive_fsm_start(struct osmo_fsm_inst *fi); + +void ipa_keepalive_fsm_stop(struct osmo_fsm_inst *fi); + +void ipa_keepalive_fsm_pong_received(struct osmo_fsm_inst *fi); + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/include/osmocom/trau/osmo_ortp.h new/libosmo-abis-0.7.0/include/osmocom/trau/osmo_ortp.h --- old/libosmo-abis-0.6.0/include/osmocom/trau/osmo_ortp.h 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/include/osmocom/trau/osmo_ortp.h 2019-07-21 21:32:08.000000000 +0200 @@ -74,6 +74,7 @@ struct osmo_rtp_socket *osmo_rtp_socket_create(void *talloc_ctx, unsigned int flags); int osmo_rtp_socket_bind(struct osmo_rtp_socket *rs, const char *ip, int port); int osmo_rtp_socket_connect(struct osmo_rtp_socket *rs, const char *ip, uint16_t port); +int osmo_rtp_socket_autoconnect(struct osmo_rtp_socket *rs); int osmo_rtp_socket_set_pt(struct osmo_rtp_socket *rs, int payload_type); int osmo_rtp_socket_free(struct osmo_rtp_socket *rs); int osmo_rtp_skipped_frame(struct osmo_rtp_socket *rs, unsigned int duration); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/src/Makefile.am new/libosmo-abis-0.7.0/src/Makefile.am --- old/libosmo-abis-0.6.0/src/Makefile.am 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/src/Makefile.am 2019-07-21 21:32:08.000000000 +0200 @@ -1,8 +1,8 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -ABIS_LIBVERSION=6:2:0 -TRAU_LIBVERSION=3:2:1 +ABIS_LIBVERSION=7:0:1 +TRAU_LIBVERSION=4:0:2 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir) AM_CFLAGS= -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS) @@ -21,6 +21,7 @@ trau_frame.c \ input/dahdi.c \ input/ipa.c \ + input/ipa_keepalive.c \ input/ipaccess.c \ input/lapd.c \ input/lapd_pcap.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/src/input/ipa.c new/libosmo-abis-0.7.0/src/input/ipa.c --- old/libosmo-abis-0.6.0/src/input/ipa.c 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/src/input/ipa.c 2019-07-21 21:32:08.000000000 +0200 @@ -266,13 +266,13 @@ link->addr = talloc_strdup(link, ipbuf); } - LOGP(DLINP, LOGL_NOTICE, "accept()ed new link from %s to port %u\n", - inet_ntoa(sa.sin_addr), link->port); + LOGIPA(link, LOGL_NOTICE, "accept()ed new link from %s:%u\n", + inet_ntoa(sa.sin_addr), ntohs(sa.sin_port)); ret = link->accept_cb(link, fd); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, - "failed to processs accept()ed new link, " + "failed to process accept()ed new link, " "reason=`%s'\n", strerror(-ret)); close(fd); return ret; @@ -503,7 +503,12 @@ void ipa_server_conn_destroy(struct ipa_server_conn *conn) { + /* make the function re-entrant in case closed_cb() below somehow + * calls again into this destructor */ + if (conn->ofd.fd == -1) + return; close(conn->ofd.fd); + conn->ofd.fd = -1; msgb_free(conn->pending_msg); osmo_fd_unregister(&conn->ofd); if (conn->closed_cb) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/src/input/ipa_keepalive.c new/libosmo-abis-0.7.0/src/input/ipa_keepalive.c --- old/libosmo-abis-0.6.0/src/input/ipa_keepalive.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libosmo-abis-0.7.0/src/input/ipa_keepalive.c 2019-07-21 21:32:08.000000000 +0200 @@ -0,0 +1,336 @@ +/* IPA keep-alive FSM; Periodically transmit IPA_PING and expect IPA_PONG in return. + * + * (C) 2019 by Harald Welte <[email protected]> + * + * All Rights Reserved + * + * SPDX-License-Identifier: GPL-2.0+ + * + * 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 2 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include <osmocom/core/fsm.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/logging.h> + +#include <osmocom/gsm/protocol/ipaccess.h> + +#include <osmocom/abis/ipa.h> + +#define S(x) (1 << (x)) + + +/* generate a msgb containing an IPA CCM PING message */ +static struct msgb *gen_ipa_ping(void) +{ + struct msgb *msg = msgb_alloc_headroom(64, 32, "IPA PING"); + if (!msg) + return NULL; + + msgb_put_u8(msg, IPAC_MSGT_PING); + ipa_msg_push_header(msg, IPAC_PROTO_IPACCESS); + + return msg; +} + +enum osmo_ipa_keepalive_state { + OSMO_IPA_KA_S_INIT, + OSMO_IPA_KA_S_IDLE, /* waiting for next interval */ + OSMO_IPA_KA_S_WAIT_RESP, /* waiting for response to keepalive */ +}; + +enum osmo_ipa_keepalive_event { + OSMO_IPA_KA_E_START, + OSMO_IPA_KA_E_STOP, + OSMO_IPA_KA_E_PONG, +}; + +static const struct value_string ipa_keepalive_event_names[] = { + OSMO_VALUE_STRING(OSMO_IPA_KA_E_START), + OSMO_VALUE_STRING(OSMO_IPA_KA_E_STOP), + OSMO_VALUE_STRING(OSMO_IPA_KA_E_PONG), + { 0, NULL } +}; + +enum ipa_fsm_timer { + T_SEND_NEXT_PING = 1, + T_PONG_NOT_RECEIVED = 2, +}; + +struct ipa_fsm_priv { + struct ipa_keepalive_params params; + + struct ipa_server_conn *srv_conn; + struct ipa_client_conn *client_conn; + void *generic; + ipa_keepalive_timeout_cb_t *timeout_cb; + ipa_keepalive_send_cb_t *send_fn; +}; + +static void ipa_ka_init(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct ipa_fsm_priv *ifp = fi->priv; + + switch (event) { + case OSMO_IPA_KA_E_START: + osmo_fsm_inst_state_chg(fi, OSMO_IPA_KA_S_WAIT_RESP, + ifp->params.wait_for_resp, T_PONG_NOT_RECEIVED); + break; + default: + OSMO_ASSERT(0); + break; + } +} + +static void ipa_ka_wait_resp_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct ipa_fsm_priv *ifp = fi->priv; + struct msgb *msg; + + /* Send an IPA PING to the peer */ + msg = gen_ipa_ping(); + OSMO_ASSERT(msg); + + if (ifp->send_fn && ifp->generic) { + ifp->send_fn(fi, ifp->generic, msg); + return; + } + + if (ifp->srv_conn) { + if (ifp->send_fn) + ifp->send_fn(fi, ifp->srv_conn, msg); + else + ipa_server_conn_send(ifp->srv_conn, msg); + } + else { + OSMO_ASSERT(ifp->client_conn); + if (ifp->send_fn) + ifp->send_fn(fi, ifp->client_conn, msg); + else + ipa_client_conn_send(ifp->client_conn, msg); + } +} + +static void ipa_ka_wait_resp(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct ipa_fsm_priv *ifp = fi->priv; + + switch (event) { + case OSMO_IPA_KA_E_PONG: + osmo_fsm_inst_state_chg(fi, OSMO_IPA_KA_S_IDLE, + ifp->params.interval, T_SEND_NEXT_PING); + break; + default: + OSMO_ASSERT(0); + } +} + +static int ipa_ka_fsm_timer_cb(struct osmo_fsm_inst *fi) +{ + struct ipa_fsm_priv *ifp = fi->priv; + void *conn; + + switch (fi->T) { + case T_SEND_NEXT_PING: + /* send another PING */ + osmo_fsm_inst_state_chg(fi, OSMO_IPA_KA_S_WAIT_RESP, + ifp->params.wait_for_resp, T_PONG_NOT_RECEIVED); + return 0; + case T_PONG_NOT_RECEIVED: + /* PONG not received within time */ + if (ifp->srv_conn) + conn = ifp->srv_conn; + else if (ifp->client_conn) + conn = ifp->client_conn; + else + conn = ifp->generic; + if (ifp->timeout_cb) + return ifp->timeout_cb(fi, conn); + /* ask fsm core to terminate us */ + return 1; + default: + OSMO_ASSERT(0); + } +} + +static void ipa_ka_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case OSMO_IPA_KA_E_STOP: + osmo_fsm_inst_state_chg(fi, OSMO_IPA_KA_S_INIT, 0, 0); + break; + default: + OSMO_ASSERT(0); + break; + } +} + +static const struct osmo_fsm_state ipa_keepalive_states[] = { + [OSMO_IPA_KA_S_INIT] = { + .name = "INIT", + .in_event_mask = S(OSMO_IPA_KA_E_START), + .out_state_mask = S(OSMO_IPA_KA_S_WAIT_RESP) | S(OSMO_IPA_KA_S_INIT), + .action = ipa_ka_init, + }, + [OSMO_IPA_KA_S_IDLE] = { + .name = "IDLE", + .out_state_mask = S(OSMO_IPA_KA_S_WAIT_RESP) | S(OSMO_IPA_KA_S_INIT), + /* no permitted events aside from E_START, which is handled in allstate_events */ + }, + [OSMO_IPA_KA_S_WAIT_RESP] = { + .name = "WAIT_RESP", + .in_event_mask = S(OSMO_IPA_KA_E_PONG), + .out_state_mask = S(OSMO_IPA_KA_S_IDLE) | S(OSMO_IPA_KA_S_INIT), + .action = ipa_ka_wait_resp, + .onenter = ipa_ka_wait_resp_onenter, + }, +}; + +static struct osmo_fsm ipa_keepalive_fsm = { + .name = "IPA-KEEPALIVE", + .states = ipa_keepalive_states, + .num_states = ARRAY_SIZE(ipa_keepalive_states), + .log_subsys = DLINP, + .allstate_event_mask = S(OSMO_IPA_KA_E_STOP), + .allstate_action = ipa_ka_allstate_action, + .event_names = ipa_keepalive_event_names, + .timer_cb = ipa_ka_fsm_timer_cb, +}; + +static __attribute__((constructor)) void on_dso_load(void) +{ + osmo_fsm_register(&ipa_keepalive_fsm); +} + + +static struct osmo_fsm_inst * +__ipa_conn_alloc_keepalive_fsm(void *ctx, const struct ipa_keepalive_params *params, const char *id) +{ + struct osmo_fsm_inst *fi; + struct ipa_fsm_priv *ifp; + + fi = osmo_fsm_inst_alloc(&ipa_keepalive_fsm, ctx, NULL, LOGL_DEBUG, id); + if (!fi) + return NULL; + ifp = talloc_zero(fi, struct ipa_fsm_priv); + if (!ifp) { + osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL); + return NULL; + } + memcpy(&ifp->params, params, sizeof(ifp->params)); + fi->priv = ifp; + + return fi; +} + +/*! Create a new instance of an IPA keepalive FSM: Periodically transmit PING and expect PONG. + * \param[in] client The client connection for which to crate the FSM. Used as talloc context. + * \param[in] params Parameters describing the keepalive FSM time-outs. + * \param[in] id String used as identifier for the FSM. + * \returns pointer to the newly-created FSM instance; NULL in case of error. */ +struct osmo_fsm_inst *ipa_client_conn_alloc_keepalive_fsm(struct ipa_client_conn *client, + const struct ipa_keepalive_params *params, + const char *id) +{ + struct osmo_fsm_inst *fi; + struct ipa_fsm_priv *ifp; + + fi = __ipa_conn_alloc_keepalive_fsm(client, params, id); + if (!fi) + return NULL; + ifp = fi->priv; + ifp->client_conn = client; + return fi; +} + +/*! Create a new instance of an IPA keepalive FSM: Periodically transmit PING and expect PONG. + * \param[in] server The server connection for which to crate the FSM. Used as talloc context. + * \param[in] params Parameters describing the keepalive FSM time-outs. + * \param[in] id String used as identifier for the FSM. + * \returns pointer to the newly-created FSM instance; NULL in case of error. */ +struct osmo_fsm_inst *ipa_server_conn_alloc_keepalive_fsm(struct ipa_server_conn *server, + const struct ipa_keepalive_params *params, + const char *id) +{ + struct osmo_fsm_inst *fi; + struct ipa_fsm_priv *ifp; + + fi = __ipa_conn_alloc_keepalive_fsm(server, params, id); + if (!fi) + return NULL; + ifp = fi->priv; + ifp->srv_conn = server; + return fi; +} + +/*! Create a new instance of an IPA keepalive FSM: Periodically transmit PING and expect PONG. + * \param[in] ctx Talloc context. + * \param[in] data Data to pass to write/timeout cb. + * \param[in] params Parameters describing the keepalive FSM time-outs. + * \param[in] id String used as identifier for the FSM. + * \returns pointer to the newly-created FSM instance; NULL in case of error. */ +struct osmo_fsm_inst *ipa_generic_conn_alloc_keepalive_fsm(void *ctx, void* data, + const struct ipa_keepalive_params *params, + const char *id) +{ + struct osmo_fsm_inst *fi; + struct ipa_fsm_priv *ifp; + + fi = __ipa_conn_alloc_keepalive_fsm(ctx, params, id); + if (!fi) + return NULL; + ifp = fi->priv; + ifp->generic = data; + return fi; +} + +/*! Set a timeout call-back which is to be called once the peer doesn't respond anymore */ +void ipa_keepalive_fsm_set_timeout_cb(struct osmo_fsm_inst *fi, ipa_keepalive_timeout_cb_t *cb) +{ + struct ipa_fsm_priv *ifp = fi->priv; + OSMO_ASSERT(fi->fsm == &ipa_keepalive_fsm); + ifp->timeout_cb = cb; +} + +/*! Set a custom send callback for sending pings */ +void ipa_keepalive_fsm_set_send_cb(struct osmo_fsm_inst *fi, ipa_keepalive_send_cb_t *fn) +{ + struct ipa_fsm_priv *ifp = fi->priv; + OSMO_ASSERT(fi->fsm == &ipa_keepalive_fsm); + ifp->send_fn = fn; +} + +/*! Inform IPA Keepalive FSM that a PONG has been received. */ +void ipa_keepalive_fsm_pong_received(struct osmo_fsm_inst *fi) +{ + OSMO_ASSERT(fi->fsm == &ipa_keepalive_fsm); + osmo_fsm_inst_dispatch(fi, OSMO_IPA_KA_E_PONG, NULL); +} + +/*! Start the ping/pong procedure of the IPA Keepalive FSM. */ +void ipa_keepalive_fsm_start(struct osmo_fsm_inst *fi) +{ + OSMO_ASSERT(fi->fsm == &ipa_keepalive_fsm); + osmo_fsm_inst_dispatch(fi, OSMO_IPA_KA_E_START, NULL); +} + +/*! Stop the ping/pong procedure of the IPA Keepalive FSM. */ +void ipa_keepalive_fsm_stop(struct osmo_fsm_inst *fi) +{ + OSMO_ASSERT(fi->fsm == &ipa_keepalive_fsm); + osmo_fsm_inst_dispatch(fi, OSMO_IPA_KA_E_STOP, NULL); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/src/input/ipaccess.c new/libosmo-abis-0.7.0/src/input/ipaccess.c --- old/libosmo-abis-0.6.0/src/input/ipaccess.c 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/src/input/ipaccess.c 2019-07-21 21:32:08.000000000 +0200 @@ -215,8 +215,10 @@ return 0; err: osmo_fd_unregister(bfd); - close(bfd->fd); - bfd->fd = -1; + if (bfd->fd != -1) { + close(bfd->fd); + bfd->fd = -1; + } e1inp_line_put(line); return -1; } @@ -459,6 +461,17 @@ LOGP(DLINP, LOGL_NOTICE, "Failed to set keepalive count: %s\n", strerror(errno)); +#if defined(TCP_USER_TIMEOUT) + val = 1000 * line->keepalive_num_probes * + line->keepalive_probe_interval + + line->keepalive_idle_timeout; + ret = setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, + &val, sizeof(val)); + if (ret < 0) + LOGP(DLINP, LOGL_NOTICE, + "Failed to set user timoeut: %s\n", + strerror(errno)); +#endif #endif } } @@ -667,8 +680,10 @@ { struct e1inp_line *line = link->line; - if (up) - return; + if (up) { + update_fd_settings(line, link->ofd->fd); + return; + } if (line->ops->sign_link_down) line->ops->sign_link_down(line); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/src/trau/osmo_ortp.c new/libosmo-abis-0.7.0/src/trau/osmo_ortp.c --- old/libosmo-abis-0.6.0/src/trau/osmo_ortp.c 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/src/trau/osmo_ortp.c 2019-07-21 21:32:08.000000000 +0200 @@ -468,6 +468,28 @@ return osmo_rtp_socket_fdreg(rs); } +/*! \brief Automatically associates a RTP socket with the first incoming UDP packet + * \param[in] rs OsmoRTP socket + * + * The bound RTP socket will wait for incoming RTP packets and as soon as it + * sees one, will 'connect' to it, so all replies will go to that sources and + * incoming messages from other sources will be discarded. This obviously only + * works once. + * + * \returns 0 on success, <0 in case of error. + */ +int osmo_rtp_socket_autoconnect(struct osmo_rtp_socket *rs) +{ + rtp_session_set_symmetric_rtp(rs->sess, 1); + rtp_session_set_connected_mode(rs->sess, 1); + rs->flags &= ~OSMO_RTP_F_DISABLED; + + if (rs->flags & OSMO_RTP_F_POLL) + return 0; + else + return osmo_rtp_socket_fdreg(rs); +} + /*! \brief Increment timestamp on a RTP socket without sending any packet * \param[in] rs OsmoRTP socket * \param[in] duration duration in number of RTP clock ticks diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-abis-0.6.0/tests/Makefile.am new/libosmo-abis-0.7.0/tests/Makefile.am --- old/libosmo-abis-0.6.0/tests/Makefile.am 2019-01-24 18:22:52.000000000 +0100 +++ new/libosmo-abis-0.7.0/tests/Makefile.am 2019-07-21 21:32:08.000000000 +0200 @@ -1,6 +1,6 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include AM_CFLAGS=-Wall -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(COVERAGE_CFLAGS) -AM_LDFLAGS = $(COVERAGE_LDFLAGS) +AM_LDFLAGS = $(COVERAGE_LDFLAGS) -no-install check_PROGRAMS = e1inp_ipa_bsc_test \ e1inp_ipa_bts_test \
