pespin submitted this change.

View Change

Approvals: lynxis lazus: Looks good to me, approved Jenkins Builder: Verified
ranap_msg_factory: Fix API documentation regarding ip param endianness

The param is clearly being expected as host-byte order because it
converts it when storing it into the sockaddr, which contains a net-byte
order.

Both users of these APIs, ie. osmo-sgsn and osmo-msc, actually end up
passing a host-byte order addr despite wrongly using htonl() instead of
ntohl(), but taking advantage of the fact that both functions do the
same:
* osmo-sgsn: sgsn_pdp_ctx_iu_rab_activate() does "htonl(pdp->lib->gsnru.v)",
where "v" is stored as network-byte order.
* osmo-msc: ran_iu_make_rab_assignment() does "osmo_htonl(inet_addr(ac->cn_rtp->ip))",
where clearly inet_addr returns a network-byte order.

Change-Id: I0a909019875714d35c27aa38dd5520a82d46e8f2
---
M src/ranap_msg_factory.c
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c
index 1005594..aecd7df 100644
--- a/src/ranap_msg_factory.c
+++ b/src/ranap_msg_factory.c
@@ -791,7 +791,7 @@
/*! \brief generate RANAP RAB ASSIGNMENT REQUEST message for CS (voice).
* See 3GPP TS 25.413 8.2.
* RAB ID: 3GPP TS 25.413 9.2.1.2.
- * \param rtp_ip MGW's RTP IPv4 address in *network* byte order.
+ * \param rtp_ip MGW's RTP IPv4 address in *host* byte order.
*/
struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip,
uint16_t rtp_port,
@@ -865,7 +865,7 @@
}

/*! \brief generate RANAP RAB ASSIGNMENT REQUEST message for PS (data)
- * \param gtp_ip SGSN's GTP IPv4 address in *network* byte order. */
+ * \param gtp_ip SGSN's GTP IPv4 address in *host* byte order. */
struct msgb *ranap_new_msg_rab_assign_data(uint8_t rab_id, uint32_t gtp_ip,
uint32_t gtp_tei, bool use_x213_nsap)
{

To view, visit change 43257. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I0a909019875714d35c27aa38dd5520a82d46e8f2
Gerrit-Change-Number: 43257
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>