aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-10-08 00:20:50 +0200
committerAlexander Couzens <lynxis@fe80.eu>2020-10-08 00:33:33 +0200
commit909646150792083ac81114e6af8ee3c81fb0c7a1 (patch)
tree8cd623a0f7bbc4d219ba33c9402f31d92e1bc2e4
parentd6b82e57a327a227f4144078372a468b7e149575 (diff)
OML: correct parse the NM_ATT_OSMO_NS_LINK_CFG field address_family
The address_family is 8 bit and have a padding byte afterwards. By using osmo_load16be it's encoding it wrong and result in an empty/invalid NSVC configuration. Change-Id: Ie070b5745124d48e74a6dedd8903b74bfb3ce9d2
-rw-r--r--src/common/oml.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/oml.c b/src/common/oml.c
index 1f74cac8..5394e8a4 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1277,12 +1277,13 @@ static int oml_ipa_mo_set_attr_nsvc(struct gsm_bts_gprs_nsvc *nsvc,
if (TLVP_PRES_LEN(tp, NM_ATT_OSMO_NS_LINK_CFG, 10)) {
const uint8_t *cur = TLVP_VAL(tp, NM_ATT_OSMO_NS_LINK_CFG);
- uint16_t address_family;
+ uint8_t address_family;
memset(&nsvc->local, 0, sizeof(nsvc->local));
memset(&nsvc->remote, 0, sizeof(nsvc->remote));
- address_family = osmo_load16be(cur);
+ address_family = *cur;
+ /* 1byte padding */
cur += 2;
memcpy(&nsvc->local.u.sin.sin_port, cur, 2);