From 1f1f3f6fb996205db2413effe4be781b130b87e2 Mon Sep 17 00:00:00 2001 From: Keith Date: Tue, 6 Aug 2019 14:06:54 +0200 Subject: IPs stored in the call struct are NETWORK byte order As far as I can make out, the intention is to always store ip address in the call struct in network byte order, whereas the ip address sent on MNCC are in host byte order. Change-Id: I89ef26aa32a672f394699251cf560b53ae01a814 --- src/mncc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mncc.c b/src/mncc.c index 81fe30f..7bffbd1 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -181,7 +181,7 @@ static bool send_rtp_connect(struct mncc_call_leg *leg, struct call_leg *other) */ mncc.msg_type = MNCC_RTP_CONNECT; mncc.callref = leg->callref; - mncc.ip = htonl(other->ip); + mncc.ip = ntohl(other->ip); mncc.port = other->port; mncc.payload_type = other->payload_type; /* @@ -410,13 +410,13 @@ static void check_rtp_create(struct mncc_connection *conn, const char *buf, int } /* extract information about where the RTP is */ - leg->base.ip = rtp->ip; + leg->base.ip = htonl(rtp->ip); leg->base.port = rtp->port; leg->base.payload_type = rtp->payload_type; leg->base.payload_msg_type = rtp->payload_msg_type; /* TODO.. now we can continue with the call */ - struct in_addr net = { .s_addr = htonl(leg->base.ip) }; + struct in_addr net = { .s_addr = leg->base.ip }; 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, -- cgit v1.2.3