aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp
AgeCommit message (Collapse)AuthorFilesLines
2020-10-18Migrate from BSC_FD_* to OSMO_FD_*Harald Welte2-3/+3
Change-Id: If45434eb0d7da69feb4001e0ac35f0e297bdeef5
2019-04-30libmgcp: Parse CI as hex string in verify_ci()daniel/wipDaniel Willmann1-1/+1
In verify_ci CI needs to be parsed as hex instead of dec number as well. Fixes: OS#3951 Change-Id: I687b467756fa30cbc454e3583c86159d9abcc7d9
2019-04-23osmo-bsc_nat: Parse MGCP Connection ID as hexDaniel Willmann1-4/+4
Our ttcn3-bscnat-tests would randomly fail. After the CRCX ACK returns from the MSC the bsc-nat reports it could not find a CI it it and deletes the connection on the BSC-side. This happens because the field is parsed as a decimal value instead of hexadecimal. So a value of 00FED122 is parsed as '0' which is a reserved value in our program. This fix parses the field as hexadecimal value and also logs an error if the value happens to be 0. make check will now test if a hexadecimal CI is parsed correctly. Fixes: OS#3951 Change-Id: I49b8b61644bf706162102dce268cae2265536fc5
2018-10-16mgcp: osmux_send_dummy: Fix return without valuePau Espin Pedrol1-1/+1
Not really critical since only user of this function doesn't check the return value. Fixes commit: 4a2cc9eb0a0f9424c16b26fcb757483a39d67482 Change-Id: I438349bffaa46a10ad8983090a4b17aed7e00d82
2018-10-12mgcp: osmux: Improve checks around activating and using enabled osmuxPau Espin Pedrol1-42/+43
* Refactor code to have unified checks on all paths activating Osmux. * Improve checkings at activation time and add logging. * Code now enforces endp osmux status to be enabled before processing the frame through endp->osmux.out. Before, a delayed or bad pkt could arrive and be processed by an endp with osmux not enabled, using endp->osmux.out that was not initialized and ended up crashing: libosmo-netif/src/osmux.c:281:3: runtime error: member access within null pointer of type 'struct msgb' This could also happen if a BSC started sending or we received (non legacy dummy) osmux frames before we received the BSC CRCX ACK agreeing on osmux negotiation and switching to ACTIVATING state. Related: SYS#4350 Change-Id: I3536169c94e65f999aaa9c9e43cc7dab8551d30f
2018-10-12mgcp: osmux: allow enabling osmux only on correct activating statePau Espin Pedrol1-3/+3
State ACTIVATING is set once negotiation between the 2 parts went successfuly. Change-Id: I21eb30fa8d48f3d592ff197bd74e673fdac51c1d
2018-10-12mgcp: osmux: Make func handling dummy frames independent of endp typePau Espin Pedrol1-3/+3
Change-Id: I285f1cb693b243ecd404337f2bb5b74ddd32b123
2018-10-12mgcp: osmux: Move parse_cid of legacy dummy frames to own functionPau Espin Pedrol1-10/+15
Change-Id: If9249fb0ee2e33c7dd2ab817480776acaa784cc2
2018-10-12mgcp: osmux: Don't process regular osmux frames if disabled by cfgPau Espin Pedrol1-6/+12
Prior to this commit, the check was only done on legacy dummy frames. Change-Id: Ief4e62fe68a11a60d90292c72d1263fd1f728356
2018-10-12mgcp: osmux_send_dummy: Avoid logging incorrectly and sending if osmux not ↵Pau Espin Pedrol1-0/+8
enabled Change-Id: I5244cb9304adef3aa612b8126bf95e77562c801c
2018-10-12mgcp: Log endpoint nr consistently as hexPau Espin Pedrol2-7/+7
Change-Id: I281964935312161d1da49e8035c5bf3bb7bf9c5c
2018-10-12mgcp: Avoid initing output without enabling osmuxPau Espin Pedrol1-4/+4
Otherwise we end up in a weird state where we have timers set up but osmux is still flagged as not enabled. Change-Id: I15c3a1a6bdf2566b03d1d543d8d15e4117a53622
2018-09-17mgcp_osmux: Use define to calculate rtp_ssrc_winlenPau Espin Pedrol1-2/+2
Since that define is already used to allocate size of osmux_cid_bitmap, let's use it here too instead of hardcoding its value. Change-Id: I768ca1b510bf44508ae064dc31620e739260470b
2018-09-17mgcp: Fix (again) osmux_cid_bitmap static array size calculationPau Espin Pedrol1-2/+2
A previous commit merged today fixed array size boundary (multiple of 8 bits), but removed a required +1 which should be kept on top, because OSMUX_CID_MAX specified the maximum number used by a CID, that is (0,OSMUX_CID_MAX), and as a result we require OSMUX_CID_MAX+1 slots. Fixes: 65f422ad5878165be0a1eb05605aa3099536f0c8 Change-Id: I182c9c1a6dd28a4c5c0d8107d53852cf47541592
2018-09-17mgcp: Fix osmux_cid_bitmap static array size calculationPau Espin Pedrol1-1/+1
Right now it's not a big issue since OSMUX_CID_MAX is 255, so 255+1 is 256 which fits array boundaries correctly (multiple of 8). However, if for example OSMUC_CID_MAX was modified to be 12, 12+1/8 = 1, so we'd have an undesired memory access when accessing last 4 CIDs. Change-Id: I5908ee44404686e68d61f255b7014af39c8f5703
2018-09-10mgcp_osmux.c: osmux_enable_endpoint: Fix incorrect return checkPau Espin Pedrol1-2/+2
osmux_xfrm_input_open_circuit returns 0 on success and -1 on error. Confusion comes from that function being implemented by calling osmux_batch_add_circuit which returns NULL on error. Change-Id: I98700aa1e2fab9784706bfac1a47cc84635172b7
2018-08-20mgcp: add VTY Option to force-realloc endpointsPhilipp Maier1-1/+13
Currently the force_realloc feature is turnd on and of in a hardcoded way. This patch makes the option available via VTY. Backport from osmo-mgw.git. Change-Id: Ic8740512c5ea0766ff6ceb1c28b9c2b3fe46e75f
2018-08-16vty: Fix typo writing bts-jitter-buffer-delay-{min,max}Pau Espin Pedrol1-2/+2
Change-Id: I83948ce626b924802d1963411a3f40c5fed24355
2018-04-19mgcp: switch to new osmux output APIsPau Espin Pedrol1-6/+11
Older ones are being deprecated as they may generate interleaved packets. Depends on libosmo-netif.git Change-Id I4e05ff141eb4041128ae77812bbcfe84ed4c02de. Change-Id: I189564fc63139c15314db8975afd423c7153ea32
2018-04-16nat: Add jitter buffer on the uplink receiverPau Espin Pedrol3-3/+137
Default usage values are defined in mgcp node, and can be per-BSC overriden on each bsc node. Change-Id: Ibf3932adc07442fb5e9c7a06404853f9d0a20959
2018-02-19mgcp_protocol: Don't print osmux stats if it is offPau Espin Pedrol1-18/+20
Otherwise we get Osmux stats during a session using RTP, which is confusing. Change-Id: I814b2051edc85ad5cbd04c96b785c208f6606683
2017-11-01vty: skip installing cmds now always installed by defaultNeels Hofmeyr1-2/+0
vty_install_default() and install_default() will soon be deprecated. Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b Change-Id: I4951982fc78ae167d8e16a672d7af44d703721a9
2017-08-14mgcp: Fix uplink activation of Osmux streamPau Espin Pedrol1-2/+4
Commit 575420637981828b64c1292ada015d7170b89390 introduced OSMUX_STATE_NEGOTIATING to fix a race condition present in osmo-bsc_nat. However, after this change osmo-bsc_mgcp cannot switch to OSMUX_STATE_ACTIVATING anymore, which means during osmux_send_dummy time it won't call osmux_enable_endpoint(), which in turn won't set endp type to MGCP_OSMUX_BSC. If MGCP_OSMUX_BSC is not set, uplink streams are sent using regular RTP instead of Osmux not matter it is enabled in config or not. Change-Id: Ibcb59aa1ca25408f82cc88c2d5b81177b5f276dc
2017-08-13mgcp_osmux: Remove unused parameterPau Espin Pedrol1-6/+3
Change-Id: Icb1e7cb15fe04642578f5292124ebc1eac9c9aa3
2017-06-09don't re-implement osmo_talloc_replace_string()Harald Welte1-12/+12
osmo_talloc_replace_string() was introducd into libosmocore in 2014, see commit f3c7e85d05f7b2b7bf093162b776f71b2bc6420d There's no reason for us to re-implement this as bsc_replace_string here. Change-Id: I6d2fcaabbc74730f6f491a2b2d5c784ccafc6602
2017-05-10src: use osmo_timer_setup()Pablo Neira Ayuso1-2/+1
Use new function available in libosmocore to set up timers. Compile tested only. Change-Id: Ibcfd915688e97d370a888888a83a7c95cbe16819
2016-12-09mgcp_protocol: Ensure we don't call strtok_r with NULL dataHarald Welte1-0/+1
Change-Id: I1dce4df6a49fe95db592b0598194e3a8b8b1b994 Fixes: Coverity CID 135181
2016-09-28COSMETIC: 'if' is not a function, so there is space before '('Harald Welte1-1/+1
Change-Id: Ic22623dffce998d70a3c67aa6e445de98f558ed7
2016-09-15Consistenly format variables in */Makefile.am filesAlexander Huemer1-10/+37
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-07-11osmux: Add negotiation state so race conditions can't disable osmuxDaniel Willmann1-3/+3
Without this commit it is possible that osmux is disabled again on links with high jitter. This happens when an MGCP response without X-Osmux header is received before the NAT receives an Osmux dummy frame from the other side. Ticket: SYS#2628, SYS#2627 Sponsored-by: On-Waves ehf Change-Id: Id624b0279aee5e2412059a10296ce7896e2d4628
2016-03-16mgcp: Fix compiler warnings on size_t on AMD64Holger Hans Peter Freyther1-4/+4
mgcp_transcode.c: In function 'decode_audio': mgcp_transcode.c:332:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_ERROR, ^ mgcp_transcode.c:332:4: warning: format '%d' expects argument of type 'int', but argument 8 has type 'long unsigned int' [-Wformat=] mgcp_transcode.c: In function 'encode_audio': mgcp_transcode.c:390:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_INFO, ^ mgcp_transcode.c:390:4: warning: format '%d' expects argument of type 'int', but argument 8 has type 'size_t' [-Wformat=] mgcp_transcode.c: In function 'mgcp_transcoding_process_rtp': mgcp_transcode.c:542:5: warning: format '%d' expects argument of type 'int', but argument 9 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_NOTICE, ^ mgcp_transcode.c:571:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_NOTICE, ^
2015-11-02mgcp_osmux: available circuit IDs from 0 to 255, not from 0 to 128Pablo Neira Ayuso1-1/+1
Holger reports that the bitmap that accounts for available Osmux circuit IDs is limited to 128, when the maximum number of circuit IDs are determined by the uint8_t field in the header (ie. 256 circuits). [hfreyther: Update the testcase now that we have more ids to allocate]
2015-10-12osmux: Allow to listen to a specific addressHolger Hans Peter Freyther3-1/+14
For a setup with multiple network interfaces be able to pick the one that osmux should be used/visible.
2015-10-12osmux: Remember the allocated CID and make sure it is releasedHolger Hans Peter Freyther2-0/+17
There appears to be a leak of CIDs: <000b> mgcp_osmux.c:544 All Osmux circuits are in use! There are paths that a CID had been requested and never released of the NAT. Remember the allocated CID inside the endpoint so it can always be released. It is using a new variable as the behavior for the NAT and MGCP MGW is different. The allocated_cid must be signed so that we can assign outside of the 0-255 range of it. Fixes: OW#1493
2015-10-12osmux: Allow to enforce using Osmux for the clientHolger Hans Peter Freyther2-14/+35
Some systems only want to use Osmux. In case only Osmux should be used fail if it has not be offered/acked. Client: Verified On, Off and Only with X-Osmux: 3 and without this field. <000b> mgcp_protocol.c:823 Osmux only and no osmux offered on 0x14 <000b> mgcp_protocol.c:884 Resource error on 0x14 NAT: Not tested and implemented Fixes: OW#1492
2015-10-12osmux: Add introspection for osmux.Holger Hans Peter Freyther1-0/+3
* Print number of used CIDs for the system * Hopefully this is just the beginning
2015-10-12osmux: Do not divide the number of bytes by eight.Holger Hans Peter Freyther1-2/+2
sizeof(uint8_t) == 1 and there is no need to create an array with 16 bytes and then only use the first two of them. This means the CID range is from 0 to 127 and we should be able to extend this to 256 by changing the array size to 32. Update the testcase now that we can have more than 16 calls with Osmux.
2015-10-12osmux: Test cid allocation and de-allocationHolger Hans Peter Freyther1-0/+14
* Test that one can get an id * That they are assigned predicatble right now * That returning them will make the number of used ones go down * That allocating more will fail
2015-10-08mgcp: Indicate where the sending failedHolger Hans Peter Freyther1-2/+6
The log message does not help and says where the data is being sent to. This is because we have both a RTP and RTCP port. Remember if we failed with RTCP or RTP and improve the log message. I was searching a case where the port was bound to a local address (e.g. 127.0.0.1) and tried to send the data to a public one (e.g. 8.8.8.8).
2015-09-07osmux: fix show online-helpPablo Neira Ayuso1-1/+1
Before: <command id='osmux dummy (on|off)'> <params> <param name='osmux' doc='RTP multiplexing' /> <param name='dummy' doc='Enable dummy padding' /> <param name='on' doc='Disable dummy padding' /> <param name='off' doc='(null)' /> </params> After: <command id='osmux dummy (on|off)'> <params> <param name='osmux' doc='RTP multiplexing' /> <param name='dummy' doc='Dummy padding' /> <param name='on' doc='Enable dummy padding' /> <param name='off' doc='Disable dummy padding' /> </params> </command> Note the 'null' string in 'off'. Reported by Holger.
2015-09-04mgcp: Fix grammar, clean-up return codesHolger Hans Peter Freyther1-7/+6
Mike's patch included clean-ups I want to apply separately and change them a bit. If we return from an else we don't need to put the else. * Try the E1 trunk first * Then try a local virtual trunk * Fail if none of the above returned
2015-09-04mgcp: Remove use of hardwired @mgw from endpoint IDs.Michael McTernan1-1/+1
Remove the host portion of the endpoint Id. This requires less configuration and we are probably fine to trust that MGCP only received messages designated for it.
2015-08-20mgcp: Allow to bind to different ports for net/bts portsHolger Hans Peter Freyther1-0/+46
When using multiple interfaces on a system one can now configure which will be served for the BTS ports and which will be served for the network. The direct usage of source_addr is now only to initialize the MGCP receiving port itself.
2015-08-20mgcp: Begin to separate network and bts endpointsHolger Hans Peter Freyther2-15/+19
Make it possible to bind the call-agent to a specific IP address and the network and bts end to different ip addresses. Begin by clarifying which source ip address we want to have.
2015-08-19mgcp: Add transcoding from PCMU as wellHolger Hans Peter Freyther2-0/+34
Use the existing ulaw encode/decode to support PCMU as well. The MERA VoIP switch has some severe issues with the GSM codec and it appears easier to enable transcoding for it. The mera switch doesn't appear to cope with codec change between a SIP 180 trying and the 200 ok connection result. Inserting the codec is touching too many places. Ideally we should have the transcoding function as pointer in the struct as well but the arguments differ.. so it is not a direct way forward.
2015-08-19osmux: add option to pad the circuit with dummy messagesPablo Neira Ayuso2-0/+23
Iridium is a satellite network which operates a GPRS-like that allows you to get speeds up to 128kbit/s. However, it takes from 5 to 6 secs to get the bandwidth allocated, so the conversation is garbled during the time. This patch uses the new dummy padding support in libosmo-netif that is controlled through the osmux osmux_xfrm_input_open_circuit(). This includes a new VTY option for osmux.
2015-08-17mgcp: Avoid crashing when rtpmap is not completeHolger Hans Peter Freyther1-0/+3
The NAT sends an incomplete SDP file for the purpose of informing the BSC about the remote IP/PORT early. The case of an incomplete SDP file was not considered. Check if there is a codec and if not skip it. TODO: We need to have a better end-point life cycle test.
2015-08-14mgcp: Allow to enforce that the codecs need to matchHolger Hans Peter Freyther2-3/+26
We have a lot of legacy that I am afraid to break. We have everything in place to make a good codec selection (e.g. if we can avoid transcoding, pick the one with best quality or the lowest speed). Right now I have a specific case where from all options I want to pick GSM. Guard the codec compat check behind the disallow transcoding option to make sure to not break legacy application.
2015-08-14mgcp: Turn SDP file parsing in a two stage processHolger Hans Peter Freyther1-28/+108
First collect everything we know and the mapping. E.g. a genuis could remap "3" to "AMR" so we only know the codecs once we are at the end of the SDP file. Once we have collected everything we can select the audio codecs. The current code is compatible in that two codecs will be selected regardless of if they make any sense or not. mgcp_set_audio_info could re-use some of our codec information but then the caller in the MGCP protocol needs to be updated as well as we use the "I: GSM" information to derive the codec from there.
2015-08-14mgcp: Move the SDP handling into a separate file/moduleHolger Hans Peter Freyther3-218/+198
The SDP file handling will get more complicated in terms of codec selection so let's remove it from the protocol handling before we start blowing it up in size.