laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/35075?usp=email )
Change subject: Use 'iuh/local-ip' as local IP for RTP sockets ...................................................................... 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 --- M TODO-RELEASE M include/osmocom/hnodeb/rtp.h M src/osmo-hnodeb/llsk_audio.c M src/osmo-hnodeb/rtp.c 4 files changed, 30 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/TODO-RELEASE b/TODO-RELEASE index d0852fc..2c9f8ba 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # 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() diff --git a/include/osmocom/hnodeb/rtp.h b/include/osmocom/hnodeb/rtp.h index 5eaec7b..dbb33c5 100644 --- a/include/osmocom/hnodeb/rtp.h +++ b/include/osmocom/hnodeb/rtp.h @@ -40,5 +40,6 @@ 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); diff --git a/src/osmo-hnodeb/llsk_audio.c b/src/osmo-hnodeb/llsk_audio.c index a545ee7..3140f83 100644 --- a/src/osmo-hnodeb/llsk_audio.c +++ b/src/osmo-hnodeb/llsk_audio.c @@ -210,7 +210,7 @@ /* 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); diff --git a/src/osmo-hnodeb/rtp.c b/src/osmo-hnodeb/rtp.c index 422e043..6213eee 100644 --- a/src/osmo-hnodeb/rtp.c +++ b/src/osmo-hnodeb/rtp.c @@ -263,14 +263,13 @@ "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 @@ 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 @@ 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: */ -- To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/35075?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnodeb Gerrit-Branch: master Gerrit-Change-Id: I90e2cbb1765d4d2db5a19f64f0ff09cdc18b7911 Gerrit-Change-Number: 35075 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <lafo...@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-Reviewer: osmith <osm...@sysmocom.de> Gerrit-MessageType: merged