diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-09-14 12:32:10 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-09-14 12:35:21 +0200 |
commit | 2221ad87f43ee022c89ae7b0f9a505585538392c (patch) | |
tree | 6b8e465466d9abaaab89db14d82b87ff9b34841b | |
parent | 95e2ec698d1f4845d16cf9e704bf857a13f71e6f (diff) |
xua_msg: Get Rid of confusing double network byte order swap
The ipv4 addr in addr->ip.v4 is already in network byte order, as it's
usual in struct in_addr (see sua_addr_parse_part()).
So the code in there was simply calling ntohl() because
msgb_t16l16vp_put_u32() is calling htonl() on the given parameter before
storing it. Let's simply use msgb_t16l16vp_put() directly and avoid a
double byte swap which only adds confusion.
Change-Id: I70a94ee1b459d56116f0c6a6c7c3b778a939b7ea
-rw-r--r-- | src/xua_msg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/xua_msg.c b/src/xua_msg.c index 75e1357..894bef9 100644 --- a/src/xua_msg.c +++ b/src/xua_msg.c @@ -376,7 +376,7 @@ int xua_msg_add_sccp_addr(struct xua_msg *xua, uint16_t iei, const struct osmo_s msgb_t16l16vp_put_u32(tmp, SUA_IEI_SSN, addr->ssn); } if (addr->presence & OSMO_SCCP_ADDR_T_IPv4) { - msgb_t16l16vp_put_u32(tmp, SUA_IEI_IPv4, ntohl(addr->ip.v4.s_addr)); + msgb_t16l16vp_put(tmp, SUA_IEI_IPv4, sizeof(addr->ip.v4), (const uint8_t *)&addr->ip.v4); } else if (addr->presence & OSMO_SCCP_ADDR_T_IPv6) { msgb_t16l16vp_put(tmp, SUA_IEI_IPv6, sizeof(addr->ip.v6), (const uint8_t *)&addr->ip.v6); } |