aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
AgeCommit message (Collapse)AuthorFilesLines
2014-08-04gbproxy: Remove global state from the gbproxyHolger Hans Peter Freyther5-134/+143
Global state prevents us from writing simple units tests for single routines. Go through the code and add pointers to the gbproxy configuration. Only the vty and the test code remain using the global gbproxy instance.
2014-08-04gprs: The methods moved to gprs_utils.h remove them hereHolger Hans Peter Freyther1-3/+0
Stop declaring the apn routines in here. Done with Jacob
2014-08-04gprs: Add testcases for the APN string/octet conversion and fix itHolger Hans Peter Freyther6-9/+119
Create a testcase for the gprs_str_to_apn and gprs_apn_to_str routines. While writing the testcase we noticed it is possible to write more bytes than should have been allowed. This is fixed by checking that the max_len is at least 1 (needed to write the first length octet) and to do the size check before writing to the output. Modify the signature of gprs_str_to_apn to put the length/size next to the parameter that requires a size. Done with Jacob
2014-08-04gbproxy: Use gbprox_delete_tlli if possibleHolger Hans Peter Freyther1-8/+4
Make use of the delete routine in more places and get test coverage for it. Done with Jacob
2014-08-04gprs: Create a gprs_utils file and move to be shared code in thereHolger Hans Peter Freyther8-136/+201
We intend to move some of these routines to libosmocore but to avoid a feature symbol clash we are prefixing these routines with gprs_. Done with Jacob
2014-08-04gbproxy: Use gbproxy_ for all structuresHolger Hans Peter Freyther4-97/+97
The application is called gbproxy but the structures and functions were inconsistently named as either gbprox or gbproxy. Rename all structures to use gbproxy. Done with Jacob
2014-08-04gbproxy: The dump routines are only used by the test, move it thereHolger Hans Peter Freyther3-130/+129
Done with Jacob
2014-08-04gbproxy: Have a clear namespace for the public functionsHolger Hans Peter Freyther3-7/+6
Done with Jacob
2014-08-04gbproxy: Remove the global rate counter and place it in the configHolger Hans Peter Freyther3-33/+25
Move the global data into the struct and use it. gbprox_reset will first free data and then re-initialize the structure. This code is used by the unit test. Done with Jacob
2014-08-04gbproxy: Correct the method name. We work on TLLIsHolger Hans Peter Freyther3-4/+4
Done with Jacob
2014-08-04gbproxy: Move the VTY code into the vty file and create public APIHolger Hans Peter Freyther5-294/+308
Create public accessors to the core of the peer to allow to simplify the test and separate concerns. Done with Jacob.
2014-08-04MNCC: Add IMSI to CALL CONFIRM messageAndreas Eversberg1-0/+4
LCR requires IMSI to correlate calls for MPTY (multi party conference) and ECT (call transfer).
2014-08-04dyn PDCH: Cleanup of rsl_chan_activate_lchan() and usersAndreas Eversberg4-9/+13
Timing advance is stored inside lchan structure, so it is removed from arguments. This is useful, if other actions are required prior calling rsl_chan_activate_lchan. (like deactivating PDCH first) The "shifted TA value" that is required by BS11 is now calculated inside rsl_chan_activate_lchan and not by each user. [Rebased by Holger. So some hunks were skipped as the patch depended on Jolly's HO code]
2014-08-02vty: Fix interactive VTY help for silent-sms transmissionHarald Welte1-3/+3
2014-08-02DB: produce a backtrace in case of a DB errorHarald Welte1-0/+1
This helps us to identify where exactly in our code the DB error originates from.
2014-07-30openbsc: Add new fields for the osmo-bts softwareHolger Hans Peter Freyther1-0/+12
For the osmo-bts software we want to be able to slowly change the output power. The state is kept inside the trx structure.
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.