Commit 128bd3d3 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Create macro to ntoh_int16 buffer input

parent 21b269fa
......@@ -968,14 +968,6 @@ static void parse_allowed_nssai(nr_nas_msg_snssai_t nssaiList[8], const uint8_t
}
}
static inline uint16_t ntohs_unaligned(const uint8_t *v)
{
// sanitize may complain on unaligned access, even if it works on Intel/AMD
uint16_t tmp;
memcpy(&tmp, v, sizeof(tmp));
return ntohs(tmp);
}
/* Extract Allowed NSSAI from Regestration Accept according to
3GPP TS 24.501 Table 8.2.7.1.1
*/
......@@ -995,7 +987,7 @@ static void get_allowed_nssai(nr_nas_msg_snssai_t nssai[8], const uint8_t *pdu_b
const int type = *pdu_buffer++;
switch (type) {
case 0x77: // 5GS mobile identity
pdu_buffer += ntohs_unaligned(pdu_buffer) + sizeof(uint16_t);
pdu_buffer += ntoh_int16_buf(pdu_buffer) + sizeof(uint16_t);
break;
case 0x4A: // PLMN list
......
......@@ -44,6 +44,9 @@
#define ntoh_int24_buf(bUF) \
((*bUF << 16) | ((*(bUF + 1)) << 8) | (*(bUF + 2)))
#define ntoh_int16_buf(bUF) \
((*(bUF) << 8) | (*(bUF + 1)))
#define IN_ADDR_TO_BUFFER(X,bUFF) INT32_TO_BUFFER((X).s_addr,(char*)bUFF)
#define IN6_ADDR_TO_BUFFER(X,bUFF) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment