Change in ...osmo-sip-connector[master]: inet_ntoa() is deprecated, use inet_ntop() instead

keith gerrit-no-reply at lists.osmocom.org
Tue Aug 6 13:44:13 UTC 2019


keith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/15065


Change subject: inet_ntoa() is deprecated, use inet_ntop() instead
......................................................................

inet_ntoa() is deprecated, use inet_ntop() instead

Change-Id: If6a96ede7d5e73884c32fbfdb03052e2bda50a77
---
M src/mncc.c
M src/sdp.c
M src/sip.c
3 files changed, 17 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/65/15065/1

diff --git a/src/mncc.c b/src/mncc.c
index 7bffbd1..0d78d05 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -189,7 +189,9 @@
 	 * payload_type should be different..
 	 */
 	struct in_addr net = { .s_addr = other->ip };
-	LOGP(DMNCC, LOGL_DEBUG, "SEND rtp_connect: IP=(%s) PORT=(%u)\n", inet_ntoa(net), mncc.port);
+	char ip_addr[INET_ADDRSTRLEN];
+	inet_ntop(AF_INET, &net, ip_addr, INET_ADDRSTRLEN);
+	LOGP(DMNCC, LOGL_DEBUG, "SEND rtp_connect: IP=(%s) PORT=(%u)\n", ip_addr, mncc.port);
 	rc = write(leg->conn->fd.fd, &mncc, sizeof(mncc));
 	if (rc != sizeof(mncc)) {
 		LOGP(DMNCC, LOGL_ERROR, "Failed to send message leg(%u)\n",
@@ -417,9 +419,11 @@
 
 	/* TODO.. now we can continue with the call */
 	struct in_addr net = { .s_addr = leg->base.ip };
+	char ip_addr[INET_ADDRSTRLEN];
+	inet_ntop(AF_INET, &net, ip_addr, INET_ADDRSTRLEN);
 	LOGP(DMNCC, LOGL_DEBUG,
 		"RTP cnt leg(%u) ip(%s), port(%u) pt(%u) ptm(%u)\n",
-		leg->callref, inet_ntoa(net), leg->base.port,
+		leg->callref, ip_addr, leg->base.port,
 		leg->base.payload_type, leg->base.payload_msg_type);
 	stop_cmd_timer(leg, MNCC_RTP_CREATE);
 	continue_call(leg);
diff --git a/src/sdp.c b/src/sdp.c
index e2ed25e..fda6c27 100644
--- a/src/sdp.c
+++ b/src/sdp.c
@@ -207,6 +207,8 @@
 	struct in_addr net = { .s_addr = other->ip };
 	char *fmtp_str = NULL, *sdp;
 	char *mode_attribute;
+	char ip_addr[INET_ADDRSTRLEN];
+	inet_ntop(AF_INET, &net, ip_addr, INET_ADDRSTRLEN);
 
 	leg->wanted_codec = app_media_name(other->payload_msg_type);
 
@@ -241,7 +243,7 @@
 				"%s"
 				"a=rtpmap:%d %s/8000\r\n"
 				"%s",
-				inet_ntoa(net), inet_ntoa(net), /* never use diff. addr! */
+				ip_addr, ip_addr,
 				other->port, other->payload_type,
 				fmtp_str ? fmtp_str : "",
 				other->payload_type,
diff --git a/src/sip.c b/src/sip.c
index 0179226..9366f18 100644
--- a/src/sip.c
+++ b/src/sip.c
@@ -159,8 +159,10 @@
 		return;
 	}
 	struct in_addr net = { .s_addr = leg->base.ip };
+	char ip_addr[INET_ADDRSTRLEN];
+	inet_ntop(AF_INET, &net, ip_addr, INET_ADDRSTRLEN);
 	LOGP(DSIP, LOGL_DEBUG, "SDP Extracted: IP=(%s) PORT=(%u) PAYLOAD=(%u).\n",
-		               inet_ntoa(net),
+		               ip_addr,
 		               leg->base.port,
 		               leg->base.payload_type);
 
@@ -186,6 +188,7 @@
 	sdp_mode_t mode = sdp_sendrecv;
 	uint32_t ip = leg->base.ip;
 	uint16_t port = leg->base.port;
+	char ip_addr[INET_ADDRSTRLEN];
 
 	LOGP(DSIP, LOGL_NOTICE, "re-INVITE for call %s\n", sip->sip_call_id->i_id);
 
@@ -205,7 +208,8 @@
 	}
 
 	struct in_addr net = { .s_addr = leg->base.ip };
-	LOGP(DSIP, LOGL_NOTICE, "pre re-INVITE have IP:port (%s:%u)\n", inet_ntoa(net), leg->base.port);
+	inet_ntop(AF_INET, &net, ip_addr, INET_ADDRSTRLEN);
+	LOGP(DSIP, LOGL_NOTICE, "pre re-INVITE have IP:port (%s:%u)\n", ip_addr, leg->base.port);
 
 	if (mode == sdp_sendonly) {
 		/* SIP side places call on HOLD */
@@ -221,7 +225,8 @@
 			return;
 		}
 		struct in_addr net = { .s_addr = leg->base.ip };
-		LOGP(DSIP, LOGL_NOTICE, "Media IP:port in re-INVITE: (%s:%u)\n", inet_ntoa(net), leg->base.port);
+		inet_ntop(AF_INET, &net, ip_addr, INET_ADDRSTRLEN);
+		LOGP(DSIP, LOGL_NOTICE, "Media IP:port in re-INVITE: (%s:%u)\n", ip_addr, leg->base.port);
 		if (ip != leg->base.ip || port != leg->base.port) {
 			LOGP(DSIP, LOGL_NOTICE, "re-INVITE changes media connection.\n");
 			if (other->update_rtp)

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

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: If6a96ede7d5e73884c32fbfdb03052e2bda50a77
Gerrit-Change-Number: 15065
Gerrit-PatchSet: 1
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190806/3367bbe9/attachment.html>


More information about the gerrit-log mailing list