summaryrefslogtreecommitdiffstats
path: root/src/gsm/ipa.c
Commit message (Collapse)AuthorAgeFilesLines
* ipa: Document ipa_msg_recv* functionsPau Espin Pedrol2018-08-221-0/+22
| | | | Change-Id: Ie81e9dd9f9936a414e7cebb2bccffa6f42a302a7
* re-introduce ipa_ccm_idtag_parse_off()Harald Welte2018-08-011-3/+13
| | | | | | | | | In the previous commit we deprecated ipa_ccm_idtag_parse() but also removed ipa_ccm_idtag_parse_off(), for which I couldn't find any users. However, legacy openbsc.git still uses this function, so let's re-introiduce it in its original form. Change-Id: Ibfe53b04340eb355c8bfb8453a2af1522a4b6baf
* Deprecate ipa_ccm_idtag_parse() with ipa_ccm_id_{get,resp}_parse()Harald Welte2018-08-011-8/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the past, the function ipa_ccm_idtag_parse() was used to parse the payload of IPA CCM ID RESP packets. However, the function was based on a possible misunderstanding of the message encoding, and callers actually counted the first (upper) length nibble as part of the header and passed a pointer to the second (lower) length nibble of the first TLV into this function. As such, it was unfixable, and had to be replaced with a new function called ipa_ccm_id_resp_parse(). At the same time, we also add ipa_ccm_id_get_parse() to parse the slightly different format of the IPA CCM ID GET payload. We can never be 100% sure what is "correct", as our understanding of the protocol is entirely based on protocol analysis, without any official documentation available. This patch also introduces unit test coverage for both of the new functions. Revert "ipa: Add libosmogsm.map entry for ipa_ccm_idtag_parse_off" This reverts commit 7f31c90b80c08fbfe2d84d70d397402fdb38b94c. Revert "ipa: Properly parse LV stream of a ID_GET request" This reverts commit f558ed4bb9c0f00997b8f97c2b251a574c1a64c4. It introduced a function/behavior that was not originally intended: The parse of IPA CCM ID GET (8bit length followed by 1 byte tag and variable-length payload) instead of the IPA CCM ID RESP (16bit length followed by 1 byte tag and variable-length payload). Change-Id: I1834d90fbcdbfcb05f5b8cfe39bfe9543737ef8f
* fix strncpy bugs in gsm/ipa.cNeels Hofmeyr2018-07-271-7/+6
| | | | Change-Id: I423a24c55c9b9aa6fc8f501df94fe54c71ee2b2b
* prevent integer underflow in ipa_ccm_make_id_resp_from_req()Harald Welte2018-04-171-1/+6
| | | | | | | don't blindly trust the tag-length value in an IPA CCM ID GET message. This could result in a remotely-triggered integer underflow. Change-Id: I4723361e1094b358310541a7dc4c5c921c778a15
* fix spellingThorsten Alteholz2018-04-081-1/+1
| | | | | | | fix for some spelling issues found by lintian Signed-off-by: Thorsten Alteholz <osmocom@alteholz.de> Change-Id: I69976ecae6939d9ff51bfe4ce7374890c6563b82
* Fix/Update copyright notices; Add SPDX annotationHarald Welte2017-11-131-0/+2
| | | | | | | | Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
* ipa: place comment "IPA Multiplex" on ipa allocated msgbsNeels Hofmeyr2017-09-071-1/+1
| | | | | | | | | | libosmocore offers the ipa API as general IPA Multiplex, which is e.g. used for GSUP in osmo-msc. Looking at talloc reports, it is confusing to see "Abis/IP" as msgb comment, because osmo-msc does not have an Abis interface. Rename to "IPA Multiplex" as a more general description. Change-Id: I3714dd21707bec0c4bcd0871e6ee8ff32d56b125
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-3/+4
| | | | | | | | | | | | | | | | | Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-231-3/+3
| | | | | | | | | | Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
* update/extend doxygen documentationHarald Welte2017-06-121-0/+7
| | | | | | | | | It's a pity that even with this patch we still are fare away from having the whole API documented. However, at least we have a more solid foundation. Updates not only extend the documentation, but also make sure it is rendered properly in the doxygen HTML. Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
* gsm0808 + ipa: fix compilation on systems without sys/socket.hHarald Welte2017-05-151-1/+7
| | | | Change-Id: I60f5d4982cd96ab29f9924ec11b46bf56fbfc346
* use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocoreHarald Welte2017-05-151-3/+3
| | | | | | This gets us one step closer to fixing the embedded build Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
* Uninitialized variable in ipa_ccm_make_id_resp_from_req()Harald Welte2017-04-271-0/+2
| | | | | | | | | | We are allocating a buffer on the stack without initializing it, and then passing it into ipa_ccm_make_id_resp(). There is no real danger from this, as the buffer is only uninitialized if num_ies is 0, but let's memset() it for good style Change-Id: If5761a47b8cba73ddcc02a88cfa5c87c1970c04e Fixes: coverity CID#167040
* ipa: Introduce helpers to encode IPA CCM ID RESPONSEHarald Welte2017-04-151-1/+118
| | | | | | | | | | The ipa.c file already contained code to parse an ID RESPONSE into the 'struct ipaccess_unit', but it didn't so far contain code to put together an ID RESPONSE packet based on that structure. Let's change that with ipa_ccm_make_id_resp() and a helper wrapper ipa_ccm_make_id_resp_from_req(). Change-Id: Icbcd8827a75fd5f3393351c1ca372de85275ad35
* fix various compiler warnings (on FreeBSD-11.0)Harald Welte2017-02-081-0/+1
| | | | | | | FreeBSD 11.0 uses clang version 3.8.0 which spits various warnings during libosmocore compilation. Let's clean this up a bit. Change-Id: Ic14572e6970bd0b8916604fabf807f1608fa07e5
* ipa: Remove unneeded #include statementHarald Welte2017-01-231-1/+0
| | | | Change-Id: I69f2891a2bea6f87f079b6778aa01ee27a25001b
* Extend IPA error loggingMax2016-11-161-2/+2
| | | | | | | | Output more information in case of IPA protocol errors to make debugging easier. Change-Id: I7632d6e679e076bfbec9abc12da4a46cc27ccea1 Related: SYS#3028
* ipa: recv is declared in different headers on BSDHolger Hans Peter Freyther2015-11-091-0/+2
| | | | | | | | Include the headers mentioned by the manpage ipa.c:346:9: warning: implicit declaration of function 'recv' is invalid in C99 [-Wimplicit-function-declaration] ret = recv(fd, msg->tail, needed, 0);
* ipa: Properly parse LV stream of a ID_GET requestHolger Hans Peter Freyther2015-06-021-3/+13
| | | | | | | | For some reason the structure is closer to be a LV (length and value). The value is actually a tag but it is counted inside the length. Introduce an overload of the parse function to provide an offset for the length. This will be taken from the returned length.
* ipa: Return -errno instead of -1 in ipa_sendJacob Erlbeck2014-12-221-1/+1
| | | | | | | | | | | | | Currently, the ipa_send function returns -1 in one execution branch to indicate an error and -EIO in another. This is not consistent and can lead to a misinterpretation of the error code, since -1 is -EPERM and in general, EPERM is not returned by write(2). This patch changes the return code to -errno instead of -1 for the case that write(2) fails for same reason. So -rc is always a sensible error value if there is a failure. Sponsored-by: On-Waves ehf
* Change copyright notice of ipa.c to GPLv2+Harald Welte2014-10-261-4/+4
| | | | ... which it should have been all along.
* ipa: use %z as format string whne printing sizeof() resultHarald Welte2014-08-211-1/+1
| | | | thanks to Holger for reminding me
* ipa: fix compiler warning regarding printf (%d -> %lu)Harald Welte2014-08-211-1/+1
|
* ipa: rename functions for consistencyHarald Welte2014-08-201-0/+446
As we are breaking builds by moving functions from libosmo-abis to libosmocore anyway, we might as well give functions more appropriate names. ipaccess is a company, while IPA is the multiplex protocol, and CCM is the protocol used for establishing identities on the IPA multiplex.