aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat
AgeCommit message (Collapse)AuthorFilesLines
2014-08-21move libctrl from openbsc to libosmoctrl (libosmocore.git)Harald Welte4-9/+11
2014-08-20adopt recent IPA related symbol renameHarald Welte4-10/+13
... which happened during recent migration of IPA functionality from libosmo-abis into libosmocore.
2014-07-22mgcp: Change API to remove memory management from the nameHolger Hans Peter Freyther1-3/+3
Jacob pointed out that "free_endp" refers to the memory of the endpoint being freed. What we want is actually a way to release an endpoint (and the resource it allocated) or in the case of the testcase/testapp initialize the data structure correctly. Introduce two names for that.
2014-07-07nat: Fix the documentation issue with the osmux commandHolger Hans Peter Freyther1-1/+1
Documentation error (missing docs): <command id='osmux (on|off)'> <param name='off' doc='(null)' />
2014-07-07libbsc, osmo-bsc{, _nat}: Prevent unaligned access when casting TLVP_VALDaniel Willmann1-1/+1
foo = *((uintXX_t *) TLVP_VAL(...) can lead to unaligned access. To prevent that use tlvp_valXX_unal() to get the values.
2014-05-22mgcp: add voice muxer supportPablo Neira Ayuso3-12/+44
This patch adds the voice muxer. You can use this to batch RTP traffic to reduce bandwidth comsuption. Basically, osmux transforms RTP flows to a compact batch format, that is later on decompacted to its original form. Port UDP/1984 is used for the muxer traffic between osmo-bsc_nat and osmo-bsc_mgcp (in the BSC side). This feature depends on libosmo-netif, which contains the osmux core support. Osmux is requested on-demand via the MGCP CRCX/MDCX messages (using the vendor-specific extension X-Osmux: on) coming from the BSC-NAT, so you can selectively enable osmux per BSC from one the bsc-nat.cfg file, so we have a centralized point to enable/disable osmux. First thing you need to do is to accept requests to use Osmux, this can be done from VTY interface of osmo-bsc_nat and osmo-bsc_mgcp by adding the following line: mgcp ... osmux on osmux batch-factor 4 This just initializes the osmux engine. You still have to specify what BSC uses osmux from osmo-bsc_nat configuration file: ... bsc 1 osmux on bsc 2 ... bsc 3 osmux on In this case, bsc 1 and 3 should use osmux if possible, bsc 2 does not have osmux enabled. Thus, you can selectively enable osmux depending on the BSC, and we have a centralized point for configuration from the bsc-nat to enable osmux on demand, as suggested by Holger. At this moment, this patch contains heavy debug logging for each RTP packet that can be removed later to save cycles. The RTP ssrc/seqnum/timestamp is randomly allocated for each MDCX that is received to configure an endpoint.
2014-05-06nat/bsc: Check proto before calling ipaccess_rcvmsg_baseHolger Hans Peter Freyther1-1/+1
The code in the BSC/NAT called ipaccess_rcvmsg_base without checking if the protocol is IPA. This lead the BSC to respond to SCCP messages with an "ID ACK". From a quick look neither the code of ipaccess_rcvmsg_base in OpenBSC nor the copy of libosmo-abis ever checked the protocol header. So this code has been wrong since initially being created in 2010.
2014-04-03ipa: Be consistent in checking conn->cfg (Coverity)Jacob Erlbeck1-1/+1
Coverity complains about checking connection->cfg in bsc_close_connection() at one place but not at the second. This patch fixes this by adding a check before accessing cfg when generating the 'partial message' log message. Fixes: Coverity CID 1195180 Sponsored-by: On-Waves ehf
2014-04-03nat: Mention the the BSC the SCCP connection was onHolger Hans Peter Freyther1-3/+5
The log message lacked a lot of context. A SCCP connection is created on behalf of a configured BSC. This way we should be able to always list this information.
2014-04-01ipa: Use enhanced ipa_msg_recv_buffered() to cope with partioned IPA messagesJacob Erlbeck2-6/+21
The old ipa_msg_recv() implementation didn't support partial receive, so IPA connections got disconnected when this happened. This patch adds the handling of the temporary message buffers and uses ipa_msg_recv_buffered(). It has been successfully tested by jerlbeck with osmo-nitb and osmo-bsc. Ticket: OW#768 Sponsored-by: On-Waves ehf
2014-03-23ctrl: Move the lookup into a separate file in preparation for GPRSHolger Hans Peter Freyther1-1/+1
For GPRS the look-up via bts/trx does not make any sense and would introduce bad depdencies for the SGSN. Move the look-up code to a new file and introduce new setup methods.
2014-03-04nat: Introduce command to remove an access-list-nameHolger Hans Peter Freyther1-0/+5
2014-03-04nat: Implement setting the access-control-name through CTRL interfaceHolger Hans Peter Freyther1-19/+99
For operation we want to switch the access-list of a BSC at runtime in a programatic way. Sponsored-by: On-Waves ehf
2014-01-20nat: Make the access-list deny cause configurableHolger Hans Peter Freyther1-4/+12
Add two optional arguments to the imsi-deny rule for the reject cause and verify that it is saved out.
2014-01-20nat: Introduce reject cause to bsc_nat_acc_lst_entryHolger Hans Peter Freyther2-4/+14
The filtering architecture already allowed to specify a reject reason but this has not been used for the access-lists. Extend the access-list to include a reject reason and extend the test case to honor it.
2013-12-05mgcp/nat: Take payload type from SDP dataJacob Erlbeck1-4/+13
So far the payload type used in RTP streams has been taken from the trunk configuration in NAT mode. This patch changes the implementation to use the payload type announced in the SDP part of MGCP messages and responses. SDP descriptions more than one m=audio line are not yet supported properly (always the last one is taken). Ticket: OW#466 Sponsored-by: On-Waves ehf
2013-10-30vty: Use vty_install_default() instead of bsc_install_default()Jacob Erlbeck1-3/+3
Remove ournode_exit_cmd, ournode_end_cmd, and bsc_install_default() since this functionality is provided by the current libosmocore. Replace calls to bsc_install_default() by call to vty_install_default() with the following semantic patch: @rule1@ expression N; @@ - bsc_install_default(N); + vty_install_default(N); Ticket: OW#952 Sponsored-by: On-Waves ehf
2013-09-03nat: Remember the original dest local reference in the parsed structHolger Hans Peter Freyther2-1/+4
In case of the RLSD coming from the MSC we are patching the address in-situ but for local calls set con = NULL. We then answered the RLSD with the wrong reference and the MSC kept on trying.
2013-09-03nat: Fix the log message of the code in case of an allocation failureHolger Hans Peter Freyther1-1/+1
This wrong log message appears to be the result of copy and paste
2013-09-03bsc_msc: Add a name field to the MSC Connection to differentiate linksHolger Hans Peter Freyther1-3/+10
Assign a static name to a MSC Connection and use it. In case there are multiple connections we can now more easily identify them. This is only used for the NAT right now, the BSC could start to name the various MSC connections too.
2013-09-02vty: Rename 'mgcp-through-msc-ipa' command to 'use-msc-ipa-for-mgcp'Jacob Erlbeck1-5/+5
Currently the 'mgcp' command fails in the 'config-nat' node, because it get confused with 'mgcp-through-msc-ipa' which is executed instead because of the prefix based command selection. Thus the latter command is renamed by this patch to avoid the common prefix. The workaround in the test suite is removed.
2013-09-02vty: Use generic 'end' and 'exit' commandsJacob Erlbeck1-9/+3
Add bsc_install_default() and replace all install_default() This patch adds bsc_install_default() which calls install_default() and add 'exit' and 'end'. All other calls to install_default() are replaced by calls to bsc_install_default(). Since 'exit' and 'end' are now added automatically to each node, the explicit registrations of these commands are removed by this patch, too. The related tests succeed now without work-arounds (except for the 'config' node itself which is part of libosmocore).
2013-09-02nat: Attempt to follow the MODULE_METHOD pattern for methodsHolger Hans Peter Freyther2-5/+5
Rename methods to be like bsc_ussd_ACTION.
2013-09-02nat: Use bsc_nat_msc_is_connected instead of accessing it directlyHolger Hans Peter Freyther1-2/+2
2013-08-27libmgcp: add enum mgcp_rolePablo Neira Ayuso1-1/+1
This enum indicates if the mgcp is running on the BSC or the BSC-NAT.
2013-08-14nat/ussd: Add 'show ussd-connection' vty commandJacob Erlbeck2-0/+32
This command returns the current state of the connection to the USSD side channel provider. It shows whether a provider has been connected and authorized or not. Fixes: OW#953
2013-08-13nat: Fix potential memory leak when reading a messageHolger Hans Peter Freyther1-0/+1
Spotted while going through the code with Jacob. We could have leaked the msgb in case of error.
2013-08-13nat: Misc changes spotted while going through the file with JacobHolger Hans Peter Freyther1-3/+3
* Spell Configure correctly * Use %s and VTY_NEWLINE instead of \n
2013-07-31nat: Use the DCC region for number rewriting and increase debug outputHolger Hans Peter Freyther1-8/+27
2013-07-31nat: Implement a post-routing for the NAT softwareHolger Hans Peter Freyther3-19/+69
* The post-routing is applied after the first re-writing. To do this the new number is copied back into the called data structure. * Add a testcase that goes from 0172 to 0049 and then back to 0049 using the post rule with a table lookup.
2013-07-31nat: Allow to use the prefix lookup to rewrite numbersHolger Hans Peter Freyther3-7/+117
* Increase the rewritten rule to five digits (this is the easiest for the unit test). This will add another 40kb to the runtime size. * Create a unit test that tests adding and removing the prefix rules. * Use the regexp match to replace from one package
2013-07-31nat: Introduce a prefix lookup tree (trie) for number rewritingHolger Hans Peter Freyther3-1/+244
* It is a trie. The max depth of the trie is the length of the longest prefix. The lookup is O(lookuped_prefix), but as the prefix length is limited, the lookup time is constant. * Each node can hold the entire prefix, has place for the rewrite rule with up to three digits. * A trie with 20k entries will take about 3MB ram. * Filling the trie 100 times takes ~800ms on my i7 laptop * 10.000.000 lookups take 315ms.. (for the same prefix). * 93/99 lines are tested, 6/6 functions are tested, 49 of 54 branches are tested. Only memory allocation failures are not covered * A late addition is to handle the '+' sign and to increase the number of chars in the rewrite prefix. The timing/line coverage has not been updated after this change.
2013-07-31nat: Add a no number-rewrite command and call it through a VTY testHolger Hans Peter Freyther1-2/+15
The test is just testing the invocation but does not verify that the side effect of this call. It is good enought for now.
2013-07-05nat: The con variable is not assigned at this pointHolger Hans Peter Freyther1-5/+0
Coverity pointed out that this code is logically dead. Quickly judging the code we will forward the RSLD message anyway. Remove the code for now and next time I work on the NAT/USSD bridge I will have a look at the flow of the RLSD messages. Fixes: Coverity CID 1042327
2013-07-05nat: number could point to an address on the stack that can be reusedHolger Hans Peter Freyther1-1/+1
The number = int_number assignment will make the number point to the stack and as the int_number goes out of scope at the end of the if statement other code could re-use this stack for other memory. Fixes: Coverity CID 1042325
2013-07-05nat: Address coverity warning about uninitialized addrHolger Hans Peter Freyther1-0/+1
Use memset on the addr to initialize the entire structure. Fixes: Coverity CID 1042324
2013-07-05nat: Please coverity and initialize the saveptr to NULLHolger Hans Peter Freyther1-1/+1
Coverity complains about the saveptr used in the strtok_r. This is not a bug because we pass a string as part of the first call to strtok_r but it is easier to just initialize it. Addresses: Coverity CID 1042323
2013-07-03nat: Fix compiler warning and cast uint16_t to uint8_tHolger Hans Peter Freyther1-2/+2
2013-06-12Makefile.am: Use AM_CPPFLAGSAlexander Huemer1-1/+1
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-05-13nat: fix use after free in forward_sccp_to_btsPablo Neira Ayuso1-2/+5
valgrind detected an use after free in the path of forward_sccp_to_bts. The 'parsed' object is referenced from update_con_authorize.
2013-04-29nat: Include LAC/CI as TV values at the end of the 'status' messageHolger Hans Peter Freyther1-0/+10
Extend the status message and send LAC/CI as part of the status message. It is using TV to allow sending more fields in the feature. We only need to encode the data and this is why there is no tlv description yet.
2013-04-22nat: Use memcmp for the token on the USSD interface as wellHolger Hans Peter Freyther1-6/+13
This is similar to the token on the A-interface. There are no more token based authentication in the NAT.
2013-04-22nat: Move the callstats to a new header file due sccp usageHolger Hans Peter Freyther1-0/+1
The bsc_nat.h is included by common_vty.c so we may not used sccp_types.h in the bsc_nat.h header file. Move the callstats to a new file and include it where it is needed.
2013-04-16nat: Extract the LAC/CI from the Complete Layer3 InformationHolger Hans Peter Freyther2-2/+65
Find the Cell Identifier from the Complete Layer3 Information and store it for future reference. We could begin to verify that the LAC/CI used really belongs to the BSC.
2013-04-16nat: Rename "struct sccp_connections" to "struct nat_sccp_connection"Holger Hans Peter Freyther7-48/+48
The name sccp_connection is used in the osmo-sccp code, sccp_connections was used in the NAT for tracking a sccp_connection. Rename it so it is obvious that the struct belongs to the nat. The rename was done with sed: $ sed -i s,"struct sccp_connections","struct nat_sccp_connection",g \ include/openbsc/*.h src/osmo-bsc_nat/* tests/*/*
2013-04-16nat: Allow to re-write international numbers in the CC Setup messagesHolger Hans Peter Freyther1-7/+19
Prepend the international number with a '+' and then do the normal re-writing on it. There are a couple of ways to handle this: \+([0-9]), \+[0-9][0-9]([0-9]), \+49([0-9]) Add a test case for the international re-write based on an already internationalized number.
2013-04-16nat: Allow to daemonize the NAT processHolger Hans Peter Freyther1-1/+5
Add handling for the 'D' option
2013-04-16nat: Name the variable more properly and begin with net.1.bsc.%dHolger Hans Peter Freyther1-3/+4
We can identify the NAT and BSC given the types of the variable, no need to put them into the value itself.
2013-04-16nat: Include the sccp_src_ref and sccp_dst_ref for this callHolger Hans Peter Freyther1-2/+6
This can help with some post analysis for failed calls and helps finding the connection in the pcap trace.
2013-04-16nat: Do not allow the amount of pending responses to grow infinitelyHolger Hans Peter Freyther1-0/+15
Limit the amount of pending DLCX responses to three times the amount of available endpoints. Currently all MGCP messages are sent and handled in sequence.