aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gb_proxy_vty.c
AgeCommit message (Collapse)AuthorFilesLines
2014-09-19gbproxy: Separate SGSN numeric namespacesJacob Erlbeck1-10/+22
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-19gbproxy: Delete and show detached entries via VTYJacob Erlbeck1-34/+65
This commit adds/modifies the following VTY commands: - delete-gbproxy-tlli <NSEI> de-registered : Delete all de-registered entries - show gbproxy tllis : Display 'DE-REGISTERED' when appropriate In addition, the implementation of the delete-gbproxy-tlli command has been split into two functions (with and without TLLI/IMSI value). Sponsored-by: On-Waves ehf
2014-09-19gbproxy: Keep tlli_info after detachJacob Erlbeck1-0/+29
Currently a tlli_info entry is deleted when the TLLI gets invalidated by a Detach message. This patch introduces the possibility to keep tlli_info entries in the list. Those entries then have cleared TLLI fields, are marked as de-registered, and can only be retrieved by a message containing an IMSI or a P-TMSI. The following VTY configuration commands are added to the gbproxy node: - tlli-list keep-mode never : Don't keep the entries (default) - tlli-list keep-mode re-attach : Only keep them, when a Detach message with re-attach required has been received - tlli-list keep-mode identified : Only keep entries which are associated with an IMSI - tlli-list keep-mode always : Keep all entries Note that at least one of max-length or max-age should be set when this feature is used to limit the number of entries. Sponsored-by: On-Waves ehf
2014-09-18gbproxy: Replace 'mi_data' by 'imsi'Jacob Erlbeck1-5/+5
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-09gbproxy: Remove patch_mode, update initial checksJacob Erlbeck1-36/+0
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-08gbproxy: Reorganize VTY commandsJacob Erlbeck1-53/+70
Since the secondary SGSN selection and APN patching can both be enable/disabled by IMSI matching, this patch introduces a separate match-imsi command and removes the corresponding variant of the core-access-point-name command. P-TMSI patching and IMSI acquisition are enabled/disabled by match-imsi resp. secondary-sgsn. The patch-ptmsi and acquire-imsi commands are still available for internal testing but are subject to being removed. Sponsored-by: On-Waves ehf
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: 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: Support a secondary SGSNJacob Erlbeck1-0/+28
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-02gbproxy: Implement IMSI acquisitionJacob Erlbeck1-0/+24
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-08-29gprs: Document the stale option in delete-gbproxy-tlliHolger Hans Peter Freyther1-0/+1
2014-08-24gbproxy: Move peer definitions to gb_proxy_peer.cJacob Erlbeck1-3/+3
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-5/+5
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: Add 'patch-ptmsi' command to enable TLLI/P-TMSI patchingJacob Erlbeck1-0/+29
This VTY command add the following commands to the gbproxy node: - patch-ptmsi: Enables P-TMSI/TLLI patching - no patch-ptmsi: Disables P-TMSI/TLLI patching Note that using these commands interactively can load to undefined behavior of existing LLC connections. Sponsored-by: On-Waves ehf
2014-08-24gbproxy: Track SGSN and BSS TLLI/PTMSI separatelyJacob Erlbeck1-3/+4
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-22gbproxy: Add gbprox_clear_patch_filter() (Coverity)Jacob Erlbeck1-2/+2
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: Track TLLI even when the IMSI is not knownJacob Erlbeck1-4/+8
Currently only TLLIs for which it is known that they may be patched are put into the TLLI list. This patch changes this to add TLLIs even when the IMSI is not yet known. A enable_patching flag is added to the gbproxy_tlli_info structure to control patching. Note that this puts every active TLLI into the list where accesses are O(N) currently. Sponsored-by: On-Waves ehf
2014-08-04gbproxy: Kill the global gbprox_global_patch_state structHolger Hans Peter Freyther1-3/+3
Move this patching state into the gbproxy_config as well. Done by Jacob
2014-08-04gbproxy: Remove global state from the gbproxyHolger Hans Peter Freyther1-8/+8
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: Add testcases for the APN string/octet conversion and fix itHolger Hans Peter Freyther1-1/+1
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-04gprs: Create a gprs_utils file and move to be shared code in thereHolger Hans Peter Freyther1-2/+3
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 Freyther1-9/+9
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: Have a clear namespace for the public functionsHolger Hans Peter Freyther1-1/+1
Done with Jacob
2014-08-04gbproxy: Remove the global rate counter and place it in the configHolger Hans Peter Freyther1-1/+1
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 Freyther1-1/+1
Done with Jacob
2014-08-04gbproxy: Move the VTY code into the vty file and create public APIHolger Hans Peter Freyther1-0/+235
Create public accessors to the core of the peer to allow to simplify the test and separate concerns. Done with Jacob.
2014-07-22gprs/vty: Add commands to manage the TLLI listJacob Erlbeck1-0/+2
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 Erlbeck1-29/+132
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: Add APN patch support for LLC/GSM messagesJacob Erlbeck1-3/+67
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 Erlbeck1-0/+34
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 Erlbeck1-0/+52
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
2013-10-30vty: Use vty_install_default() instead of bsc_install_default()Jacob Erlbeck1-1/+1
Remove ournode_exit_cmd, ournode_end_cmd, and bsc_install_default() since this functionality is provided by the current libosmocore. Replace calls to bsc_install_default() by call to vty_install_default() with the following semantic patch: @rule1@ expression N; @@ - bsc_install_default(N); + vty_install_default(N); Ticket: OW#952 Sponsored-by: On-Waves ehf
2013-10-24gbproxy/vty: Enhance delete-gbproxy-peer commandJacob Erlbeck1-1/+2
This adds the option to delete all BVC peers and/or NS_VC with a given NSEI with a single command. Static (configured) NS-VC are not affected. In addition, all connections for this NSEI that can be deleted by this command can be listed without deleting them by appending 'dry-run' to the command. Sponsored-by: On-Waves ehf
2013-10-24gbproxy: Add a command to delete peers from the GBProxyHolger Hans Peter Freyther1-0/+2
This just deletes the peer entry based on NSEI and BVCI. The NS-VC are not touched.
2013-09-02vty: Use generic 'end' and 'exit' commandsJacob Erlbeck1-3/+1
Add bsc_install_default() and replace all install_default() This patch adds bsc_install_default() which calls install_default() and add 'exit' and 'end'. All other calls to install_default() are replaced by calls to bsc_install_default(). Since 'exit' and 'end' are now added automatically to each node, the explicit registrations of these commands are removed by this patch, too. The related tests succeed now without work-arounds (except for the 'config' node itself which is part of libosmocore).
2012-08-17VTY: improve VTY prompt and make sure exit/end works everywhereHarald Welte1-1/+1
Some nodes below 'config' didn't have ournode_exit / ournode_end, and thus were not able to properly perform this function. exit should always only go back one level, while end drops us back to ENABLE_NODE. The prompt now represents the nesting level, and there's one consistent space after the final prompt character (typically #).
2012-06-16split libgb into a separate library for outside useHarald Welte1-1/+2
This also removes the dependency to osmo_sock() inside libcommon and replaces it with osmo_sock_* from libosmocore
2011-11-06gb_proxy: Make sure each parameter has some sort of documentationHolger Hans Peter Freyther1-1/+3
2011-04-18misc: Remove sys/types.h includes from the filesHolger Hans Peter Freyther1-1/+0
These are not needed any more. We used them for u_int types but we now use uint which comes from stdint.h
2011-03-23src: use new library libosmogsm and new path to headers in libosmocorePablo Neira Ayuso1-1/+1
libosmogsm is a new library that is distributed in the libosmocore. Now, openbsc depends on it. This patch gets openbsc with this change. This patch also rewrites all include path to the new osmocom/[gsm|core] Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-01-01License change: We are now AGPLv3+ instead of GPLv2+Harald Welte1-6/+5
The reason for this is quite simple: We want to make sure anyone running a customized version of OpenBSC to operate a network will have to release all custom modifiations to the source code.
2010-05-25Migrate VTY code to libosmovtyHarald Welte1-2/+2
2010-05-23gb_proxy_vty.c: Remove variable that appears to be unusedHolger Hans Peter Freyther1-2/+0
There is no other in_addr inside this file and it appears that we don't use the 'ia' right now and will not use it in the near future.
2010-05-19[GPRS] NS: VTY: Move all local ip/port bind values into 'ns' nodeHarald Welte1-35/+2
This removes the requirement for gb_proxy and sgsn to have duplicate vty parsing code
2010-05-19[SGSN] Gb Proxy: Simplify configurationHarald Welte1-46/+0
Almost all parameters about the SGSNs NS-VC can be specified in the NS protocol node. All that needs to remain in the gbproxy config node is "nsip sgsn nsei XXX".
2010-05-16VTY: decouple telnet_interface from 'struct gsmnet'Harald Welte1-1/+1
We want the VTY and telnet code to be independent from the BSC application(s). As a side note, we also like to eliminate static global variables for 'struct gsm_network' all over the code. As such, telnet_init() is now passed along a "private" pointer, which getst stored in telnet_connection.priv. This telnet_connection is then stored in vty->priv, which in turn gets dereferenced if anyone needs a reference to 'struct gsm_network' from the BSC vty code. Also: * vty_init() now calls cmd_init() * the ugliness that telnet_init() calls back into the application by means of bsc_vty_init() function has been removed. * telnet_init() now returns any errors, so the main program can exit e.g. if the port is already in use.
2010-05-14[VTY] Introduce "end" command that works from any level in configHarald Welte1-0/+1
Using "end" you can always return to the "enable" level, and from there the "show" commands are available. So no more need for exit/exit/exit/exit/disable.
2010-05-14[VTY] Remove OpenBSC specific node-exit handling from src/vtyHarald Welte1-0/+2
The idea is to move the VTY code into libosmocore at some point, and for that we need to eliminate OpenBSC specifics from it
2010-05-12use new install_element_ve()Harald Welte1-2/+1
2010-05-12Make sure all commands of SHOW_NODE to ENABLE_NODEHarald Welte1-0/+1