Change in osmo-mgw[master]: mgcp_client: Support validating IPv6 addresses in CRCX and MDCX commands

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
Wed Sep 2 15:25:17 UTC 2020


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


Change subject: mgcp_client: Support validating IPv6 addresses in CRCX and MDCX commands
......................................................................

mgcp_client: Support validating IPv6 addresses in CRCX and MDCX commands

Change-Id: Ie97675f173dc3a223f6c2ced913906d760ffb732
---
M src/libosmo-mgcp-client/mgcp_client_fsm.c
1 file changed, 8 insertions(+), 5 deletions(-)



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

diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c b/src/libosmo-mgcp-client/mgcp_client_fsm.c
index e38a4ba..2505ff2 100644
--- a/src/libosmo-mgcp-client/mgcp_client_fsm.c
+++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c
@@ -25,6 +25,7 @@
 #include <osmocom/core/byteswap.h>
 #include <arpa/inet.h>
 #include <osmocom/core/logging.h>
+#include <osmocom/core/sockaddr_str.h>
 
 /* Context information, this is attached to the priv pointer of the FSM and
  * is also handed back when dispatcheing events to the parent FSM. This is
@@ -607,14 +608,16 @@
 {
 	struct mgcp_ctx *mgcp_ctx;
 	struct osmo_fsm_inst *fi;
-	struct in_addr ip_test;
+	struct in6_addr ip_test;
+
 
 	OSMO_ASSERT(parent_fi);
 	OSMO_ASSERT(mgcp);
 	OSMO_ASSERT(conn_peer);
 
 	/* Check if IP/Port information in conn info makes sense */
-	if (conn_peer->port && inet_aton(conn_peer->addr, &ip_test) == 0)
+	if (conn_peer->port && inet_pton(osmo_ip_str_type(conn_peer->addr),
+					 conn_peer->addr, &ip_test) != 1)
 		return NULL;
 
 	/* Allocate and configure a new fsm instance */
@@ -644,7 +647,7 @@
 {
 	OSMO_ASSERT(fi);
 	struct mgcp_ctx *mgcp_ctx = fi->priv;
-	struct in_addr ip_test;
+	struct in6_addr ip_test;
 
 	OSMO_ASSERT(mgcp_ctx);
 	OSMO_ASSERT(conn_peer);
@@ -668,8 +671,8 @@
 		LOGPFSML(fi, LOGL_ERROR, "Cannot MDCX, port == 0\n");
 		return -EINVAL;
 	}
-	if (inet_aton(conn_peer->addr, &ip_test) == 0) {
-		LOGPFSML(fi, LOGL_ERROR, "Cannot MDCX, IP address == 0.0.0.0\n");
+	if (inet_pton(osmo_ip_str_type(conn_peer->addr), conn_peer->addr, &ip_test) != 1) {
+		LOGPFSML(fi, LOGL_ERROR, "Cannot MDCX, IP address %s\n", conn_peer->addr);
 		return -EINVAL;
 	}
 

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ie97675f173dc3a223f6c2ced913906d760ffb732
Gerrit-Change-Number: 19945
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/20200902/c6f5cc18/attachment.htm>


More information about the gerrit-log mailing list