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/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/20029 ) Change subject: mgw: osmux: Avoid sending packets on recvonly connection ...................................................................... mgw: osmux: Avoid sending packets on recvonly connection Change-Id: I87b1fb7d73cbbb2a5d4d8a40a9527a3e05d9947b --- M src/libosmo-mgcp/mgcp_osmux.c 1 file changed, 17 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/29/20029/1 diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 5864c95..02e31bb 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -35,6 +35,7 @@ struct osmux_handle { struct llist_head head; + struct mgcp_conn_rtp *conn; struct osmux_in_handle *in; struct in_addr rem_addr; int rem_port; /* network byte order */ @@ -47,14 +48,17 @@ static void osmux_deliver_cb(struct msgb *batch_msg, void *data) { struct osmux_handle *handle = data; - struct sockaddr_in out = { - .sin_family = AF_INET, - .sin_port = handle->rem_port, - }; + struct mgcp_conn_rtp *conn = handle->conn; - memcpy(&out.sin_addr, &handle->rem_addr, sizeof(handle->rem_addr)); - sendto(osmux_fd.fd, batch_msg->data, batch_msg->len, 0, - (struct sockaddr *)&out, sizeof(out)); + if (conn->end.output_enabled) { + struct sockaddr_in out = { + .sin_family = AF_INET, + .sin_port = handle->rem_port, + }; + memcpy(&out.sin_addr, &handle->rem_addr, sizeof(handle->rem_addr)); + sendto(osmux_fd.fd, batch_msg->data, batch_msg->len, 0, + (struct sockaddr *)&out, sizeof(out)); + } msgb_free(batch_msg); } @@ -109,13 +113,15 @@ /* Allocate free OSMUX handle */ static struct osmux_handle * -osmux_handle_alloc(struct mgcp_config *cfg, struct in_addr *addr, int rem_port) +osmux_handle_alloc(struct mgcp_conn_rtp *conn, struct in_addr *addr, int rem_port) { struct osmux_handle *h; + struct mgcp_config *cfg = conn->conn->endp->cfg; h = talloc_zero(osmux, struct osmux_handle); if (!h) return NULL; + h->conn = conn; h->rem_addr = *addr; h->rem_port = rem_port; h->refcnt++; @@ -148,7 +154,7 @@ /* Lookup existing handle for a specified address, if the handle can not be * found, the function will automatically allocate one */ static struct osmux_in_handle * -osmux_handle_lookup(struct mgcp_config *cfg, struct osmo_sockaddr *addr, int rem_port) +osmux_handle_lookup(struct mgcp_conn_rtp *conn, struct osmo_sockaddr *addr, int rem_port) { struct osmux_handle *h; @@ -161,7 +167,7 @@ if (h != NULL) return h->in; - h = osmux_handle_alloc(cfg, &addr->u.sin.sin_addr, rem_port); + h = osmux_handle_alloc(conn, &addr->u.sin.sin_addr, rem_port); if (h == NULL) return NULL; @@ -474,7 +480,7 @@ return -1; } - conn->osmux.in = osmux_handle_lookup(endp->cfg, addr, port); + conn->osmux.in = osmux_handle_lookup(conn, addr, port); if (!conn->osmux.in) { LOGPCONN(conn->conn, DLMGCP, LOGL_ERROR, "Cannot allocate input osmux handle for conn:%s\n", -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/20029 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I87b1fb7d73cbbb2a5d4d8a40a9527a3e05d9947b Gerrit-Change-Number: 20029 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200908/93c3e600/attachment.htm>