Change in osmo-mgw[master]: mgw: Announce and rebind new local address if change required during ...

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.org
Thu Sep 3 13:03:58 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/19972 )


Change subject: mgw: Announce and rebind new local address if change required during MDCX
......................................................................

mgw: Announce and rebind new local address if change required during MDCX

MDCX may provide a new remote address, which means we may need to update
our announced IP addr and re-bind our local end. This can happen for
instance if MGW initially provided an IPv4 during CRCX ACK, and now MDCX
tells us the remote has an IPv6 address.

Change-Id: Iaed424e2c209e1753e1f579752fc684aaad7a512
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 15 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/72/19972/1

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 1e7ccbf..4c00140 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1006,6 +1006,7 @@
 {
 	struct mgcp_endpoint *endp = p->endp;
 	struct rate_ctr_group *rate_ctrs = endp->trunk->ratectr.mgcp_mdcx_ctr_group;
+	char new_local_addr[INET6_ADDRSTRLEN];
 	int error_code = 500;
 	int silent = 0;
 	int have_sdp = 0;
@@ -1170,6 +1171,20 @@
 		   that conn. */
 	}
 
+	/* MDCX may have provided a new remote address, which means we may need
+	   to update our announced IP addr and re-bind our local end. This can
+	   happen for instance if MGW initially provided an IPv4 during CRCX
+	   ACK, and now MDCX tells us the remote has an IPv6 address. */
+	mgcp_get_local_addr(new_local_addr, conn);
+	if (strcmp(new_local_addr, conn->end.local_addr)) {
+		osmo_strlcpy(conn->end.local_addr, new_local_addr, sizeof(conn->end.local_addr));
+		mgcp_free_rtp_port(&conn->end);
+		if (allocate_port(endp, conn) != 0) {
+			rate_ctr_inc(&rate_ctrs->ctr[MGCP_CRCX_FAIL_BIND_PORT]);
+			goto error3;
+		}
+	}
+
 	if (setup_rtp_processing(endp, conn) != 0) {
 		rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_START_RTP]);
 		goto error3;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/19972
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Iaed424e2c209e1753e1f579752fc684aaad7a512
Gerrit-Change-Number: 19972
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/20200903/52887f82/attachment.htm>


More information about the gerrit-log mailing list