inet_ntoa() is deprecated, use inet_ntop() instead

Change-Id: If6a96ede7d5e73884c32fbfdb03052e2bda50a77
changes/65/15065/5
Keith Whyte 3 years ago
parent 279e910a4a
commit a5b65505f9
  1. 8
      src/mncc.c
  2. 4
      src/sdp.c
  3. 11
      src/sip.c

@ -174,6 +174,7 @@ static bool send_rtp_connect(struct mncc_call_leg *leg, struct call_leg *other)
{
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 @@ static bool send_rtp_connect(struct mncc_call_leg *leg, struct call_leg *other)
* 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 @@ static void check_rtp_create(struct mncc_connection *conn, const char *buf, int
{
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 @@ static void check_rtp_create(struct mncc_connection *conn, const char *buf, int
/* 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);

@ -207,7 +207,9 @@ char *sdp_create_file(struct sip_call_leg *leg, struct call_leg *other, sdp_mode
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 @@ char *sdp_create_file(struct sip_call_leg *leg, struct call_leg *other, sdp_mode
"%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,

@ -110,6 +110,7 @@ static void new_call(struct sip_agent *agent, nua_handle_t *nh,
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 @@ static void new_call(struct sip_agent *agent, nua_handle_t *nh,
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 @@ static void sip_handle_reinvite(struct sip_call_leg *leg, nua_handle_t *nh, cons
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 @@ static void sip_handle_reinvite(struct sip_call_leg *leg, nua_handle_t *nh, cons
}
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 @@ static void sip_handle_reinvite(struct sip_call_leg *leg, nua_handle_t *nh, cons
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)

Loading…
Cancel
Save