aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/bsc-nat
AgeCommit message (Collapse)AuthorFilesLines
2016-11-24move to libcommon-cs: net init 3: actual moveNeels Hofmeyr1-0/+1
Reincarnate gsm_network_init() as the parts not specific to libbsc. Move from bsc_network_init() those bits that are not BSC specific (and useful for upcoming osmo-cscn). Add libcommon-cs to all linkages that use gsm_network_init(). Note: the only requirement to allow linking gsm_network_init() without libbsc is to keep the call to gsm_net_update_ctype() out of libcommon-cs. The other items are kept out of libcommon-cs because it makes sense semantically. But the separation is not strong in that the BSC specific data members are of course still omnipresent in struct gsm_network. If bsc_network_init() is not called, these are not initialized properly -- for now no users of uninitialized members exist. So this is just a first step towards a sensible split of the BSC and MSC gsm_network structs. The long term aim should be to have entirely separate structs with some common general items. Change-Id: If06316b97002390dc9a434686750cb96193ea63b
2016-10-13msgb talloc ctx: initialize in all main() scopesNeels Hofmeyr1-0/+1
Add msgb_talloc_ctx_init() call to many main() functions still lacking a msgb talloc context. Change-Id: Ib0d6751260659cabf18a7ce80680ba2fb4228ea1
2016-09-15Consistenly format variables in */Makefile.am filesAlexander Huemer1-22/+54
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-05-25filter/nat: Fix the context for the imsi assignmentHolger Hans Peter Freyther1-0/+3
In c09f8a3b7fb94ccef41e33c32bfe2bff1ffe0e44 as part of a cleanup I accidently changed the talloc context from "con" to "bsc". The issue occurred at an earlier commit when assigning req.ctx to the "wrong" context. The allocation needs to be scoped by the struct nat_sccp_connection and not the connection from BSC to NAT. Before we have a nat_sccp_connection we scope the copied imsi to the bsc_connection and then steal it, but for the identity resp we will always have a nat_sccp_connection and can already use the right context. Change-Id: I53789aad2809e19338ad3b2deb72c4757e7bd524 Related: OS#1733 Reviewed-on: https://gerrit.osmocom.org/102 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org> Reviewed-by: daniel <dwillmann@sysmocom.de> Reviewed-by: Holger Freyther <holger@freyther.de>
2016-04-12NAT: allow allocating BSC in arbitrary orderMax1-7/+7
Check for existing BSC before allocating new one. Track number of remaining BSCs on deallocation. Explicitly use BSC number in allocation function.
2015-08-13nat: Forward SDP files with multiple payload types in itHolger Hans Peter Freyther1-2/+2
The parsing code assumed that there will be a single payload type and this assumption is clearly wrong. Forward all of the payload types. The code is still only extracting the first type from the list. The variable name has been renamed to reflect this.
2015-08-0364bit: Fix compiler warnings in regard to 64bitHolger Hans Peter Freyther1-1/+1
vty_interface_layer3.c:584:4: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat=] sizeof(subscr->extension)-1, VTY_NEWLINE);
2015-05-03filter: Move the con_type into the filter_stateHolger Hans Peter Freyther1-11/+11
2015-05-03filter: Remove nat_sccp_connection from public APIHolger Hans Peter Freyther1-1/+1
2015-05-03filter: Separate SCCP/BSSAP extraction and gsm48 codeHolger Hans Peter Freyther1-1/+2
For the BSC we will have the gsm48_hdr and don't need to find data within SCCP. For legacy reasons we need to initialize con_type, imsi, reject causes early on and need to do the same in the filter method.
2015-05-03filter: More renaming and remove of "NAT" from itHolger Hans Peter Freyther1-11/+11
2015-05-03filter: Remove nat from bsc_nat_acc_lst and replace with msgHolger Hans Peter Freyther1-6/+6
2015-05-03filter: Cease out "struct bsc_nat" from the APIHolger Hans Peter Freyther1-2/+2
This means we need to require a talloc context and simply operate on the list. I had considered creating a structure to hold the list head but I didn't find any other members so omitted it for now.
2015-05-03filter: Move the method definition to the filter moduleHolger Hans Peter Freyther1-0/+1
Move the filter methods to the filter module. This is still only usable for the NAT and the _dt/_cr filter routines need to move back to the bsc_nat in the long run.
2015-05-03filter: Move the gsm 04.08 filter to a common placeHolger Hans Peter Freyther1-2/+3
For customer requirements we want to be able to do filtering on the BSC as well. The same messages need to be scanned and the same access-lists will be looked at. In the future we might even split traffic based on the IMSI. Begin with moving the code to a new top level directory and then renaming and removing the nat dependency.
2015-04-23nat: Make mode-set patching optionalHolger Hans Peter Freyther2-1/+17
2014-08-29nat: Introduce a config free for the test and fix valgrind issuesHolger Hans Peter Freyther1-9/+16
The talloc_free on the nat lead to the freeing of the bsc_config which lead to freeing of the rate_ctr_group. The rate_ctr_group remained in a global list and the next creation of a bsc_config would access dead memory. Fix it. The free routine is only meant to be used by the test, for the real nat we would need to make sure that all connections and other state that refers to the cfg is removed/closed first. Fix various memleaks in the test while we are at it. There are still some to fix. ==7195== Invalid write of size 4 ==7195== at 0x4043171: rate_ctr_group_alloc (linuxlist.h:65) ==7195== by 0x804D893: bsc_config_alloc (bsc_nat_utils.c:174) ==7195== by 0x804B5D2: main (bsc_nat_test.c:954) ==7195== Address 0x4311cbc is 52 bytes inside a block of size 208 free'd ==7195== at 0x4029D28: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==7195== by 0x4048D98: _talloc_free (talloc.c:609) ==7195== by 0x4052806: talloc_free (talloc.c:578) ==7195== by 0x804B58A: main (bsc_nat_test.c:940)
2014-08-29tests: bsc-nat: fix bsc_mgcp_rewrite() with osmuxPablo Neira Ayuso1-1/+1
Pass -1 to indicate no osmux, before ("b769f3c osmux: add osmux circuit ID management and resolve NAT problems"), 0 was indicating no osmux.
2014-08-21move libctrl from openbsc to libosmoctrl (libosmocore.git)Harald Welte1-3/+3
2014-05-22mgcp: add voice muxer supportPablo Neira Ayuso2-3/+3
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-01-20nat: Introduce reject cause to bsc_nat_acc_lst_entryHolger Hans Peter Freyther1-1/+102
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-1/+1
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-12-05mgcp: Add tests for payload types in MGCP messagesJacob Erlbeck2-1/+20
These tests mainly check whether the SDP parsing works properly by looking at the payload type detected. Sponsored-by: On-Waves ehf
2013-09-19nat: Fix make distcheck for the natHolger Hans Peter Freyther1-4/+4
The jenkins runs make distcheck in the default configuration and not with the nat enabled. DISTCHECK_CONFIGURE_FLAGS="--enable-nat" make distcheck
2013-07-31nat: Implement a post-routing for the NAT softwareHolger Hans Peter Freyther2-0/+62
* 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: Fix some memory leaks in the testcases.Holger Hans Peter Freyther1-0/+5
The test cases did not free some of the resources it allocated. Improve the situation a bit. There is still data allocated that is not freed at exit.
2013-07-31nat: Allow to use the prefix lookup to rewrite numbersHolger Hans Peter Freyther3-1/+54
* 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-04nat: The second call didn't really add anything to the test.Holger Hans Peter Freyther1-3/+0
Avoid: Coverity CID 1042323
2013-06-12Makefile.am: Use AM_CPPFLAGSAlexander Huemer1-1/+1
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-04-16nat: Extract the LAC/CI from the Complete Layer3 InformationHolger Hans Peter Freyther2-0/+36
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 Freyther1-7/+7
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 Freyther2-2/+75
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: We want the remote to respond to our DLCX requestHolger Hans Peter Freyther2-0/+2
We want to send a TRAP with the MGCP statistics from the NAT and the connected BSC. The BSC endpoint can be either released because of a DLCX from the MGCP CallAgent or the SCCP Connection release on the A-link. This is why we need to queue the statistics when the deleting the endpoint on the BSC. The processing is continued once the response arrives. This code assumes that the response of the DLCX will be sent by the remote side. The current amount of outstanding responses can be seen on the VTY. This assumption is based on the fact that the BSC has already responded to the CRCX and maybe to the MDCX. The MGCP RFC is bended to prefix the transaction identifier with "nat-" to easily detect the response and hand it to the handler. This will then parse the response and generate the TRAP. The current version is v1. We assume that the transaction space is big enough and we will not re-assign the transaction identifier too early.
2013-04-16nat: Make it possible to send MGCP messages through the IPA multiplexHolger Hans Peter Freyther1-0/+6
Instead of handling MGCP through the UDP socket, read and write messages through the ipa connection to the MSC.
2013-01-07nat: Introduce a global IMSI barr list using red-black treesHolger Hans Peter Freyther5-1/+95
2013-01-07nat: Allow the filter to select the reject causeHolger Hans Peter Freyther1-5/+10
In preparation for another kind of black-list allow the filter code to decide how the connection should be rejected. Introduce a new struct that will carry the reject causes for certain operations.
2013-01-07nat: Move the IMSI/TMSI filtering to a new and dedicated fileHolger Hans Peter Freyther1-0/+1
Move all routines related to filtering to a separate file.
2013-01-07nat: Extract the message re-writing from the utils to a dedicated fileHolger Hans Peter Freyther1-0/+1
Move the code around to make it more clear what the routines should do.
2012-11-07nat: Inject a a=fmtp:%d to force the right AMR codeHolger Hans Peter Freyther1-3/+3
This assumes that AMR is used and/or the mode-set is ignored for other codecs by the remote end.
2012-03-26nat: Add another test case for TP-SRR clearing and number rewriteHolger Hans Peter Freyther2-3/+42
2012-01-18nat: Internationalize the TP-DA if it starts with a 00Holger Hans Peter Freyther1-4/+4
Internationalize the number like we do it for Call Control. Update the test result to match this new behavior.
2012-01-18nat: Prepare to rewrite the TP-DA number of a SMS submit.Holger Hans Peter Freyther3-2/+56
Introduce number rewriting of SMS-SUBMIT. Introduce a new list, move code around to help with finding a new number, somehow the number encoding for TP-DA is borked, 03.40 references 04.11 but the length appears to be strlen(number) without taken the type field into account.
2012-01-18nat: Print the sizes and the offending data in case of a failureHolger Hans Peter Freyther1-1/+5
2012-01-15nat: Add the bsc_data.c file to the EXTRA_DISTHolger Hans Peter Freyther1-1/+1
2012-01-10nat: Implement clearing of TP-SRR flags from TPDUsHolger Hans Peter Freyther3-3/+67
Match IMSI and destination address against a set of entries, if it is matching the header will be modified and no sender report will be requested. Change the test case to request the sender report and then verify that this bit is reset to 0.
2012-01-10nat: Reduce copy and paste in the test, create a verify_msgHolger Hans Peter Freyther1-50/+23
2012-01-10nat: Use the link_id from the original message in the new DTAP messageHolger Hans Peter Freyther1-1/+1
SMS went from SAPI=3 to SAPI=0 and nobody notices on the NAT->MSC direction.
2012-01-06tests: Introduce running tests with GNU autotest in OpenBSCHolger Hans Peter Freyther2-1/+22
The quality of the tests is of different value but it is good to get started and improve from here.
2012-01-06nat: Log test output stdout using printf in prep for GNU autotestHolger Hans Peter Freyther1-78/+97
2011-08-22misc: Move the bsc_parse_reg to libcommom and name it gsm_parse_regHolger Hans Peter Freyther1-3/+3
Move the regexp parsing code from the NAT to libcommon as it will be used by the NAT and BSC code. This also adds the #include <regex.h> include to gsm_data. This header should be split up.