aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
AgeCommit message (Collapse)AuthorFilesLines
2014-09-08gbproxy: Show number of stored messages in VTY showJacob Erlbeck1-3/+12
This patch extends the 'show gbproxy tllis' command to display the number of stored messages per tlli_info if there are any. Sponsored-by: On-Waves ehf
2014-09-08gbproxy: Forward SGSN originated STATUS messages with BVCIJacob Erlbeck1-4/+8
Currently all STATUS messages coming from the SGSN are just logged and dropped. This prevents the PCU from recognising that the (secondary) SGSN doesn't know about a certain BVCI and might require a reset procedure. This patch changes gbprox_rx_sig_from_bss() to forward STATUS messages with cause "Invalid BVCI" containing a BVCI to the BSS. Note that this will not forward broken "Invalid BVCI" messages which do not include a BVCI IE. Sponsored-by: On-Waves ehf
2014-09-08gbproxy: Make STATUS messages spec compliantJacob Erlbeck2-7/+7
Currently the gbproxy sends STATUS messages that are not compliant to GSM 08.18, 10.4.14.1: The BVCI must be included if (and only if) the cause is either "BVCI blocked" or "BVCI unknown". This patch adds a missing BVCI to UNKNOWN_BVCI and BVCI_BLOCKED status messages if the BVCI is available. Otherwise, INV_MAND_INF is used instead. Sponsored-by: On-Waves ehf
2014-09-08gbproxy: Check tlli_info when patching, fix APN patchingJacob Erlbeck5-15/+18
Currently the numeric TLLI or tlli_info's enable_patching flag is used to decide, whether a APN shall be patched or the secondary SGSN shall be used. Using the numeric TLLI imposes a problem, when TLLI/P-TMSI patching is used, since gbproxy_check_tlli uses the BSS side TLLI namespace when trying to get the tlli_info. This patch modifies the gbproxy_check_tlli() function to accept a tlli_info pointer instead of a numeric TLLI. The tlli_info is already available when the function is called. Since this a similar approach has been used by accessing the enable_patching flag directly, this commit unifies checking by always using this function instead of the flag outside of gb_proxy_tlli.c. This fixes the APN patching that doesn't work currently when P-TMSI patching is enabled. Sponsored-by: On-Waves ehf
2014-09-08gbproxy/test: Check APN patching while P-TMSI patching is enabledJacob Erlbeck2-15/+45
This commit adds a single ACT PDP CTX REQ message to test_gbproxy_ptmsi_patching() to check whether APN patching works in this case, too. Note that this doesn't work currently, the APN patch count is not incremented. Sponsored-by: On-Waves ehf
2014-09-08gbproxy: Add missing commands to VTY writeJacob Erlbeck1-0/+8
Currently the new command acquire-imsi and secondary-sgsn are not included into the write command's output. This is fixed by this commit. Sponsored-by: On-Waves ehf
2014-09-08gbproxy: Copy uplink messages to SGSN 2Jacob Erlbeck2-11/+51
Some messages that are related to the BVC itself must be forwarded to the secondary SGSN, too. This patch implements this for BVC-RESET (BVCI != 0) and FLOW-CONTROL-BVC messages. The resulting acknowledgement messages from the secondary SGSN are silently dropped. The idea behind this is that the primary SGSN is responsible for setting up and maintaining the BVC whereas the secondary SGSN is rather passive and just has to accept it. Ticket: OW#1258 Sponsored-by: On-Waves ehf
2014-09-08gbproxy: Use secondary SGSN if IMSI matchesJacob Erlbeck2-24/+38
This patch modifies gbprox_process_bssgp_ul() to send the message to the secondary SGSN if the IMSI has matched and routing to the secondary SGSN is enabled. The destination for stored messages is modified accordingly. Ticket: OW#1261 Sponsored-by: On-Waves ehf
2014-09-08gbproxy/test: Add test case for secondary SGSNJacob Erlbeck2-39/+1444
This patch adds a case to test the establishment (and shutdown) of connection between 2 MS and 2 SGSN, where the assignment is based on each IMSI. Since BVC-RESET and FLOW-CONTROL-BVC will have to be sent to both SGSN, an ACK is simulated for both. New functions to generate FLOW-CONTROL-BVC(-ACK) messages are provided. It modifies dump_peers to add the string "IMSI matches" to a TLLI dump line if appropriate. Note that there is no real support to use a secondary SGSN in the gbproxy yet, but the test code reflects the expected behaviour when the feature is implemented. Sponsored-by: On-Waves ehf
2014-09-08gbproxy: Support a secondary SGSNJacob Erlbeck3-9/+47
This patch refactors SGSN NSEI handling to support a secondary SGSN. It adds the following VTY commands: - secondary-sgsn nsei <0-65534> - no secondary-sgsn Sending messages to the secondary SGSN is not yet implemented, but received messages from such a SGSN would be forwarded to the BSS peers. Sponsored-by: On-Waves ehf
2014-09-08gbproxy: Add missing gbprox_process_bssgp_ul() return checkJacob Erlbeck1-1/+4
This should have been part of the 'Implement IMSI acquisition' commit, where a similar change has been made for BSS originated PTP messages. Sponsored-by: On-Waves ehf
2014-09-07gbproxy: Fix warningsJacob Erlbeck2-3/+0
This patch fixes the remaining 'unused' warnings. Sponsored-by: On-Waves ehf
2014-09-05bsc: Add a "IPA PING" to the SCCP CR messagesHolger Hans Peter Freyther6-13/+89
We want to reduce the background traffic and might set the ping interval to be in the range of minutes. But this means that if the TCP connection is frozen several "SCCP CR CM Service Requests" will be stuck in the send queue without ever being answered. I could have used the logic of not receiving the "SCCP CC" to close the connection but instead I am introducing an overload to schedule the ping as part of the normal SCCP connection establishment. The VTY write case has been manually verified, I have also looked at a single trace to see that the SCCP CR and the IPA PING is transfered in the same ethernet frame.
2014-09-05mgcp: Re-load the state after the transcoding changeHolger Hans Peter Freyther1-0/+3
Jacob ran the tests with ASAN and noticed that the state is dead. This is on purpose as we have forced a change in the transcoding. Re-load the state and verify that it has not changed in the other cases.
2014-09-02mgcp: Use l16 in the testHolger Hans Peter Freyther2-8/+8
G729 might not be available, so execute the test with codecs that are always available.
2014-09-02gbproxy: Implement IMSI acquisitionJacob Erlbeck6-23/+264
To modify or route messages based on the IMSI the latter must be known when the action shall take place. This patch modifies the gbproxy to optionally retain and enqueue messages from the MS while initiating an identification procedure. Further message processing of the LLC PTP link towards the SGSN will be done, when the identity of the MS has been acquired. Note that the N(U) of the LLC GMM SAPI are not adjusted, so it is possible that adjacent messages of a single LLC link arriving either at the BSS or the SGSN have the same N(U) and might get discarded, leading to retransmissions and additional delay. Note also that retransmissions and packet loss are not yet handled explicitely. If for instance the generated IDENT REQ gets lost, the gbproxy will not act on its own. In this case, the MS will time out and eventually resend the Attach Request on which the gbproxy will act exactly like before (thus having two Attach Req messages in its queue, which will both be sent after the Ident Resp arrives). This has been tested successfully with an E71, needing one retransmission by the SGSN due to an N(U) collision. Ticket: OW#1261 Sponsored-by: On-Waves ehf
2014-09-02gbproxy/test: Add a test for IMSI acquisitionJacob Erlbeck2-0/+709
This patch copies test_gbproxy_ptmsi_patching to test_gbproxy_imsi_acquisition as a base for a later test for IMSI acquisition (which is not yet implemented). The idea behind this is to make the different behaviour visible in the ok file without compromising the P-TMSI test. Sponsored-by: On-Waves ehf
2014-09-02gbproxy: Create STATUS message with original PDUJacob Erlbeck4-31/+58
Currently when patching is enabled and an error happens when receiving a message from the SGSN, the patched message is sent back with the PDU_IN_ERROR IE. This patch modifies gbprox_rx_sig_from_sgsn() to copy the message before it is patched, so that the original message can be used with the STATUS message. gbprox_rx_ptp_from_sgsn() does all checks before the message is patched, so copying is not necessary. Since gbprox_rx_sig_from_sgsn() is not called for BSSGP UNITDATA messages and the msgb is already been copied in the gbprox_relay2peer function, the relative performance impact is expected to be low. Note that the PDU IE of STATUS messages received from an MS and forwarded to the SGSN will not be patched. STATUS messages from the SGSN are only logged and not forwarded to the MS. Sponsored-by: On-Waves ehf
2014-09-02gbproxy/test: Test patching BSSGP SUSPEND/LLC-DISCARDEDJacob Erlbeck2-50/+204
Currently messages like these with a TLLI IE (BSSGP) are not tested (properly) with TLLI patching. This patch extends the send_bssgp_suspend* functions to accept a TLLI as argument and adds the send_bssgp_llc_discarded function. These are then used in test_gbproxy_ptmsi_patching() with a valid TLLI. Note that the TLLI IE patching doesn't work currently. Sponsored-by: On-Waves ehf
2014-09-02gbproxy: Move PTP message handling into separate functionsJacob Erlbeck1-32/+57
This patch adds gbprox_rx_data_from_sgsn() and gbprox_rx_ptp_from_bss() which contain the PTP message processing of gbprox_rcvmsg(). The calls to gbprox_process_bssgp_ul() are moved from gbprox_relay2sgsn() to gbprox_rx_ptp_from_bss() and gbprox_rx_sig_from_bss(). The goal is, to do all patching (and calls to gbprox_process_bssgp_*) from within the gbprox_rx_* functions. Doing the patching from within gbprox_relay2sgsn has the drawback, that the patching code cannot call gbprox_relay2sgsn() which is needed if a single message shall trigger a sequence of messages. Sponsored-by: On-Waves ehf
2014-09-02gbproxy: Remove nonnull attributesJacob Erlbeck2-19/+14
The compiler also uses this attribute for code elimination. If the nonnull attribute has been given erroneously for an parameter, that is later been checked against NULL, this check is removed silently by the gcc if optimization is enabled. This can lead to hard-to-find segmentation violation faults. To be on the safe side, this patch removes all uses of the nonnull attribute in openbsc. Compiler: - gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1): no warning, segfault - clang 3.4 (3.4-1ubuntu3): no warning, no segfault, asm ok Example: /* foo.c */ int f(int* p) __attribute((nonnull)); int f(int *p) { if (!p) return 0; return *p; } /* main.c */ int f(int* p) __attribute((nonnull)); int g () { return f(arg); } int main() { return g(NULL); } When these files are compiled into an executable, no warnungs are issued but it will fail with a segfault when -O2 is used (unless LTO is active). Compiler output (gcc -O2): int f(int *p) { 0: 8b 44 24 04 mov 0x4(%esp),%eax 4: 8b 00 mov (%eax),%eax 6: c3 ret } Sponsored-by: On-Waves ehf
2014-09-02mgcp: Deal with receiving another payload typeHolger Hans Peter Freyther3-1/+115
In case we get offered G729 and G711 we might have selected G729 as the audio codec. The first packet we receive might be G711 though. In that case we will need to change. But only if we have a matching alternate codec payload_type. E.g. in the case of comfort noise we will receive the PT=11 and we don't want to change.
2014-09-02mgcp: Store one more codec/payload type if it is presentHolger Hans Peter Freyther4-9/+144
In case of some RTP proxy from time to time we are offered both G729 and G711 but only one of them will work. I intend to adjust the codec at runtime in case we receive the wrong codec.
2014-09-02mgcp: Group codec reset and put it to a separate method.Holger Hans Peter Freyther1-9/+15
2014-09-02mgcp: Move the "codec" params to a structHolger Hans Peter Freyther9-97/+111
We might be offered multiple codecs by the remote and need to switch between them once we receive data. Do this by moving it to a struct so we can separate between proposed and current codec. In SDP we can have multiple codecs but a global ptime. The current code doesn't separate that clearly instead we write it to the main codec.
2014-09-02mgcp: Use the rtp_hdr structure and extract ts/seq from thereHolger Hans Peter Freyther2-6/+9
Use the rtp_hdr structure. The basic alignment issue remains and I need to merge/cherry-pick Jacob's getters for the ts, sequence number and other attributes.
2014-09-01osmux: osmux batch-factor can't be higher than 8Pablo Neira Ayuso1-1/+1
The osmux header uses a counter of 3 bits, so you can put up to 8 message in it.
2014-09-01osmux: save specific osmux configuration options if osmux is enabledPablo Neira Ayuso1-7/+8
Just like other options do, to avoid polluting the configuration file with unused options if osmux is disabled.
2014-09-01configure: fix unrecognized option --enable-external-testsPablo Neira Ayuso1-1/+1
./configure --help indicates: --enable-external-tests Include the VTY/CTRL tests in make check [default=no] but ./configure ... --enable-external-tests configure: WARNING: unrecognized options: --enable-external-tests the name of the option seems to be --enable-ext-tests.
2014-08-30osmux: initialize osmux_batch_size in mgcp configPablo Neira Ayuso1-1/+1
The library allows to indicate zero as batch size if you want to use the default size, however openbsc saves 'osmux batch-size 0' which is not good as input. Use OSMUX_BATCH_DEFAULT_MAX to explicitly initialize the batch size from mgcp_parse_config().
2014-08-29osmux: add 'osmux batch-size NUM' option to mgcp vtyPablo Neira Ayuso3-0/+16
This allows you to specify the osmux batch frame size. If zero, the library uses the default value.
2014-08-29osmux: set default port from mgcp_parse_config()Pablo Neira Ayuso3-5/+3
2014-08-29nat: Introduce a config free for the test and fix valgrind issuesHolger Hans Peter Freyther3-9/+50
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-29nat: Remove the entry from the list before we destroy itHolger Hans Peter Freyther1-0/+1
2014-08-29nat: Fix compiler warning about unknown prototypeHolger Hans Peter Freyther1-0/+1
bsc_nat_ctrl.c: In function ‘set_net_cfg_cmd’: bsc_nat_ctrl.c:360:3: warning: implicit declaration of function ‘bsc_replace_string’ [-Wimplicit-function-declaration] bsc_replace_string(bsc_cfg, &bsc_cfg->acc_lst_name, cmd->value); ^
2014-08-29gprs: Document the stale option in delete-gbproxy-tlliHolger Hans Peter Freyther1-0/+1
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-29gbproxy: Fix issues found by CoverityJacob Erlbeck2-2/+5
gbproxy_patch_bssgp: Move a check for tlli_info in front of the first conditional that depends on it, and return immediately if it is NULL. gbproxy_register_tlli: Initialize tlli_already_known to 0. Fixes: Coverity CID 1232691 Fixes: Coverity CID 1232692 Sponsored-by: On-Waves ehf
2014-08-29osmux: fix unchecked return value in mgcp_parse_osmux_cid()Pablo Neira Ayuso1-2/+4
** CID 1232804: Unchecked return value (CHECKED_RETURN) /src/libmgcp/mgcp_protocol.c: 888 in mgcp_parse_osmux_cid()
2014-08-28osmux: fix leak in osmux_deliver()Pablo Neira Ayuso1-0/+1
The callback is responsible for releasing the batch message that libosmo-netif builds.
2014-08-28osmux: fix access to uninitialized memory area in scheduled_tx_*_cbPablo Neira Ayuso1-2/+8
mgcp_send() needs some initialized address when printing a log message. Nothing really serious but let's calm down valgrind.
2014-08-28osmux: rename osmux.c to mgcp_osmux.cPablo Neira Ayuso2-1/+1
So we can easily identify in the log message what refers to libosmo-netif and what to libmgcp.
2014-08-28osmux: remove spamming debug log messagesPablo Neira Ayuso1-28/+0
It may print a debug line every 20ms, so disable this. We can still compile this extra spamming debug from the libosmo-netif library.
2014-08-28osmux: use osmux port when specified from vty from enginePablo Neira Ayuso1-3/+3
Instead of the hardcoded OSMUX_PORT.
2014-08-28osmux: print out 'osmux port' when saving configurationPablo Neira Ayuso1-0/+2
2014-08-28osmux: allow to specify the Osmux portPablo Neira Ayuso3-1/+16
via mgcp section from the configuration file.
2014-08-28osmux: display statistics once osmux input handle is releasedPablo Neira Ayuso1-1/+9
2014-08-28osmux: fix error path in osmux_handle_dummy()Pablo Neira Ayuso1-1/+2
This patch adds a missing goto err. While at it, reword log message.
2014-08-28osmux: remove spamming log messagePablo Neira Ayuso1-3/+0
Not very useful: <000b> osmux.c:163 Osmux uses CID 1 from endpoint=7 (active=1) Get rid of it.
2014-08-28osmux: remove redundant log message when bsc doesn't want to use OsmuxPablo Neira Ayuso1-3/+1
Remove redundant information log message: <000b> bsc_mgcp_utils.c:647 BSC doesn't want to use Osmux, failing back to RTP <000b> bsc_mgcp_utils.c:669 bsc didn't accept to use Osmux (cid=0) One single log message is just fine. The error path already indicates the precise reason not to accept the request to use Osmux.