path: root/openbsc/src/gprs/gb_proxy.c
AgeCommit message (Collapse)AuthorFilesLines
2014-11-11gbproxy: Honour the BSS TLLI type when creating an SGSN TLLIJacob Erlbeck1-1/+6
Currently gbproxy_make_sgsn_tlli always returns a foreign TLLI when it uses the (SGSN) P-TMSI to generate one. This patch changes the implementation to return a SGSN TLLI of the same type like the BSS TLLI in that case. Sponsored-by: On-Waves ehf
2014-10-27gbproxy: Discard UL PTP messages with an unknown BVCIJacob Erlbeck1-10/+10
Currently all PTP messages are in general forwarded to the SGSN even when the BVCI is not known to the gbproxy. Only if message patching is active and the peer cannot be determined, a log message is generated, a STATUS message returned, and the message discarded. The intention for this was to keep the old gbproxy's behaviour if patching is disabled. But the code gets much more complex this way. Another drawback is that when the SGSN returns a corresponding STATUS message, it cannot be routed to the BSS where the original message came from. This patch therefore changes the behaviour to reject BSSGP PTP uplink messages immediately if the BVCI is not known. Fixes: Coverity CID 1244240 Ticket: OW#1317 Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Log more information on parse errorsJacob Erlbeck1-16/+18
To get a clue which message caused the error without having to enable LOGL_DEBUG, information about how far the parser came (message name, parsed fields) is logged with LOGL_NOTICE along with a full hexdump of the message. Ticket: OW#1307 Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Pass the log level as argument to gprs_gb_log_parse_contextJacob Erlbeck1-2/+2
Currently, the log level is always LOGL_DEBUG. In case of errors it would be helpful to use a higher log level. This patch adds a log_level parameter to gprs_gb_log_parse_context to let the caller decide about the level. Ticket: OW#1307 Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Send STATUS(BVCI unknown) to BSS on unknown PTP BVCIJacob Erlbeck1-4/+11
Currently BSSGP PTP messages are silently dropped when the BVCI is not known and patching is enabled. The nanoBTS will not recognize this and continue to send messages on the BVCI. If it receives a STATUS(BVCI unknown) instead, it will start a BVC reset procedure instead. This patch modifies gbprox_rx_ptp_from_bss() to return a STATUS(BVCI unknown) to the BSS instead of dropping the message. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Use a separate regexp for routingJacob Erlbeck1-1/+1
Currently one regexp ('patching') is used for all matching. This patch adds a second category 'routing' which is exclusively used for SGSN selection. It also adds a corresponding VTY command: - match-imsi patching RE : MS related patching (currently APN) - match-imsi routing RE : Select secondary SGSN on match only - no match-imsi : Clear all filter expressions Ticket: OW#1258 Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Refactor IMSI matchingJacob Erlbeck1-1/+4
The current implementation makes it difficult to add further match expressions. This patch adds a new struct gbproxy_match that contains the fields needed for each match expression. The matches (config) and the results (link_info) are stored in arrays. All related functions are updated to use them. The old fields in the config structure are removed. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Refactor local message generationJacob Erlbeck1-21/+24
This patch adds und uses the function gbproxy_gsm48_to_peer() which takes a GSM 04.08 message, encapsulates it in BSSGP and LLC, and sends it to the BSS peer. This function increments vu_gen_tx_bss which is now used instead of imsi_acq_retries to set the N(U) of the outgoing message. Since imsi_acq_retries isn't currently incremented before a Detach Accept is generated, this patch also fixes the N(U) of such messages. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Reset IMSI acquisition within gbproxy_unregister_link_infoJacob Erlbeck1-0/+6
Currently then link_info is not cleaned up completely, when gbproxy_unregister_link_info is called. This patch adds a function gbproxy_reset_link that must be defined externally. This is done in gb_proxy.c, where it resets the IMSI acquisition. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Use monotonic system time instead of time-of-dayJacob Erlbeck1-2/+7
Currently time() is used for age calculations. This time source may jump either forwards or backwards in time (NTP update, leap seconds). This patch replaces the use of time() by using clock_gettime(CLOCK_MONOTONIC) instead. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Use the term 'link' instead of 'tlli'Jacob Erlbeck1-54/+54
Currently in many places where 'tlli' (Temporary Logical Link Identifier) within identifiers is used, the logical link itself is meant instead. For instance, the tlli_info contain information about an LLC logical link including up to four individual TLLI. To avoid confusion between these concepts, this patch replaces all 'tlli_info' by 'link_info' and a few 'tlli' by 'link'. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Rename functions related to tlli_infoJacob Erlbeck1-2/+2
This patch replaces 'tlli' by 'tlli_info' within the following function identifiers: - gbproxy_delete_tlli - gbproxy_delete_tllis - gbproxy_remove_stale_tllis - gbproxy_touch_tlli - gbproxy_unregister_tlli - gbproxy_remove_matching_tllis - gbproxy_find_tlli -> gbproxy_tlli_info_by_tlli - gbproxy_find_tlli_by_* -> gbproxy_tlli_info_by_* These functions refer to the whole logical link info rather than to a certain TLLI. So they are renamed to be named consistently with gbproxy_attach_tlli_info and others. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Remove sgsn_nsei parameterJacob Erlbeck1-7/+5
The function gbproxy_imsi_acquisition() has a parameter sgsn_nsei that is alyways equal to tlli_info->sgsn_nsei (if tlli_info is not NULL). This patch removes this parameter from gbproxy_imsi_acquisition() and gbproxy_flush_stored_messages() and accesses tlli_info->sgsn_nsei instead within these functions. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Rename identifiers related to IMSI matchingJacob Erlbeck1-1/+1
This patch renames gbproxy_check_tlli() to gbproxy_imsi_matches() and struct tlli_info's enable_patching to imsi_matches. It's meant to be more obvious and consistent this way. Sponsored-by: On-Waves ehf
2014-10-09gbproxy/sgsn: Enforce termination when creating a P-TMSI/TLLIJacob Erlbeck1-2/+11
Currently the number of iterations when creating a P-TMSI/TLLI is not limited. It is nevertheless very unlikely that the loop will not terminate. On the other hand, the number of iterations of every loop should have an upper bound (loop variant) which wouldn't be the case here if an arbitrary random generator was used. This patch limits the number of iterations to 23 and logs an error if the creation of the indentifier was aborted due to this limit. Sponsored-by: On-Waves ehf
2014-10-09gbproxy: Restart IMSI acquisition on RA UDP REQJacob Erlbeck1-2/+3
Currently the IMSI acquisition is not restarted when a RA Update Request is received. This leads to repeated N(U) in the generated Ident Request message, which in turn causes the MS to drop the second of these message. This is bad, when the first Ident Response has been lost between MS and gbproxy. This patch changes gbproxy_imsi_acquisition() to handle RA Update Request messages like Attach Requests. Sponsored-by: On-Waves ehf
2014-09-19gbproxy: Separate SGSN numeric namespacesJacob Erlbeck1-6/+13
Currently the SGSN side message's TLLI are searched without checking the originating SGSN. This leads to collisions if both SGSN use the same P-TMSI for different MS. With this patch, the SGSN NSEI is stored within the tlli_info and is used in comparisons to separate the namespaces. Note that this type of collision cannot happen with BSS numbers, since the tlli_info are already separated and stored per (BSS) peer. Sponsored-by: On-Waves ehf
2014-09-18gbproxy: Send DETACH_ACC if the IMSI has not been acquiredJacob Erlbeck1-9/+57
If IMSI acquisition is enabled and the gbproxy receives a Detach request from the MS, it cannot pass it to the SGSN since the acquisition has not yet been completed. This patch implements the generation of a Detach Accept message and for this case and updates the TLLI state accordingly. Sponsored-by: On-Waves ehf
2014-09-18gbproxy: Fixed RAI patching in Attach Request messagesJacob Erlbeck1-4/+0
Currently the RAI in the LLC part of the message is not updated if the message has been taken from the list of stored messages. The reason is, that old_raid_matches is update in gbprox_process_bssgp_ul() but not in gbproxy_flush_stored_messages(). This patch moves the check to gprs_gb_parse_bssgp() which is called at both places and where other fields like parse_ctx->tlli are set, too. In addition, old_raid_matches is replaced by old_raid_is_foreign since this is clearer in the case when there is no old RAI at all. Several RAI patch counter assertions are also added to test_gbproxy_ra_patching(). Sponsored-by: On-Waves ehf
2014-09-18gbproxy: Replace 'mi_data' by 'imsi'Jacob Erlbeck1-2/+2
Since at all places where mi_data/mi_data_len is used it will always contain an IMSI. Thus the names of the identifiers have been updated accordingly for clarity. Sponsored-by: On-Waves ehf
2014-09-18gbproxy: Rework gbproxy_imsi_acquisitionJacob Erlbeck1-30/+30
This commit changes gbproxy_imsi_acquisition as follows: tlli_info->mi_data_len is used instead of parse_ctx->imsi to check, whether the IMSI is known already. Since the function is always called after gbproxy_update_tlli_ul(), the two values are already synchronized. Messages are always flushed when the IMSI gets known, if the current message is IDENT RESP discard it, otherwise continue processing as usual. The 'if' clauses are simplified for better readability. Sponsored-by: On-Waves ehf
2014-09-18gbproxy: Refactor gbprox_process_bssgp_ul into smaller functionsJacob Erlbeck1-132/+195
gbprox_process_bssgp_ul has grown quite large mainly by the addition of IMSI acquisition. This patch moves that code into several smaller functions. In addition, the peer resolution which is similar to that in gbprox_process_bssgp_dl is moved into a separate function, too. Sponsored-by: On-Waves ehf
2014-09-09gbproxy: Remove patch_mode, update initial checksJacob Erlbeck1-1/+5
This patch removes the patch_mode feature including the related VTY command patch-mode. Where sensible, the other configuration flags are queried instead. In addition, this initial checks in gbprox_process_bssgp_dl() and gbprox_process_bssgp_ul() have been updated. The patch mode feature has not been used and was increasingly difficult to maintain. Sponsored-by: On-Waves ehf
2014-09-09gbproxy: Reset IMSI acquisition and free stored messages in tlli_infoJacob Erlbeck1-5/+35
Currently the stored messages are only removed, when IMSI acquisition has succeeded. In addition, receiving two ATTACH_REQ messages in sequence (e.g. due to loss of a Identity Req/Resp message) will not restart the IMSI acquisition procedure. This patch adds gbproxy_tlli_info_discard_messages() to clean up the message list and calls it from gbproxy_delete_tlli() fixing a potential memory leak. It is also called when an Attach Request message has been received. In that case the imsi_acq_pending flag is cleared, too. This would (re-)trigger the IMSI acquisition procedure at each of these messages. If an Ident Response has been lost, resending the Ident Request with the same N(U) will not work. Therefore the N(U) gets incremented on each Ident Request generated by the gbproxy. The first N(U) used is 256 which shouldn't collide with the V(UT) used by the SGSN given that P-TMSI patching is enabled (since a new random TLLI is used initially on every new (no tlli_info) connection and V(U) starts with zero then). Ticket: OW#1261 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 Erlbeck1-4/+4
Currently the gbproxy sends STATUS messages that are not compliant to GSM 08.18, 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 Erlbeck1-1/+1
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: Copy uplink messages to SGSN 2Jacob Erlbeck1-1/+41
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 Erlbeck1-1/+15
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: Support a secondary SGSNJacob Erlbeck1-9/+17
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 Erlbeck1-1/+0
This patch fixes the remaining 'unused' warnings. Sponsored-by: On-Waves ehf
2014-09-02gbproxy: Implement IMSI acquisitionJacob Erlbeck1-9/+184
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: Create STATUS message with original PDUJacob Erlbeck1-14/+28
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: 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-08-24gbproxy: Move peer definitions to gb_proxy_peer.cJacob Erlbeck1-175/+15
This patch moves the peer related definitions from gb_proxy.c to gb_proxy_peer.c and adjusts the prefix of each global symbol to gbproxy_: Peer definitions (prefix adjusted to gbproxy_): peer_ctr_description -> gprs/gb_proxy_peer.c (static) peer_ctrg_desc -> gprs/gb_proxy_peer.c (static) *peer_by_* -> gprs/gb_proxy_peer.c gbproxy_peer_alloc -> gprs/gb_proxy_peer.c gbproxy_peer_free -> gprs/gb_proxy_peer.c gbprox_cleanup_peers -> gprs/gb_proxy_peer.c Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Refactor gb_proxy.c into several filesJacob Erlbeck1-1737/+49
This patch moves several functions and declarations out of gb_proxy.c to make them reusable by other components and to separate them by context and task. Counter enums (prefix is changed to gbproxy_): enum gbprox_global_ctr -> gprs/gb_proxy.h enum gbprox_peer_ctr -> gprs/gb_proxy.h Generic Gb parsing (prefix is changed to gprs_gb_): struct gbproxy_parse_context -> openbsc/gprs_gb_parse.h gbprox_parse_dtap() -> gprs/gprs_gb_parse.c gbprox_parse_llc() -> gprs/gprs_gb_parse.c gbprox_parse_bssgp() -> gprs/gprs_gb_parse.c gbprox_log_parse_context() -> gprs/gprs_gb_parse.c *_shift(), *_match() -> gprs/gprs_gb_parse.c (no prefix) gbprox_parse_gmm_* -> gprs/gprs_gb_parse.c (static) gbprox_parse_gsm_* -> gprs/gprs_gb_parse.c (static) MI testing/parsing (prefix gprs_ added): is_mi_tmsi() -> gprs/gprs_utils.c is_mi_imsi() -> gprs/gprs_utils.c parse_mi_tmsi() -> gprs/gprs_utils.c TLLI state handling (prefix is changed to gbproxy_): gbprox_*tlli* -> gprs/gb_proxy_tlli.c (except gbprox_patch_tlli, gbproxy_make_sgsn_tlli) Message patching (prefix is changed to gbproxy_): gbprox_*patch* -> gprs/gb_proxy_patch.c gbprox_check_imsi -> gprs/gb_proxy_patch.c Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Use different TLLI/P-TMSI for BSS and SGSNJacob Erlbeck1-2/+49
This patch modifies gbprox_make_bss_ptmsi() to generate a new P-TMSI when patch_ptmsi is set in the configuration instead of using the P-TMSI assigned by the SGSN. It modifies gbprox_make_sgsn_tlli() to either use a foreign TLLI based on the SGSN side P-TMSI or (if there is none) generate a random TLLI if patch_ptmsi is set. Otherwise, the TLLI used by the BSS is used. The seeds for the pseudo-random sequences sre set based on time initially. Note that these are neither cryptographically safe nor protected against collisions. Ticket: OW#1259 Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Add context info to log messagesJacob Erlbeck1-3/+9
This mainly adds the NSEI to the messages, similar to log messages ogf the existing gbproxy code. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Patch TLLI/P-TMSIJacob Erlbeck1-0/+123
This patch adds code to modify TLLIs and P-TMSIs. Related counters are also added. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Fix TLLI state handlingJacob Erlbeck1-19/+44
This patch contains fixes for the TLLI tracking and handling. It adds and uses gbprox_map_tlli() the map the source TLLI to the destination TLLI while respecting whether it is current or assigned. It removes gbprox_register_tlli() from the downlink path. It fixes TLLI validation and disables the use of the BSSGP TLLI IE. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Also handle LLC non UI and LL11 messagesJacob Erlbeck1-3/+3
Currently, these messages lead to a parsing error which prevents them from being processed any further. This patch sets the return value of gbprox_parse_llc to 1 in these cases and fixes a segfault which is triggered by any non-04.08 message. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Refactor gbprox_patch_raid(), use different RAI types properlyJacob Erlbeck1-31/+85
Currently gbprox_patch_raid() updates the local MCC/MNC with every BSS originated message, even if the RAI is an 'old' one. This patch separates state updating and patching into 2 functions gbprox_update_current_raid and gbprox_patch_raid. In addition, a field named old_raid_enc is added to gbproxy_parse_context, which is used for 'old RAI' IEs in Attach Requests and RA Update Requests. Only the bssg_raid_enc in BSS originated message is used to update the BSS side 'local' MCC/MNC. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Refactor gbprox_get_detached_tlli_infoJacob Erlbeck1-19/+27
This patch splits the functionality of gbprox_get_detached_tlli_info into 2 new functions: - gbprox_tlli_info_alloc to allocate an intialized and detached tlli_info - gbprox_detach_tlli_info to detach an already attached tlli_info Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Track SGSN and BSS TLLI/PTMSI separatelyJacob Erlbeck1-61/+235
This patch separates BSS side from SGSN side TLLI/PTMSI tracking. When TLLI/PTMSI patching is not enabled, the corresponding states shall be identical. The TLLI/PTMSI state has been moved into the struct gbproxy_tlli_state and is used twice in gbproxy_tlli_info. Since the state handling for uplink and downlink messages is diverging, gbprox_update_state() is replaced by two functions gbprox_update_state_dl/gbprox_update_state_ul and gbprox_process_bssgp_message() is replaced by gbprox_process_bssgp_dl/gbprox_process_bssgp_ul. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Handle old and new P-TMSI/TLLIJacob Erlbeck1-9/+48
Don't replace the current TLLI immediately, store it in an additional 'assigned_tlli' field and discard the old TLLI when both sides have used the new one (see GSM 04.08, Add an Attach Complete message to test and check, whether the related field of the corresponding tlli_info struct are set as expected during the local TLLI validation cycle. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Update enable_patching flag on existing tlli_infoJacob Erlbeck1-1/+9
Currently the enable_patching field in tlli_info is not updated, when an IMSI is assigned to a TLLI that is already known. This patch fixes this in gbprox_update_state() after the call to gbprox_update_tlli_info(). The number of APN increases and the test output file is updated accordingly. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Parse Detach Request messagesJacob Erlbeck1-4/+43
GSM 24.008 also allows a P-TMSI field in Detach request messages. This patch adds gbprox_parse_gmm_detach_req() to parse Detach Request messages which sets the ptmsi field if the IE is present. In addition, when power_off is set to 1 (MO only), the invalidate_tlli field is set, since Detach Request message is expected in this case. The second detach test (see 'RA update') is modified to use power_off instead of relying on a Detach Accept from the network. To make this work, the PTMSI of the RA Update Accept is fixed to match the TLLI of the Detach Request. Sponsored-by: On-Waves ehf
2014-08-22gbproxy: Add gbprox_clear_patch_filter() (Coverity)Jacob Erlbeck1-4/+9
Add a separate function to clear the IMSI filter to be used instead of gbprox_set_patch_filter(cfg, NULL, ...). Albeit it fixes a Coverity issue (Unchecked return value), it is a false positive, since the return value is always 0 in these cases. Nevertheless it is more obvious what happens when an explicit clear function is called. Using NULL as filter argument of gbprox_set_patch_filter still clears the filter. Fixes: Coverity CID 1231255 Sponsored-by: On-Waves ehf
2014-08-13gbproxy: Pass tlli_info aroundJacob Erlbeck1-23/+55
This patch modifies the code to pass a pointer to the tlli_info around once it has been acquired. To achieve this, gbprox_register_tlli() and gbprox_update_state() are modified to return it (if it has been found or created), and gbprox_patch_llc(), gbprox_patch_bssgp(), and gbprox_update_state_after() are modified to take it as parameter. Add a new function gbprox_touch_tlli() to update timestamp and list ordering for existing tlli_infos. The motivation behind this patch is to make the tlli_info available to the patching code and to avoid repeated searches for the same TLLI. Sponsored-by: On-Waves ehf