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
This commit is contained in:
parent
b303e296b7
commit
fed4bf196a
|
@ -7,3 +7,4 @@
|
||||||
# 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()
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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: */
|
||||||
|
|
Loading…
Reference in New Issue