aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
AgeCommit message (Collapse)AuthorFilesLines
2016-01-05Fix neighbor channel list generation for 1900 MHz PCS bandmmcternan/bb_maintHarald Welte1-3/+3
In the 1900 MHz PCS band, we always generated neighbor cell lists consisting of only a single neighbor cell, rather than al the configured BTSs.
2016-01-05system_information.c: Distinguish two previously identical log msgsHarald Welte1-2/+2
2015-07-09Remove test for @mgw.Michael McTernan1-1/+1
2015-07-03Support mnc_t.Michael McTernan22-72/+96
Signed-off-by: Michael McTernan <mike.mcternan@wavemobile.com>
2015-02-05osmo-bts: Introduce new struct for a power loop in the BTS codesysmocom/osmo-bts/0.3.0-doraHolger Hans Peter Freyther1-0/+7
Keep track if the power level has been "fixed" by the BSC, otherwise keep track of the currently ordered one. The ms_power is the initial value set by the BSC and continues to be used. Conflicts: openbsc/include/openbsc/gsm_data_shared.h
2014-07-24trau: Cast to remove compiler warningHolger Hans Peter Freyther1-1/+1
rtp_proxy.c: In function ‘rtp_decode’: rtp_proxy.c:199:8: warning: assignment from incompatible pointer type frame = msgb_put(new_msg, sizeof(struct gsm_data_frame));
2014-07-24bts: Remember the last AMR mode that we receivedHolger Hans Peter Freyther1-0/+1
Not every air message contains the AMR mode so we need to remember it to not confuse receiving equipment like AudioCodes Media Gateways.
2014-07-22gprs: Move LLC IE length fix to BSSGP levelJacob Erlbeck1-20/+35
This commit moves the fixing code of the length field of the LLC information element to the BSSGP patching level since that is not a part of LLC itself. Sponsored-by: On-Waves ehf
2014-07-22gprs: Parse PTMSI and update TLLI accordinglyJacob Erlbeck2-12/+66
This commit adds code to parse the PTMSI in network originated messages - Attach Accept, - Routing Area Update Accept, and - P-TMSI Reallocation Command (see below) to keep track of the TLLI identifying the LLC connection. The P_TMSI Realloc Command specific code is not being tested yet, so a corresponding notice is logged when such a message will be received. NOTE: The gbproxy will lose the TLLI when the MS doesn't receive/use the message (normally the SGSN remembers the old TLLI for some time to avoid this kind of problem). If this happens the MS will probably restart the procedure and the network will have to answer again eventually using one of the above messages which will re-associate the IMSI with the TLLI before the MS can send a PDP Context Request message. Ticket: OW#1192 Sponsored-by: On-Waves ehf
2014-07-22gprs: Use struct to pass context informationJacob Erlbeck1-36/+63
Add a struct containing context information from the parts of the message that have been parsed already. A pointer to this (temporary) struct is passed to parse/patch functions. Sponsored-by: On-Waves ehf
2014-07-22gprs: Use shift functions instead of manual parsingJacob Erlbeck1-76/+60
Currently the patching code directly accesses the single bytes to parse the LLC/DTAP messages. This patch uses the shift functions instead to parse tlv and similar structures. Sponsored-by: On-Waves ehf
2014-07-22gprs: Add TLV parse functionsJacob Erlbeck3-0/+353
This adds a set of function that parse a single tlv, lv, tv, or v encoded information element. They are complementary to the *_put functions defined in libosmocore's tlv.h file. The functions update the data and data_len fields unless they are a 'match' function and the tag field doesn't match. Sponsored-by: On-Waves ehf
2014-07-22gprs: Fix TLLI cache size computationJacob Erlbeck2-9/+10
Currently the enabled_tllis_count field isn't always decremented when an element is removed from the TLLI cache list. This patch adds the missing update and also adjusts the counter accordingly. Sponsored-by: On-Waves ehf
2014-07-22gprs/test: Rearrange for PTMSI parsingJacob Erlbeck3-34/+219
Add TLLI cache output to gbprox_dump_peers() to include this info into the test output. Separate RA Update Req message handling from Attach Request handling. Note: There is no test case for the P-TMSI Reallocation Command yet. Sponsored-by: On-Waves ehf
2014-07-22gprs: Add counters related to LLC layer patchingJacob Erlbeck2-0/+19
This commit adds the following counters: - attach-reqs: Number of Attach Request messages - attach-rejs: Number of Attach Reject messages - tlli-cache: Size of the TLLI cache Sponsored-by: On-Waves ehf
2014-07-22gprs/vty: Add commands to manage the TLLI listJacob Erlbeck3-0/+114
These commands manage the TLLI list used to decide whether an APN shall be patched or not. Note that this list is (currently) only maintained if IMSI matching is used. VTY commands (enable node): show gbproxy tllis show all TLLI entries delete-gbproxy-tlli NSEI stale purge all stale entries delete-gbproxy-tlli NSEI imsi IMSI purge entry with the IMSI given delete-gbproxy-tlli NSEI tlli TLLI purge entry with the TLLI given Sponsored-by: On-Waves ehf
2014-07-22gprs: Track IMSI/TLLI to control APN patchingJacob Erlbeck5-48/+465
This patch adds IMSI/TLLI connection tracking and uses it to control APN patching based on the IMSI. TLLI entries can expire based on age and/or by limiting the TLLI list size. VTY config-gbproxy: no core-access-point-name disable APN patching core-access-point-name none remove APN if present core-access-point-name APN replace APN if present core-access-point-name none match-imsi RE remove if IMSI matches core-access-point-name APN match-imsi RE replace if IMSI matches tlli-list max-age SECONDS expire after SECONDS no tlli-list max-age don't expire by age tlli-list max-length N keep N entries only no tlli-list max-length don't limit list length RE is an extended regular expression, e.g. ^12345|^23456 Ticket: OW#1192 Sponsored-by: On-Waves ehf
2014-07-22gprs: Store gbproxy patching state per peerJacob Erlbeck3-83/+146
Currently, all patching state is stored globally in the gbproxy. Thus the feature cannot be used safely with a concentrating gbproxy (NAT). This patch moves the state and relevant counters to the gbprox_peer structure. It adds code to resolve the corresponding peer when packets are received by looking at BVCI, NSEI, and BSSGP IEs (BVCI, RAI/LAI/LAC) when the peer is not passed to the gbprox_patch_bssgp_message() function. Test cases are also added for the SGSN->BSS case including test cases with invalid identifiers. Note that this patch should make it possible to use RAI patching at a NAT gbproxy as long as the messages are not encrypted. Ticket: OW#1185 Sponsored-by: On-Waves ehf
2014-07-22gprs/test: Add Detach messages to testJacob Erlbeck2-3/+74
This patch adds a Detach Request (MO) / Detach Accept sequence to the test, followed by another (here invalid) Act PDP Context Req which should be APN patched. Sponsored-by: On-Waves ehf
2014-07-22gprs/test: Added GMM Info and fixed TLLIJacob Erlbeck2-8/+36
Add a DTAP GMM Information message with an IMSI in the BSSGP header to enable the association between IMSI and TLLI. The TLLI of the Routing Area Update messages is set to foreign. Sponsored-by: On-Waves ehf
2014-07-22gprs: Add APN patch support for LLC/GSM messagesJacob Erlbeck5-13/+284
Patch the APN in every 'Activate PDP Context Request' message to the value given by the 'core-access-point-name' command. If the command is given without an APN, the whole APN IE will be removed. If the command is being prefixed by a 'no', the APN IE remains unmodified. The patch mode 'llc-gsm' is added to selectively enable the patching of LLC session management messages. This is enabled implicitely by the patch mode 'llc'. Note that the patch mode should not be set to a value not enabling the patching of LLC GSM messages ('llc-gsm', 'llc', and 'default' are sufficient to patch 'Activate PDP Context Request' messages). Ticket: OW#1192 Sponsored-by: On-Waves ehf
2014-07-22gprs: Add MCC/MNC patch support for LLC/GMM messagesJacob Erlbeck4-9/+345
This patch extends the BSSGP patch code to also patch LLC information elements along with MCC/MNC patching support for the following messages: - Attach Request - Attach Accept - Routing Area Update Request - Routing Area Update Accept - P-TMSI reallocation command Note that encrypted packets will not be patched. Ticket: OW#1185 Sponsored-by: On-Waves ehf
2014-07-22gprs: Implement BSSGP MCC/MNC patchingJacob Erlbeck8-16/+213
This adds a feature to patch the BSSGP MNC/MCC fields of messages going to and coming from the SGSN. To enable this feature, the gbproxy's VTY commands 'core-mobile-country-code' and/or 'core-mobile-network-code' must be used. All packets to the SGSN are patched to match the configured values. Packets received from the SGSN are patched to the corresponding values as last seen from the BSS side. Note that this will probably not work with a gbproxy used for several BSS simultaneously. Note also, that MCC/MNC contained in a LLC IE will not be patched. Ticket: OW#1185 Sponsored-by: On-Waves ehf
2014-07-22gprs: Use imsi field instead of imeiJacob Erlbeck1-1/+1
The wrong field has been use for the field length computation. This hadn't any impact so far, since sizeof(ctx->imei) == sizeof(ctx->imsi) This patch fixes the computation to use the right field. Sponsored-by: On-Waves ehf
2014-07-22gprs/test: Make test output more readableJacob Erlbeck2-274/+159
This patch makes a few changes to improve readability: - change the sendto() hexdump to start with NS instead of BSSGP - use more specific message descriptions instead of 'UNITDATA' - add a title line per test Sponsored-by: On-Waves ehf
2014-07-22osmux: Drop the message in case we don't know the remote yet.Holger Hans Peter Freyther1-0/+7
Avoid creating a bogus state that will never go away.
2014-07-22osmux: Qualify the handle by IPv4 address _and_ portHolger Hans Peter Freyther1-12/+25
For our usecase several different systems might be behind the same firewall so we need to distinguish the remote by more than the IPv4 address.
2014-07-22osmux: Extract the dummy message, find the endpoint and set rtp portHolger Hans Peter Freyther1-1/+34
Set the remote port for the endpoint. Somehow this needs to propagate all the way to the handle.
2014-07-22osmux: Send the CI as part of the dummy to help to identify a clientHolger Hans Peter Freyther1-2/+7
We need to discover the remote port as we are likely behind a NAT. Right now the NAT code will just send to port 1984 on the BSC but this might not arrive at the BSC. Include the CI (in the future we need to include the endpoint address or send the dummy to the net port). This is just an interim solution.
2014-07-22osmux: Using the "CI" and calling it "CID" is plain wrongHolger Hans Peter Freyther1-1/+1
The CI is a MGCP value that is counted from 0 upwards. The code is comparing a uint8_t with a uint32_t. This will only work for up to UINT8_MAX calls and then will silently break. The code should probably work with the endpoint number and not the CI. For now truncate things and hope things work.
2014-07-22mgcp: Change API to remove memory management from the nameHolger Hans Peter Freyther8-20/+21
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-22mgcp: Fix/test the case of a time jump and the resyncHolger Hans Peter Freyther2-0/+48
In case the sender didn't send a couple of frames we will have a time gap that is bigger than the accepted delta. Add a new testcase for this and update the next_time.
2014-07-22mgcp: Add a testcase for 160->80 ptime handlingHolger Hans Peter Freyther1-0/+19
2014-07-22mgcp: Initialise next_time in case the initial timestamp is not 0.Holger Hans Peter Freyther2-6/+10
2014-07-22mgcp: Document transcoding semantic and follow itHolger Hans Peter Freyther4-16/+95
Transcoding from GSM to PCMA can lead to the MGCP MGW sending two PCMA packages with the same sequence number and timestamp. Once with the encoded audio and once completely empty. This is because "state->dst_packet_duration" is 0 in most cases (unless a ptime is forced) and we attempt to encode audio even if there are not enough samples. The encode_audio return will return 0 in that case which is not trated as an error by the mgcp network code. Handle rc == 0 specially and document the semantic.
2014-07-22mgcp: Fix/test reading/writing the sequence numberHolger Hans Peter Freyther3-9/+61
The sequence number was read from the wrong place and then the wrong byte order conversion routine was used so we ended up wirting 0x00, 0x00 into the patched sequence number. Add a testcase for that.
2014-07-22mgcp: Patch and Count _after_ the transcodingHolger Hans Peter Freyther1-1/+1
When going from a ptime of 10 to 20 a lot of alignment errors are reported. In fact the alignment check should be done before and after the transcoding. As this is not possible right now only do it _after_ the patching.
2014-07-22mgcp: Add a comment about the return of the functionHolger Hans Peter Freyther1-0/+5
2014-07-22mgcp: Make the internal state of the transcoder accessibleHolger Hans Peter Freyther2-50/+54
For the unit tests we need to look at the internal state.
2014-07-22mgcp: Capture the return value of the of the transcode functionHolger Hans Peter Freyther2-192/+205
2014-07-22mgcp: Do not use errx as finding a test failure is too hardHolger Hans Peter Freyther1-6/+12
It took me a long time to figure out that errx just exits and the test output didn't indicate that the application was exited early. Use a printf and good old abort in case of a failure.
2014-07-22mgcp: Re-factor testcase to separate test and setupHolger Hans Peter Freyther1-54/+64
Separate the test from the code necessary for the setup. This is somehow inspired by the PhExample framework of Pharo.
2014-07-22mgcp: Warn when the buffer is being reset due a wrong seq numberHolger Hans Peter Freyther1-2/+5
When the sample buffer is being dropped write a warning so we can see how often this event occurs.
2014-07-22mgcp: Mention the packet duration in the error messageHolger Hans Peter Freyther1-2/+2
2014-07-22mgcp: Provide more information about configured endpointsHolger Hans Peter Freyther1-13/+26
2014-07-22mgcp: Fix memory leak in the transcoding codeHolger Hans Peter Freyther1-1/+1
The GSM handle was never released. This was found using valgrind and the leak check. ==14933== 752 bytes in 1 blocks are definitely lost in loss record 15 of 19 ==14933== at 0x4028B4C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==14933== by 0x4130201: gsm_create (in /usr/lib/i386-linux-gnu/libgsm.so.1.0.12) ==14933== by 0x80517AE: mgcp_transcoding_setup (mgcp_transcode.c:199) ==14933== by 0x8049691: given_configured_endpoint.isra.1 (mgcp_transcoding_test.c:198) ==14933== by 0x8049C11: test_transcode_result (mgcp_transcoding_test.c:328) ==14933== by 0x8049418: main (mgcp_transcoding_test.c:582)
2014-07-22trau_mux.c: Prevent out-of-bounds read in trau_decode_fr()Holger Hans Peter Freyther1-0/+3
Haralds patch in 9f109dfb9926558b6ea504dc3aee92cfd64413bd only fixed the trau_encode_fr part but the issue seems to exist in the decode function as well. Apply the same fix.
2014-07-19smpp: Fix small typo in the commentHolger Hans Peter Freyther1-1/+1
2014-07-09bsc: Implement a way to relay a message to the remote MSCHolger Hans Peter Freyther1-0/+41
This is analogue to the notification that is relayed locally and now we have a way to relay a message back to the network.
2014-07-09osmux: Now that we have IPv4/port we might want to consider to expire handlesHolger Hans Peter Freyther1-0/+1