osmux: don't store conn ptr inside shared osmux_handle

The struct osmux_handle is a shared structure which goes together 1-1
with libosmo-netif's struct osmux_in_handle, which is common to all CIDs
to be muxed together. Hence, it makes no sense to store a specific conn
object to it, since it actually manages several of them. Hence, all the
conn specific stuff must be handled beforehand, not at osmux deliver
time.

Related: SYS#5987
Change-Id: Ie739b556e9eb7d3133e798831a09728c7cc87135
This commit is contained in:
Pau Espin 2022-09-09 17:36:33 +02:00
parent 8b0a614e43
commit e39ae87ea3
1 changed files with 3 additions and 8 deletions

View File

@ -36,7 +36,6 @@ static LLIST_HEAD(osmux_handle_list);
struct osmux_handle {
struct llist_head head;
struct mgcp_conn_rtp *conn;
struct osmux_in_handle *in;
struct osmo_sockaddr rem_addr;
int refcnt;
@ -48,14 +47,8 @@ static void *osmux;
static void osmux_deliver_cb(struct msgb *batch_msg, void *data)
{
struct osmux_handle *handle = data;
struct mgcp_conn_rtp *conn = handle->conn;
socklen_t dest_len;
if (!conn->end.output_enabled) {
msgb_free(batch_msg);
return;
}
switch (handle->rem_addr.u.sa.sa_family) {
case AF_INET6:
dest_len = sizeof(handle->rem_addr.u.sin6);
@ -130,7 +123,6 @@ osmux_handle_alloc(struct mgcp_conn_rtp *conn, const struct osmo_sockaddr *rem_a
h = talloc_zero(osmux, struct osmux_handle);
if (!h)
return NULL;
h->conn = conn;
h->rem_addr = *rem_addr;
h->refcnt++;
@ -192,6 +184,9 @@ int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn)
int ret;
struct msgb *msg;
if (!conn->end.output_enabled)
return -1;
if (conn->osmux.state != OSMUX_STATE_ENABLED) {
LOGPCONN(conn->conn, DOSMUX, LOGL_INFO, "forwarding RTP to Osmux conn not yet enabled, dropping (cid=%d)\n",
conn->osmux.cid);