pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/38808?usp=email )
Change subject: ipaccess: Clarify access to msgb ipa payload in code path ......................................................................
ipaccess: Clarify access to msgb ipa payload in code path
The pointer to the data payload is gathered at a later place after the first byte of the pointer has actually already been read. Clean it up so that it becomes obvious when and how the payload is accessed.
Change-Id: I5eac24bdf72021e500c554bdc6d8449bf37d2231 --- M src/input/ipaccess.c 1 file changed, 4 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/08/38808/1
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index dc523ef..51e6087 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -871,7 +871,10 @@
/* special handling for IPA CCM. */ if (hh->proto == IPAC_PROTO_IPACCESS) { - uint8_t msg_type = *(msg->l2h); + uint8_t *data = msgb_l2(msg); + int len = msgb_l2len(msg); + OSMO_ASSERT(len > 0); + uint8_t msg_type = *data;
/* peek the pong for our keepalive fsm */ if (line && msg_type == IPAC_MSGT_PONG) { @@ -886,8 +889,6 @@
/* this is a request for identification from the BSC. */ if (msg_type == IPAC_MSGT_ID_GET) { - uint8_t *data = msgb_l2(msg); - int len = msgb_l2len(msg); int trx_nr = 0;
if (link->ofd->priv_nr >= E1INP_SIGN_RSL)