Change in osmo-bsc[master]: Fail on invalid IP addresses passed to IPACC MDCX

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
Tue Sep 1 18:19:44 UTC 2020


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


Change subject: Fail on invalid IP addresses passed to IPACC MDCX
......................................................................

Fail on invalid IP addresses passed to IPACC MDCX

IPACC protocol supports only IPv4 addresses, so make sure if an IPv6
address (or whatever malformed address) is caught is not sent without
noticing. Prior to this patch, faulty addresses would be sent over the
wire as 255.255.255.255 (-1 returned from inet_addr()).

Change-Id: Iee84e8b40cdede1cacd8e8a9e26dda0d85383ec8
---
M src/osmo-bsc/lchan_rtp_fsm.c
1 file changed, 8 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/36/19936/1

diff --git a/src/osmo-bsc/lchan_rtp_fsm.c b/src/osmo-bsc/lchan_rtp_fsm.c
index 1fe5452..736013c 100644
--- a/src/osmo-bsc/lchan_rtp_fsm.c
+++ b/src/osmo-bsc/lchan_rtp_fsm.c
@@ -330,6 +330,7 @@
 	int rc;
 	struct gsm_lchan *lchan = lchan_rtp_fi_lchan(fi);
 	const struct mgcp_conn_peer *mgw_rtp;
+	struct in_addr sin;
 
 	if (lchan->release.requested) {
 		lchan_rtp_fail("Release requested while activating");
@@ -344,8 +345,13 @@
 		return;
 	}
 
-	/* Other RTP settings were already setup in lchan_rtp_fsm_wait_ipacc_crcx_ack_onenter() */
-	lchan->abis_ip.connect_ip = ntohl(inet_addr(mgw_rtp->addr));
+	/* Other RTP settings were already set up in lchan_rtp_fsm_wait_ipacc_crcx_ack_onenter() */
+	if (inet_pton(AF_INET, mgw_rtp->addr, &sin) != 1) {
+		/* Only IPv4 addresses are supported in IPACC */
+		lchan_rtp_fail("Invalid remote IPv4 address %", mgw_rtp->addr);
+		return;
+	}
+	lchan->abis_ip.connect_ip = ntohl(sin.s_addr);
 	lchan->abis_ip.connect_port = mgw_rtp->port;
 
 	/* send-recv */

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Iee84e8b40cdede1cacd8e8a9e26dda0d85383ec8
Gerrit-Change-Number: 19936
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/20200901/0cc20e81/attachment.htm>


More information about the gerrit-log mailing list