pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/43257?usp=email )
Change subject: ranap_msg_factory: Fix API documentation regarding ip param endianness ......................................................................
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 anetwork-byte order.
Change-Id: I0a909019875714d35c27aa38dd5520a82d46e8f2 --- M src/ranap_msg_factory.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/57/43257/1
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) {