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 14:56:33 UTC 2019


keith has submitted this change and it was merged. ( 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(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/mncc.c b/src/mncc.c
index 7bffbd1..8f512d9 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -174,6 +174,7 @@
 {
 	struct gsm_mncc_rtp mncc = { 0, };
 	int rc;
+	char ip_addr[INET_ADDRSTRLEN];
 
 	/*
 	 * Send RTP CONNECT and we handle the general failure of it by
@@ -189,7 +190,8 @@
 	 * 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);
+	inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
+	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",
@@ -395,6 +397,7 @@
 {
 	const struct gsm_mncc_rtp *rtp;
 	struct mncc_call_leg *leg;
+	char ip_addr[INET_ADDRSTRLEN];
 
 	if (rc < sizeof(*rtp)) {
 		LOGP(DMNCC, LOGL_ERROR, "gsm_mncc_rtp of wrong size %d < %zu\n",
@@ -417,9 +420,10 @@
 
 	/* TODO.. now we can continue with the call */
 	struct in_addr net = { .s_addr = leg->base.ip };
+	inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
 	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..56a41f7 100644
--- a/src/sdp.c
+++ b/src/sdp.c
@@ -207,7 +207,9 @@
 	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, sizeof(ip_addr));
 	leg->wanted_codec = app_media_name(other->payload_msg_type);
 
 	if (strcmp(leg->wanted_codec, "AMR") == 0)
@@ -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, /* never use diff. 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..b652b4b 100644
--- a/src/sip.c
+++ b/src/sip.c
@@ -110,6 +110,7 @@
 	struct call *call;
 	struct sip_call_leg *leg;
 	const char *from = NULL, *to = NULL;
+	char ip_addr[INET_ADDRSTRLEN];
 
 	LOGP(DSIP, LOGL_DEBUG, "Incoming call(%s) handle(%p)\n", sip->sip_call_id->i_id, nh);
 
@@ -159,8 +160,9 @@
 		return;
 	}
 	struct in_addr net = { .s_addr = leg->base.ip };
+	inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
 	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, sizeof(ip_addr));
+	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, sizeof(ip_addr));
+		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: 5
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith <keith at rhizomatica.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190806/af45ab82/attachment.html>


More information about the gerrit-log mailing list